MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setMenuBar

Method setMenuBar

Engine/source/gui/core/guiCanvas.cpp:335–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334#ifdef TORQUE_TOOLS
335void GuiCanvas::setMenuBar(SimObject *obj)
336{
337 GuiControl *oldMenuBar = mMenuBarCtrl;
338 mMenuBarCtrl = dynamic_cast<GuiControl*>(obj);
339
340 //remove old menubar
341 if (oldMenuBar)
342 {
343 Parent::removeObject(oldMenuBar);
344 Parent::removeObject(mMenuBackground); //also remove the modeless wrapper
345 }
346
347 // set new menubar
348 if (mMenuBarCtrl)
349 {
350 //Add a wrapper control so that the menubar sizes correctly
351 GuiControlProfile* profile;
352 Sim::findObject("GuiModelessDialogProfile", profile);
353
354 if (!profile)
355 {
356 Con::errorf("GuiCanvas::setMenuBar: Unable to find the GuiModelessDialogProfile profile!");
357 return;
358 }
359
360 if (mMenuBackground == nullptr)
361 {
362 mMenuBackground = new GuiControl();
363 mMenuBackground->registerObject();
364
365 mMenuBackground->setControlProfile(profile);
366 }
367
368 mMenuBackground->addObject(mMenuBarCtrl);
369
370 Parent::addObject(mMenuBackground);
371 }
372
373 // update window accelerator keys
374 if( oldMenuBar != mMenuBarCtrl )
375 {
376 GuiMenuBar* oldMenu = dynamic_cast<GuiMenuBar*>(oldMenuBar);
377 GuiMenuBar* newMenu = dynamic_cast<GuiMenuBar*>(mMenuBarCtrl);
378
379 if(oldMenu)
380 oldMenu->removeWindowAcceleratorMap(*getPlatformWindow()->getInputGenerator());
381
382 if(newMenu)
383 newMenu->buildWindowAcceleratorMap(*getPlatformWindow()->getInputGenerator());
384 }
385}
386#endif
387void GuiCanvas::setWindowTitle(const char *newTitle)
388{

Callers 2

guiCanvas.cppFile · 0.80
DefineEngineMethodFunction · 0.80

Calls 8

setControlProfileMethod · 0.80
getInputGeneratorMethod · 0.80
findObjectFunction · 0.50
errorfFunction · 0.50
registerObjectMethod · 0.45
addObjectMethod · 0.45

Tested by

no test coverage detected