made player list navigatable without mouse
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3415 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
0ee65fc802
commit
b262fd7f96
@ -407,6 +407,19 @@ bool Screen::OnEvent(const SEvent& event)
|
||||
{
|
||||
IGUIElement *el, *first=NULL, *closest=NULL;
|
||||
el = GUIEngine::getGUIEnv()->getFocus();
|
||||
|
||||
Widget* w = getWidget( el->getID() );
|
||||
|
||||
// list widgets are a bit special, because up/down keys are also used
|
||||
// to navigate between various list items, not only to navigate between
|
||||
// components
|
||||
if(w->m_type == WTYPE_LIST)
|
||||
{
|
||||
IGUIListBox* list = dynamic_cast<IGUIListBox*>(w->m_element);
|
||||
assert(list != NULL);
|
||||
if(list->getSelected()>0) break;
|
||||
}
|
||||
|
||||
if(el != NULL && el->getTabGroup() != NULL &&
|
||||
el->getTabGroup()->getNextElement(el->getTabOrder(), true, false, first, closest))
|
||||
{
|
||||
@ -426,6 +439,18 @@ bool Screen::OnEvent(const SEvent& event)
|
||||
IGUIElement *el, *first = NULL, *closest = NULL;
|
||||
el = GUIEngine::getGUIEnv()->getFocus();
|
||||
|
||||
Widget* w = getWidget( el->getID() );
|
||||
|
||||
// list widgets are a bit special, because up/down keys are also used
|
||||
// to navigate between various list items, not only to navigate between
|
||||
// components
|
||||
if(w->m_type == WTYPE_LIST)
|
||||
{
|
||||
IGUIListBox* list = dynamic_cast<IGUIListBox*>(w->m_element);
|
||||
assert(list != NULL);
|
||||
if(list->getSelected() < (int)list->getItemCount()-1) break;
|
||||
}
|
||||
|
||||
if(el != NULL && el->getTabGroup() != NULL &&
|
||||
el->getTabGroup()->getNextElement(el->getTabOrder(), false, false, first, closest))
|
||||
{
|
||||
|
@ -1167,11 +1167,16 @@ void ListWidget::add()
|
||||
{
|
||||
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
|
||||
|
||||
IGUIListBox* list = GUIEngine::getGUIEnv()->addListBox (widget_size);
|
||||
IGUIListBox* list = GUIEngine::getGUIEnv()->addListBox (widget_size, NULL, ++id_counter);
|
||||
|
||||
id = list->getID();
|
||||
list->addItem( L"Hiker" );
|
||||
list->addItem( L"Conso" );
|
||||
list->addItem( L"Auria" );
|
||||
list->addItem( L"MiniBjorn" );
|
||||
list->addItem( L"Arthur" );
|
||||
|
||||
m_element = list;
|
||||
|
||||
//list->setSelected(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user