[_GSoC Uni_] Added extra flag to Widget, to allow hiding of widgets before they are added. Note that only RibbonWidget supports this at the moment and that other widgets should be adapted before making use of this feature (not so hard though). What it basically does is, not taking into account hidden widgets for lay-out calculation and navigation and not making an IGUIElement for the widget as it is not needed.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13039 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
6d37125348
commit
d183cd3451
@ -98,6 +98,7 @@ Widget::Widget(WidgetType type, bool reserve_id)
|
||||
|
||||
m_reserved_id = -1;
|
||||
m_deactivated = false;
|
||||
m_is_visible = true;
|
||||
m_badges = 0;
|
||||
|
||||
// set a default value, derivates can override this as they wish
|
||||
@ -319,7 +320,9 @@ void Widget::setParent(IGUIElement* parent)
|
||||
|
||||
bool Widget::isVisible() const
|
||||
{
|
||||
return m_element && m_element->isVisible();
|
||||
if (m_element != NULL)
|
||||
assert(m_element->isVisible() == m_is_visible);
|
||||
return m_is_visible;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -330,6 +333,7 @@ void Widget::setVisible(bool visible)
|
||||
{
|
||||
m_element->setVisible(visible);
|
||||
}
|
||||
m_is_visible = visible;
|
||||
m_deactivated = !visible;
|
||||
|
||||
const int childrenCount = m_children.size();
|
||||
|
@ -233,9 +233,12 @@ namespace GUIEngine
|
||||
/** A bitmask of which badges to show, if any; choices are *_BADGE, defined above */
|
||||
int m_badges;
|
||||
|
||||
/** A simple flag that can be raised to hide this widget */
|
||||
/** A simple flag that can be raised to deactivate this widget */
|
||||
bool m_deactivated;
|
||||
|
||||
/** A flag to indicate whether this widget should be visible or not. */
|
||||
bool m_is_visible;
|
||||
|
||||
/** Set to false if widget is something that should not receive focus */
|
||||
bool m_focusable;
|
||||
|
||||
|
@ -94,7 +94,7 @@ void RibbonWidget::add()
|
||||
m_active_children.clearWithoutDeleting(); // Is just a copy of m_children without the deactivated children. m_children takes care of memory.
|
||||
for (int i=0; i<m_children.size(); i++)
|
||||
{
|
||||
if (!m_children[i].m_deactivated)
|
||||
if (m_children[i].isVisible())
|
||||
{
|
||||
m_active_children.push_back(m_children.get(i));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user