aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.cpp
diff options
context:
space:
mode:
authorMax Horn2002-07-26 00:41:07 +0000
committerMax Horn2002-07-26 00:41:07 +0000
commit84c8d4b689168335da090bae57f4a162ee10018d (patch)
treef3f5ea98571500c4a203c6d173b8be9e8d486f95 /gui/widget.cpp
parent4211eb8437e5708d9644ded1dd89c9cf526fbf92 (diff)
downloadscummvm-rg350-84c8d4b689168335da090bae57f4a162ee10018d.tar.gz
scummvm-rg350-84c8d4b689168335da090bae57f4a162ee10018d.tar.bz2
scummvm-rg350-84c8d4b689168335da090bae57f4a162ee10018d.zip
added painelf's (still unfinished) sound dialog in NewGUI. Beware, this is work in progress, don't report problems with it just yet, we already know they are there :-)
svn-id: r4635
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r--gui/widget.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index b2967f85d2..06c6161ce4 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -219,18 +219,18 @@ void SliderWidget::drawWidget(bool hilite)
// Remove old 'bar' if necessary
if (_value != _old_value) {
- gui->fillRect(_x + 2 + ((_w - 5) * _old_value / 100), _y + 2, 2, _h - 4, gui->_bgcolor);
+ gui->fillRect(_x + 2 + ((_w - 5) * (_old_value - _valueMin) / _valueDelta), _y + 2, 2, _h - 4, gui->_bgcolor);
_old_value = _value;
}
// Draw the 'bar'
- gui->fillRect(_x + 2 + ((_w - 5) * _value / 100), _y + 2, 2, _h - 4, hilite ? gui->_textcolorhi : gui->_textcolor);
+ gui->fillRect(_x + 2 + ((_w - 5) * (_value - _valueMin) / _valueDelta), _y + 2, 2, _h - 4, hilite ? gui->_textcolorhi : gui->_textcolor);
}
void SliderWidget::handleMouseDown(int x, int y, int button) {
int barx;
- barx = 2 + ((_w - 5) * _old_value / 100);
+ barx = 2 + ((_w - 5) * (_value - _valueMin) / _valueDelta);
// only start dragging if mouse is over bar
if (x > (barx - 3) && x < (barx + 3))
@@ -238,5 +238,11 @@ void SliderWidget::handleMouseDown(int x, int y, int button) {
}
void SliderWidget::handleMouseUp(int x, int y, int button) {
+
+ if (_isDragging) {
+ if (_flags & WIDGET_ENABLED)
+ sendCommand(_cmd, 0);
+ }
+
_isDragging = false;
}