Completely fixed list navigation (including problems that were there before focus code migration, yay\!)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4187 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
129c93f4bf
commit
e4c8dede5c
@ -120,19 +120,28 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
|
||||
break;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
case EGET_ELEMENT_FOCUSED: // is this still used with the new focus implementation?
|
||||
|
||||
case EGET_ELEMENT_FOCUSED:
|
||||
{
|
||||
Widget* w = GUIEngine::getWidget(id);
|
||||
if (w == NULL) break;
|
||||
|
||||
std::cout << "==== irrlicht widget focused : " << w->m_properties[PROP_ID] << std::endl;
|
||||
|
||||
// FIXME: don't hardcode player 0
|
||||
return w->focused(0);
|
||||
// forbid list for gaining "irrLicht focus", then they will process key events and
|
||||
// we don't want that since we do our own custom processing for keys
|
||||
if (w->m_type == WTYPE_LIST)
|
||||
{
|
||||
// cheap way to remove the focus from the element (nope, IGUIEnv::removeFocus doesn't work)
|
||||
// Obviously will not work if the list if the first item of the screen.
|
||||
GUIEngine::getGUIEnv()->setFocus( getCurrentScreen()->getFirstWidget()->getIrrlichtElement() );
|
||||
return EVENT_BLOCK; // confirms to irrLicht that we processed it
|
||||
}
|
||||
|
||||
//return w->focused(0); // is this still used with the new focus implementation?
|
||||
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
case EGET_EDITBOX_ENTER:
|
||||
{
|
||||
// currently, enter pressed in text ctrl events can only happen in dialogs.
|
||||
|
@ -78,4 +78,12 @@ std::string ListWidget::getSelectionName() const
|
||||
assert(list != NULL);
|
||||
return stringc( list->getListItem( list->getSelected() ) ).c_str();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void ListWidget::unfocused(const int playerID)
|
||||
{
|
||||
IGUIListBox* list = getIrrlichtElement<IGUIListBox>();
|
||||
|
||||
// remove selection when leaving list
|
||||
list->setSelected(-1);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ namespace GUIEngine
|
||||
void add();
|
||||
void addItem(const char* item);
|
||||
|
||||
virtual void unfocused(const int playerID);
|
||||
|
||||
int getSelection() const;
|
||||
std::string getSelectionName() const;
|
||||
void clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user