From 84c8d4b689168335da090bae57f4a162ee10018d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 26 Jul 2002 00:41:07 +0000 Subject: 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 --- gui/widget.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gui/widget.cpp') 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; } -- cgit v1.2.3