aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.cpp
diff options
context:
space:
mode:
authorMax Horn2002-07-27 00:05:46 +0000
committerMax Horn2002-07-27 00:05:46 +0000
commitc318fed6338fd232deff621141f58789ffbbad89 (patch)
tree20d9bced9297d06f7e6749c4a98ce8cd414d1acb /gui/widget.cpp
parent072ed82a3728c00fa2cca00db6cecb6e451f918a (diff)
downloadscummvm-rg350-c318fed6338fd232deff621141f58789ffbbad89.tar.gz
scummvm-rg350-c318fed6338fd232deff621141f58789ffbbad89.tar.bz2
scummvm-rg350-c318fed6338fd232deff621141f58789ffbbad89.zip
improved the sound dialog; but my goal is to get rid of it, and merge the sound & misc dialogs into the options dialog
svn-id: r4648
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r--gui/widget.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index bb0e419d71..c13ae7f4e1 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -104,6 +104,16 @@ void StaticTextWidget::setLabel(const char *label)
_label = 0;
}
+void StaticTextWidget::setValue(int value)
+{
+ // Free old label if any
+ if (_label)
+ free(_label);
+
+ _label = (char *)malloc(10);
+ sprintf(_label, "%d", value);
+}
+
void StaticTextWidget::drawWidget(bool hilite)
{
NewGui *gui = _boss->getGui();
@@ -197,7 +207,7 @@ SliderWidget::SliderWidget(Dialog *boss, int x, int y, int w, int h, const char
}
void SliderWidget::handleMouseMoved(int x, int y, int button) {
- if (_isDragging) {
+ if ((_flags & WIDGET_ENABLED) && _isDragging) {
int newValue = posToValue(x);
if (newValue < _valueMin)
@@ -208,25 +218,28 @@ void SliderWidget::handleMouseMoved(int x, int y, int button) {
if (newValue != _value) {
_value = newValue;
draw();
+ sendCommand(_cmd, _value); // FIXME - hack to allow for "live update" in sound dialog
}
}
}
void SliderWidget::handleMouseDown(int x, int y, int button) {
- int barx;
-
- barx = valueToPos(_value);
- // only start dragging if mouse is over bar
- if (x > (barx - 3) && x < (barx + 3))
- _isDragging = true;
+ if (_flags & WIDGET_ENABLED) {
+ int barx;
+
+ barx = valueToPos(_value);
+
+ // only start dragging if mouse is over bar
+ if (x > (barx - 3) && x < (barx + 3))
+ _isDragging = true;
+ }
}
void SliderWidget::handleMouseUp(int x, int y, int button) {
- if (_isDragging) {
- if (_flags & WIDGET_ENABLED)
- sendCommand(_cmd, 0);
+ if ((_flags & WIDGET_ENABLED) && _isDragging) {
+ sendCommand(_cmd, _value);
}
_isDragging = false;