Improved keyboard navigation within lists somewhat (it's still wrong when going up, but i have no idea how to avoid this problem without rewriting the list control)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3669 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
47224bd947
commit
d2f3e9d70c
@ -111,7 +111,7 @@ PressAKeyDialog::PressAKeyDialog(const float w, const float h) :
|
||||
|
||||
IGUIFont* font = GUIEngine::getFont();
|
||||
const int textHeight = font->getDimension(L"X").Height;
|
||||
|
||||
|
||||
ButtonWidget* widget2 = new ButtonWidget();
|
||||
widget2->m_type = WTYPE_BUTTON; // FIXME : shouldn't constructor set type?
|
||||
widget2->m_properties[PROP_ID] = "cancel";
|
||||
@ -178,10 +178,12 @@ EnterPlayerNameDialog::EnterPlayerNameDialog(const float w, const float h) :
|
||||
textCtrl->add();
|
||||
GUIEngine::getGUIEnv()->setFocus( textCtrl->m_element );
|
||||
|
||||
// TODO : add Ok button
|
||||
|
||||
cancelButton = new ButtonWidget();
|
||||
cancelButton->m_type = WTYPE_BUTTON; // FIXME : shouldn't constructor set type?
|
||||
cancelButton->m_properties[PROP_ID] = "cancel";
|
||||
cancelButton->m_properties[PROP_TEXT] = _("Press ESC to cancel");
|
||||
cancelButton->m_properties[PROP_TEXT] = _("Cancel");
|
||||
cancelButton->x = 15;
|
||||
cancelButton->y = m_area.getHeight() - textHeight - 12;
|
||||
cancelButton->w = m_area.getWidth() - 30;
|
||||
@ -376,6 +378,8 @@ PlayerInfoDialog::PlayerInfoDialog(Player* player, const float w, const float h)
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
}
|
||||
|
||||
// TODO : add cancel button
|
||||
}
|
||||
void PlayerInfoDialog::onEnterPressedInternal()
|
||||
{
|
||||
|
@ -537,6 +537,19 @@ void Screen::processAction(const int action, const unsigned int value, Input::In
|
||||
el->getTabGroup()->getNextElement(el->getTabOrder(), true, false, first, closest))
|
||||
{
|
||||
GUIEngine::getGUIEnv()->setFocus(closest);
|
||||
|
||||
// when focusing a list by going up, select the last item of the list
|
||||
Widget* w = getWidget( closest->getID() );
|
||||
if(w != NULL && w->m_type == WTYPE_LIST)
|
||||
{
|
||||
IGUIListBox* list = dynamic_cast<IGUIListBox*>(w->m_element);
|
||||
assert(list != NULL);
|
||||
|
||||
list->setSelected( list->getItemCount()-1 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user