mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 00:24:40 +00:00
Added function to guiMenuBar to find a menu by name.
This commit is contained in:
parent
727592d63a
commit
cfe977584d
2 changed files with 23 additions and 1 deletions
|
|
@ -1472,6 +1472,17 @@ PopupMenu* GuiMenuBar::getMenu(U32 index)
|
||||||
return mMenuList[index].popupMenu;
|
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
|
// 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")
|
DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType<SimObject*>(), -1), "(object, pos) insert object at position")
|
||||||
{
|
{
|
||||||
object->insert(pObject, pos);
|
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(); }
|
U32 getMenuListCount() { return mMenuList.size(); }
|
||||||
|
|
||||||
PopupMenu* getMenu(U32 index);
|
PopupMenu* getMenu(U32 index);
|
||||||
|
PopupMenu* findMenu(StringTableEntry barTitle);
|
||||||
|
|
||||||
DECLARE_CONOBJECT(GuiMenuBar);
|
DECLARE_CONOBJECT(GuiMenuBar);
|
||||||
DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu ));
|
DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu ));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue