diff options
author | Max Horn | 2002-07-27 14:16:14 +0000 |
---|---|---|
committer | Max Horn | 2002-07-27 14:16:14 +0000 |
commit | 39670a73c04e3e35b4c68d98ec4956ba7ed9710c (patch) | |
tree | d6dabe7da514070cf40e80eae6474658b3377f0e /gui/dialog.cpp | |
parent | 403afb0514a796c77d004b5be342946ffc023953 (diff) | |
download | scummvm-rg350-39670a73c04e3e35b4c68d98ec4956ba7ed9710c.tar.gz scummvm-rg350-39670a73c04e3e35b4c68d98ec4956ba7ed9710c.tar.bz2 scummvm-rg350-39670a73c04e3e35b4c68d98ec4956ba7ed9710c.zip |
heaps of changes to NewGUI: mouseDown/Up events now count the clicks (so you can detect double/triple clicks); ListWidget sends a message if an item was double clicked or changed; you can abort editing in the ListWidget by pressing ESC; SaveLoadDialog will save when you double click and item, and when you finish editing an item by pressing return, will save
svn-id: r4656
Diffstat (limited to 'gui/dialog.cpp')
-rw-r--r-- | gui/dialog.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index c4f53892c7..a6bb965f98 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -93,7 +93,7 @@ void Dialog::draw() } } -void Dialog::handleMouseDown(int x, int y, int button) +void Dialog::handleMouseDown(int x, int y, int button, int clickCount) { Widget *w; w = findWidget(x, y); @@ -112,10 +112,10 @@ void Dialog::handleMouseDown(int x, int y, int button) } if (_focusedWidget) - _focusedWidget->handleMouseDown(x - _focusedWidget->_x, y - _focusedWidget->_y, button); + _focusedWidget->handleMouseDown(x - _focusedWidget->_x, y - _focusedWidget->_y, button, clickCount); } -void Dialog::handleMouseUp(int x, int y, int button) +void Dialog::handleMouseUp(int x, int y, int button, int clickCount) { Widget *w; @@ -133,17 +133,14 @@ void Dialog::handleMouseUp(int x, int y, int button) } if (w) - w->handleMouseUp(x - w->_x, y - w->_y, button); + w->handleMouseUp(x - w->_x, y - w->_y, button, clickCount); } void Dialog::handleKeyDown(char key, int modifiers) { - // ESC closes all dialogs by default - if (key == 27) - close(); - if (_focusedWidget) { - _focusedWidget->handleKeyDown(key, modifiers); + if (_focusedWidget->handleKeyDown(key, modifiers)) + return; } else { // Hotkey handling Widget *w = _firstWidget; @@ -152,13 +149,17 @@ void Dialog::handleKeyDown(char key, int modifiers) if (w->_type == kButtonWidget && key == toupper(((ButtonWidget *)w)->_hotkey)) { // We first send a mouseDown then a mouseUp. // FIXME: insert a brief delay between both. - w->handleMouseDown(0, 0, 1); - w->handleMouseUp(0, 0, 1); - break; + w->handleMouseDown(0, 0, 1, 1); + w->handleMouseUp(0, 0, 1, 1); + return; } w = w->_next; } } + + // ESC closes all dialogs by default + if (key == 27) + close(); } void Dialog::handleKeyUp(char key, int modifiers) @@ -303,6 +304,7 @@ SaveLoadDialog::SaveLoadDialog(NewGui *gui) void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { + case kListItemChangedCmd: case kSaveCmd: if (_savegameList->getSelected() > 0 && !_savegameList->getSelectedString().isEmpty()) { Scumm *s = _gui->getScumm(); @@ -313,6 +315,7 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat close(); } break; + case kListItemDoubleClickedCmd: case kLoadCmd: if (_savegameList->getSelected() > 0 && !_savegameList->getSelectedString().isEmpty()) { Scumm *s = _gui->getScumm(); |