GUI: Tweaked the launcher so that TAB switches focus between the list and the quick search field

svn-id: r41311
This commit is contained in:
Max Horn 2009-06-06 23:22:48 +00:00
parent 34d097be20
commit f906c4e80f
3 changed files with 24 additions and 13 deletions

View file

@ -92,10 +92,7 @@ void Dialog::open() {
w = w->_next;
}
if (w) {
w->receivedFocus();
_focusedWidget = w;
}
setFocusWidget(w);
}
void Dialog::close() {
@ -123,6 +120,18 @@ void Dialog::reflowLayout() {
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 @@ void Dialog::handleMouseDown(int x, int y, int button, int clickCount) {
// 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)