Renamed _clickedWidget -> _dragWidget; if a drag is in process, send the mouse moved / mouse up events to the widget on which the drag is performed (this fixes at least one bug and improves the user experience)

svn-id: r16362
This commit is contained in:
Max Horn 2004-12-28 21:07:34 +00:00
parent 8e42cbde2a
commit a40ed29abd
3 changed files with 14 additions and 17 deletions

View file

@ -201,15 +201,13 @@ void CheckboxWidget::drawWidget(bool hilite) {
SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint labelWidth, uint32 cmd, uint8 hotkey)
: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey),
_value(0), _oldValue(0),_valueMin(0), _valueMax(100), _isDragging(false),
_value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false),
_labelWidth(labelWidth) {
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
_type = kSliderWidget;
}
void SliderWidget::handleMouseMoved(int x, int y, int button) {
// TODO: when the mouse is dragged outside the widget, the slider should
// snap back to the old value.
if (isEnabled() && _isDragging && x >= (int)_labelWidth) {
int newValue = posToValue(x - _labelWidth);
if (newValue < _valueMin)