Made invisible widgets non-triggerable
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5767 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
580f36fd95
commit
57b6375a85
@ -181,6 +181,7 @@ void EventHandler::processGUIAction(const PlayerAction action, const unsigned in
|
||||
{
|
||||
Widget* w = GUIEngine::getFocusForPlayer(playerID);
|
||||
if (w == NULL) break;
|
||||
|
||||
// FIXME : consider returned value?
|
||||
onWidgetActivated( w, playerID );
|
||||
}
|
||||
@ -451,14 +452,19 @@ void EventHandler::sendEventToUser(GUIEngine::Widget* widget, std::string& name,
|
||||
|
||||
EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int playerID)
|
||||
{
|
||||
if (w->m_deactivated) return EVENT_BLOCK;
|
||||
|
||||
if (ModalDialog::isADialogActive())
|
||||
{
|
||||
if (ModalDialog::getCurrent()->processEvent(w->m_properties[PROP_ID]) == EVENT_BLOCK) return EVENT_BLOCK;
|
||||
if (ModalDialog::getCurrent()->processEvent(w->m_properties[PROP_ID]) == EVENT_BLOCK)
|
||||
{
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
if (w->m_event_handler == NULL) return EVENT_LET;
|
||||
}
|
||||
|
||||
//std::cout << "**** widget activated : " << w->m_properties[PROP_ID].c_str() << " ****" << std::endl;
|
||||
|
||||
|
||||
Widget* parent = w->m_event_handler;
|
||||
if (w->m_event_handler != NULL)
|
||||
{
|
||||
@ -472,6 +478,8 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
|
||||
parent = parent->m_event_handler;
|
||||
}
|
||||
|
||||
if (parent->m_deactivated) return EVENT_BLOCK;
|
||||
|
||||
/* notify the found event event handler, and also notify the main callback if the
|
||||
parent event handler says so */
|
||||
if (parent->transmitEvent(w, w->m_properties[PROP_ID], playerID) == EVENT_LET)
|
||||
@ -488,7 +496,11 @@ EventPropagation EventHandler::onWidgetActivated(GUIEngine::Widget* w, const int
|
||||
sendEventToUser(parent, parent->m_properties[PROP_ID], playerID);
|
||||
}
|
||||
}
|
||||
else sendEventToUser(w, w->m_properties[PROP_ID], playerID);
|
||||
else
|
||||
{
|
||||
printf("sendEventToUser : '%s' is disabled = '%i'\n", w->m_properties[PROP_ID].c_str(), w->m_deactivated);
|
||||
sendEventToUser(w, w->m_properties[PROP_ID], playerID);
|
||||
}
|
||||
|
||||
return EVENT_BLOCK;
|
||||
}
|
||||
|
@ -305,6 +305,7 @@ void Widget::setVisible(bool visible)
|
||||
{
|
||||
m_element->setVisible(visible);
|
||||
}
|
||||
m_deactivated = !visible;
|
||||
|
||||
const int childrenCount = m_children.size();
|
||||
for (int n=0; n<childrenCount; n++)
|
||||
|
@ -411,7 +411,10 @@ namespace GUIEngine
|
||||
int getID() const { return m_id; }
|
||||
|
||||
/**
|
||||
* \brief Sets the widget (and its children, if any) visible or not
|
||||
* \brief Sets the widget (and its children, if any) visible or not.
|
||||
* Note that setting a widget invisible implicitely calls setDeactivated(), and setting
|
||||
* it visible implicitely calls setActivated(). If you mix visiblity and (de)activated calls,
|
||||
* undefined behavior may ensue (like invisible but clickable buttons).
|
||||
*/
|
||||
void setVisible(bool visible);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user