diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ListWidget.cpp | 19 | ||||
-rw-r--r-- | gui/PopUpWidget.cpp | 15 | ||||
-rw-r--r-- | gui/console.cpp | 38 | ||||
-rw-r--r-- | gui/dialog.cpp | 3 | ||||
-rw-r--r-- | gui/editable.cpp | 19 |
5 files changed, 49 insertions, 45 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 9d7494115b..271cbccd94 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -24,6 +24,7 @@ #include "common/stdafx.h" #include "common/system.h" +#include "common/events.h" #include "gui/ListWidget.h" #include "gui/ScrollBarWidget.h" #include "gui/dialog.h" @@ -231,39 +232,39 @@ bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) { // not editmode switch (keycode) { - case '\n': // enter/return - case '\r': + case Common::KEYCODE_RETURN: + case Common::KEYCODE_KP_ENTER: if (_selectedItem >= 0) { // override continuous enter keydown - if (_editable && (_currentKeyDown != '\n' && _currentKeyDown != '\r')) { + if (_editable && (_currentKeyDown != Common::KEYCODE_RETURN && _currentKeyDown != Common::KEYCODE_KP_ENTER)) { dirty = true; startEditMode(); } else sendCommand(kListItemActivatedCmd, _selectedItem); } break; - case 256+17: // up arrow + case Common::KEYCODE_UP: if (_selectedItem > 0) _selectedItem--; break; - case 256+18: // down arrow + case Common::KEYCODE_DOWN: if (_selectedItem < (int)_list.size() - 1) _selectedItem++; break; - case 256+24: // pageup + case Common::KEYCODE_PAGEUP: _selectedItem -= _entriesPerPage - 1; if (_selectedItem < 0) _selectedItem = 0; break; - case 256+25: // pagedown + case Common::KEYCODE_PAGEDOWN: _selectedItem += _entriesPerPage - 1; if (_selectedItem >= (int)_list.size() ) _selectedItem = _list.size() - 1; break; - case 256+22: // home + case Common::KEYCODE_HOME: _selectedItem = 0; break; - case 256+23: // end + case Common::KEYCODE_END: _selectedItem = _list.size() - 1; break; default: diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp index 1bdce8a24e..d40a01c981 100644 --- a/gui/PopUpWidget.cpp +++ b/gui/PopUpWidget.cpp @@ -24,6 +24,7 @@ #include "common/stdafx.h" #include "common/system.h" +#include "common/events.h" #include "gui/dialog.h" #include "gui/eval.h" #include "gui/newgui.h" @@ -210,7 +211,7 @@ void PopUpDialog::handleMouseMoved(int x, int y, int button) { } void PopUpDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { - if (keycode == 27) { // escape + if (keycode == Common::KEYCODE_ESCAPE) { // Don't change the previous selection setResult(-1); close(); @@ -221,21 +222,21 @@ void PopUpDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { return; switch (keycode) { - case '\n': // enter/return - case '\r': + case Common::KEYCODE_RETURN: + case Common::KEYCODE_KP_ENTER: setResult(_selection); close(); break; - case 256+17: // up arrow + case Common::KEYCODE_UP: moveUp(); break; - case 256+18: // down arrow + case Common::KEYCODE_DOWN: moveDown(); break; - case 256+22: // home + case Common::KEYCODE_HOME: setSelection(0); break; - case 256+23: // end + case Common::KEYCODE_END: setSelection(_popUpBoss->_entries.size()-1); break; } diff --git a/gui/console.cpp b/gui/console.cpp index 9186c7b405..b7c257d3ce 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -265,8 +265,8 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { return; switch (keycode) { - case '\n': // enter/return - case '\r': { + case Common::KEYCODE_RETURN: + case Common::KEYCODE_KP_ENTER: { if (_caretVisible) drawCaret(true); @@ -307,10 +307,10 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { slideUpAndClose(); break; } - case 27: // escape + case Common::KEYCODE_ESCAPE: slideUpAndClose(); break; - case 8: // backspace + case Common::KEYCODE_BACKSPACE: if (_caretVisible) drawCaret(true); @@ -321,7 +321,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { scrollToCurrent(); drawLine(pos2line(_currentPos)); break; - case 9: // tab + case Common::KEYCODE_TAB: { if (_completionCallbackProc) { int len = _currentPos - _promptStartPos; @@ -346,11 +346,11 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { } break; } - case 127: + case Common::KEYCODE_DELETE: killChar(); drawLine(pos2line(_currentPos)); break; - case 256 + 24: // pageup + case Common::KEYCODE_PAGEUP: if (modifiers == Common::KBD_SHIFT) { _scrollLine -= _linesPerPage - 1; if (_scrollLine < _firstLineInBuffer + _linesPerPage - 1) @@ -359,7 +359,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { draw(); } break; - case 256 + 25: // pagedown + case Common::KEYCODE_PAGEDOWN: if (modifiers == Common::KBD_SHIFT) { _scrollLine += _linesPerPage - 1; if (_scrollLine > _promptEndPos / kCharsPerLine) { @@ -371,7 +371,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { draw(); } break; - case 256 + 22: // home + case Common::KEYCODE_HOME: if (modifiers == Common::KBD_SHIFT) { _scrollLine = _firstLineInBuffer + _linesPerPage - 1; updateScrollBuffer(); @@ -380,7 +380,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { } draw(); break; - case 256 + 23: // end + case Common::KEYCODE_END: if (modifiers == Common::KBD_SHIFT) { _scrollLine = _promptEndPos / kCharsPerLine; if (_scrollLine < _linesPerPage - 1) @@ -391,18 +391,18 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { } draw(); break; - case 273: // cursor up + case Common::KEYCODE_UP: historyScroll(+1); break; - case 274: // cursor down + case Common::KEYCODE_DOWN: historyScroll(-1); break; - case 275: // cursor right + case Common::KEYCODE_RIGHT: if (_currentPos < _promptEndPos) _currentPos++; drawLine(pos2line(_currentPos)); break; - case 276: // cursor left + case Common::KEYCODE_LEFT: if (_currentPos > _promptStartPos) _currentPos--; drawLine(pos2line(_currentPos)); @@ -446,25 +446,25 @@ void ConsoleDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data void ConsoleDialog::specialKeys(int keycode) { switch (keycode) { - case 'a': + case Common::KEYCODE_a: _currentPos = _promptStartPos; draw(); break; - case 'd': + case Common::KEYCODE_d: if (_currentPos < _promptEndPos) { killChar(); draw(); } break; - case 'e': + case Common::KEYCODE_e: _currentPos = _promptEndPos; draw(); break; - case 'k': + case Common::KEYCODE_k: killLine(); draw(); break; - case 'w': + case Common::KEYCODE_w: killLastWord(); draw(); break; diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 3bcf770ff3..1afd18ec52 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -23,6 +23,7 @@ */ #include "common/stdafx.h" +#include "common/events.h" #include "gui/newgui.h" #include "gui/dialog.h" @@ -233,7 +234,7 @@ void Dialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { } // ESC closes all dialogs by default - if (keycode == 27) { + if (keycode == Common::KEYCODE_ESCAPE) { setResult(-1); close(); } diff --git a/gui/editable.cpp b/gui/editable.cpp index 6199ea67fa..a8638b8b48 100644 --- a/gui/editable.cpp +++ b/gui/editable.cpp @@ -23,6 +23,7 @@ */ #include "common/stdafx.h" +#include "common/events.h" #include "gui/editable.h" #include "gui/newgui.h" @@ -94,17 +95,17 @@ bool EditableWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) { drawCaret(true); switch (keycode) { - case '\n': // enter/return - case '\r': + case Common::KEYCODE_RETURN: + case Common::KEYCODE_KP_ENTER: // confirm edit and exit editmode endEditMode(); dirty = true; break; - case 27: // escape + case Common::KEYCODE_ESCAPE: abortEditMode(); dirty = true; break; - case 8: // backspace + case Common::KEYCODE_BACKSPACE: if (_caretPos > 0) { _caretPos--; _editString.deleteChar(_caretPos); @@ -112,32 +113,32 @@ bool EditableWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) { } forcecaret = true; break; - case 127: // delete + case Common::KEYCODE_DELETE: if (_caretPos < (int)_editString.size()) { _editString.deleteChar(_caretPos); dirty = true; } forcecaret = true; break; - case 256 + 20: // left arrow + case Common::KEYCODE_LEFT: if (_caretPos > 0) { dirty = setCaretPos(_caretPos - 1); } forcecaret = true; dirty = true; break; - case 256 + 19: // right arrow + case Common::KEYCODE_RIGHT: if (_caretPos < (int)_editString.size()) { dirty = setCaretPos(_caretPos + 1); } forcecaret = true; dirty = true; break; - case 256 + 22: // home + case Common::KEYCODE_HOME: dirty = setCaretPos(0); forcecaret = true; break; - case 256 + 23: // end + case Common::KEYCODE_END: dirty = setCaretPos(_editString.size()); forcecaret = true; break; |