[Scummvm-cvs-logs] SF.net SVN: scummvm:[41311] scummvm/trunk/gui
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Jun 7 01:22:48 CEST 2009
Revision: 41311
http://scummvm.svn.sourceforge.net/scummvm/?rev=41311&view=rev
Author: fingolfin
Date: 2009-06-06 23:22:48 +0000 (Sat, 06 Jun 2009)
Log Message:
-----------
GUI: Tweaked the launcher so that TAB switches focus between the list and the quick search field
Modified Paths:
--------------
scummvm/trunk/gui/dialog.cpp
scummvm/trunk/gui/dialog.h
scummvm/trunk/gui/launcher.cpp
Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp 2009-06-06 23:22:35 UTC (rev 41310)
+++ scummvm/trunk/gui/dialog.cpp 2009-06-06 23:22:48 UTC (rev 41311)
@@ -92,10 +92,7 @@
w = w->_next;
}
- if (w) {
- w->receivedFocus();
- _focusedWidget = w;
- }
+ setFocusWidget(w);
}
void Dialog::close() {
@@ -123,6 +120,18 @@
GuiObject::reflowLayout();
}
+void Dialog::setFocusWidget(Widget *widget) {
+ // The focus will change. Tell the old focused widget (if any)
+ // that it lost the focus.
+ releaseFocus();
+
+ // Tell the new focused widget (if any) that it just gained the focus.
+ if (widget)
+ widget->receivedFocus();
+
+ _focusedWidget = widget;
+}
+
void Dialog::releaseFocus() {
if (_focusedWidget) {
_focusedWidget->lostFocus();
@@ -165,15 +174,7 @@
// If the click occured inside a widget which is not the currently
// focused one, change the focus to that widget.
if (w && w != _focusedWidget && w->wantsFocus()) {
- // The focus will change. Tell the old focused widget (if any)
- // that it lost the focus.
- releaseFocus();
-
- // Tell the new focused widget (if any) that it just gained the focus.
- if (w)
- w->receivedFocus();
-
- _focusedWidget = w;
+ setFocusWidget(w);
}
if (w)
Modified: scummvm/trunk/gui/dialog.h
===================================================================
--- scummvm/trunk/gui/dialog.h 2009-06-06 23:22:35 UTC (rev 41310)
+++ scummvm/trunk/gui/dialog.h 2009-06-06 23:22:48 UTC (rev 41311)
@@ -63,6 +63,8 @@
bool isVisible() const { return _visible; }
void releaseFocus();
+ void setFocusWidget(Widget *widget);
+ Widget *getFocusWidget() { return _focusedWidget; }
virtual void reflowLayout();
Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp 2009-06-06 23:22:35 UTC (rev 41310)
+++ scummvm/trunk/gui/launcher.cpp 2009-06-06 23:22:48 UTC (rev 41311)
@@ -871,6 +871,14 @@
}
void LauncherDialog::handleKeyDown(Common::KeyState state) {
+ if (state.keycode == Common::KEYCODE_TAB) {
+ // Toggle between the game list and the quick search field.
+ if (getFocusWidget() == _searchWidget) {
+ setFocusWidget(_list);
+ } else if (getFocusWidget() == _list) {
+ setFocusWidget(_searchWidget);
+ }
+ }
Dialog::handleKeyDown(state);
updateButtons();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list