Implemented EditTextWidget; fixed Add Game/Remove Game in launcher; make use of EditTextWidget in EditGameDialog; various other tweaks

svn-id: r5665
This commit is contained in:
Max Horn 2002-11-21 15:20:52 +00:00
parent 5852b6a09b
commit 9ff12dbc01
9 changed files with 223 additions and 65 deletions

View file

@ -90,12 +90,18 @@ void Dialog::close()
_mouseWidget->handleMouseLeft(0);
_mouseWidget = 0;
}
releaseFocus();
}
void Dialog::releaseFocus()
{
if (_focusedWidget) {
_focusedWidget->lostFocus();
_focusedWidget = 0;
}
}
void Dialog::draw()
{
_gui->_needRedraw = true;
@ -134,8 +140,7 @@ void Dialog::handleMouseDown(int x, int y, int button, int clickCount)
if (w && w != _focusedWidget) {
// The focus will change. Tell the old focused widget (if any)
// that it lost the focus.
if (_focusedWidget)
_focusedWidget->lostFocus();
releaseFocus();
// Tell the new focused widget (if any) that it just gained the focus.
if (w)
@ -157,8 +162,7 @@ void Dialog::handleMouseUp(int x, int y, int button, int clickCount)
// Lose focus on mouseup unless the widget requested to retain the focus
if (! (_focusedWidget->getFlags() & WIDGET_RETAIN_FOCUS )) {
_focusedWidget->lostFocus();
_focusedWidget = 0;
releaseFocus();
}
} else {
@ -208,6 +212,8 @@ void Dialog::handleKeyDown(char key, int modifiers)
// ESC closes all dialogs by default
if (key == 27)
close();
// TODO: tab/shift-tab should focus the next/previous focusable widget
}
void Dialog::handleKeyUp(char key, int modifiers)