Added setVisible method to Widget. Unfortunately irrlicht allows hidden widgets to be navigated to so calling setVisible(false) doesn't disable widgets

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5766 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-08-24 00:15:10 +00:00
parent 0892f3004a
commit 580f36fd95
2 changed files with 24 additions and 3 deletions

View File

@ -297,3 +297,19 @@ void Widget::setParent(IGUIElement* parent)
m_parent = parent;
}
// -----------------------------------------------------------------------------
void Widget::setVisible(bool visible)
{
if (m_element != NULL)
{
m_element->setVisible(visible);
}
const int childrenCount = m_children.size();
for (int n=0; n<childrenCount; n++)
{
m_children[n].setVisible(visible);
}
}

View File

@ -386,7 +386,7 @@ namespace GUIEngine
bool deleteChild(const char* id);
/**
* Override in children to possibly receive updates (you may need to register to
* \brief Override in children to possibly receive updates (you may need to register to
* them first)
*/
virtual void update(float delta) { }
@ -398,18 +398,23 @@ namespace GUIEngine
virtual EventPropagation transmitEvent(Widget* w, std::string& originator, const int playerID) { return EVENT_LET; }
/**
* Create and add the irrLicht widget(s) associated with this object.
* \brief Create and add the irrLicht widget(s) associated with this object.
* Call after Widget was read from XML file and laid out.
*/
virtual void add();
/**
* Called when irrLicht widgets cleared. Forget all references to them, they're no more valid.
* \brief Called when irrLicht widgets cleared. Forget all references to them, they're no more valid.
*/
virtual void elementRemoved();
int getID() const { return m_id; }
/**
* \brief Sets the widget (and its children, if any) visible or not
*/
void setVisible(bool visible);
bool searchInsideMe() const { return m_check_inside_me; }
};