[_GSoC Uni_] Added a method to ribbon_widget to look for a child on id and get a widget returned.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13030 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-06-29 22:50:20 +00:00
parent dea6a6d721
commit 0850ccf617
2 changed files with 12 additions and 18 deletions

View File

@ -449,24 +449,6 @@ void RibbonWidget::removeChildNamed(const char* name)
}
}
}
/*
// ----------------------------------------------------------------------------
void RibbonWidget::hideChildNamed(const char* name)
{
// This method should only be called BEFORE a widget is added
assert(m_element == NULL);
Widget* child;
for_in (child, m_children)
{
if (child->m_properties[PROP_ID] == name)
{
m_children.erase(child);
return;
}
}
}*/
// ----------------------------------------------------------------------------
@ -765,3 +747,12 @@ int RibbonWidget::findItemNamed(const char* internalName)
}
return -1;
} // findItemNamed
// ----------------------------------------------------------------------------
Widget* RibbonWidget::findWidgetNamed(const char* internalName)
{
int id = findItemNamed(internalName);
if (id >= 0)
return m_children.get(id);
return NULL;
} // findItemNamed

View File

@ -155,6 +155,9 @@ namespace GUIEngine
/** Returns the ID of the item, or -1 if not found */
int findItemNamed(const char* internalName);
/** Returns the the widget, or NULL if not found */
GUIEngine::Widget * findWidgetNamed(const char* interalName);
/** \brief Dynamically (at runtime) add a text item to this ribbon
* \pre This must be called before RibbonWidget::add, while the
* widget is not yet displayed