| 333 | } |
| 334 | #ifdef TORQUE_TOOLS |
| 335 | void 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 |
| 387 | void GuiCanvas::setWindowTitle(const char *newTitle) |
| 388 | { |
no test coverage detected