mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Fixes a crash that comes from toggling the editors on and off, then clicking a menubar item
Fixes the menubar not resizing with the Window Fixes the Editors Menubar item not being repopulated if the editor was closed/reopened Fixes the Physics menubar item not appearing if the editor was closed/reopened Fixes issue where findMenu could fail if the StringTableEntry happened to trip against a different capitalization.
This commit is contained in:
parent
775ca57047
commit
3a93a30ced
8 changed files with 113 additions and 54 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include "gfx/gfxDrawUtil.h"
|
||||
#include "gfx/primBuilder.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/editor/guiPopupMenuCtrl.h"
|
||||
|
||||
// menu bar:
|
||||
// basic idea - fixed height control bar at the top of a window, placed and sized in gui editor
|
||||
|
|
@ -1113,6 +1114,13 @@ GuiMenuBar::GuiMenuBar()
|
|||
|
||||
void GuiMenuBar::onRemove()
|
||||
{
|
||||
GuiPopupMenuBackgroundCtrl* backgroundCtrl;
|
||||
if (Sim::findObject("PopUpMenuControl", backgroundCtrl))
|
||||
{
|
||||
if (backgroundCtrl->mMenuBarCtrl == this)
|
||||
backgroundCtrl->mMenuBarCtrl = nullptr;
|
||||
}
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
||||
|
|
@ -1472,11 +1480,11 @@ PopupMenu* GuiMenuBar::getMenu(U32 index)
|
|||
return mMenuList[index].popupMenu;
|
||||
}
|
||||
|
||||
PopupMenu* GuiMenuBar::findMenu(StringTableEntry barTitle)
|
||||
PopupMenu* GuiMenuBar::findMenu(String barTitle)
|
||||
{
|
||||
for (U32 i = 0; i < mMenuList.size(); i++)
|
||||
{
|
||||
if (mMenuList[i].text == barTitle)
|
||||
if (String::ToLower(mMenuList[i].text) == String::ToLower(barTitle))
|
||||
return mMenuList[i].popupMenu;
|
||||
}
|
||||
|
||||
|
|
@ -1521,8 +1529,7 @@ DefineEngineMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nul
|
|||
|
||||
DefineEngineMethod(GuiMenuBar, findMenu, S32, (const char* barTitle), (""), "(barTitle)")
|
||||
{
|
||||
StringTableEntry barTitleStr = StringTable->insert(barTitle);
|
||||
PopupMenu* menu = object->findMenu(barTitleStr);
|
||||
PopupMenu* menu = object->findMenu(barTitle);
|
||||
|
||||
if (menu)
|
||||
return menu->getId();
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public:
|
|||
U32 getMenuListCount() { return mMenuList.size(); }
|
||||
|
||||
PopupMenu* getMenu(U32 index);
|
||||
PopupMenu* findMenu(StringTableEntry barTitle);
|
||||
PopupMenu* findMenu(String barTitle);
|
||||
|
||||
DECLARE_CONOBJECT(GuiMenuBar);
|
||||
DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu ));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue