mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Added function to guiMenuBar to find a menu by name.
This commit is contained in:
parent
727592d63a
commit
cfe977584d
|
|
@ -1472,6 +1472,17 @@ PopupMenu* GuiMenuBar::getMenu(U32 index)
|
|||
return mMenuList[index].popupMenu;
|
||||
}
|
||||
|
||||
PopupMenu* GuiMenuBar::findMenu(StringTableEntry barTitle)
|
||||
{
|
||||
for (U32 i = 0; i < mMenuList.size(); i++)
|
||||
{
|
||||
if (mMenuList[i].text == barTitle)
|
||||
return mMenuList[i].popupMenu;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console Methods
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -1506,4 +1517,14 @@ DefineConsoleMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)")
|
|||
DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType<SimObject*>(), -1), "(object, pos) insert object at position")
|
||||
{
|
||||
object->insert(pObject, pos);
|
||||
}
|
||||
}
|
||||
|
||||
DefineConsoleMethod(GuiMenuBar, findMenu, S32, (StringTableEntry barTitle), (""), "(barTitle)")
|
||||
{
|
||||
PopupMenu* menu = object->findMenu(barTitle);
|
||||
|
||||
if (menu)
|
||||
return menu->getId();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ public:
|
|||
U32 getMenuListCount() { return mMenuList.size(); }
|
||||
|
||||
PopupMenu* getMenu(U32 index);
|
||||
PopupMenu* findMenu(StringTableEntry barTitle);
|
||||
|
||||
DECLARE_CONOBJECT(GuiMenuBar);
|
||||
DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu ));
|
||||
|
|
|
|||
Loading…
Reference in a new issue