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

Method setContentControl

Engine/source/gui/core/guiCanvas.cpp:1422–1481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1420}
1421
1422void GuiCanvas::setContentControl(GuiControl *gui)
1423{
1424 // Skip out if we got passed NULL (why would that happen?)
1425 if(!gui)
1426 return;
1427
1428 GuiControl *oldContent = getContentControl();
1429 if(oldContent)
1430 Con::executef(oldContent, "onUnsetContent", Con::getIntArg(gui->getId()));
1431
1432 //remove all dialogs on layer 0
1433 U32 index = 0;
1434 while (size() > index)
1435 {
1436 GuiControl *ctrl = static_cast<GuiControl*>((*this)[index]);
1437 if (ctrl == gui || ctrl->mLayer != 0)
1438 index++;
1439
1440 Sim::getGuiGroup()->addObject( ctrl );
1441 }
1442#ifdef TORQUE_TOOLS
1443 // set current menu bar
1444 setMenuBar( mMenuBarCtrl );
1445#endif
1446 // lose the first responder from the old GUI
1447 GuiControl* responder = gui->findFirstTabable();
1448 if(responder)
1449 responder->setFirstResponder();
1450
1451 //add the gui to the front
1452 if(!size() || gui != (*this)[0])
1453 {
1454 // automatically wakes objects in GuiControl::onWake
1455 addObject(gui);
1456 if (size() >= 2)
1457 reOrder(gui, *begin());
1458 }
1459 //refresh the entire gui
1460 resetUpdateRegions();
1461
1462 //rebuild the accelerator map
1463 mAcceleratorMap.clear();
1464
1465 for(iterator i = end(); i != begin() ; )
1466 {
1467 i--;
1468 GuiControl *ctrl = static_cast<GuiControl *>(*i);
1469 ctrl->buildAcceleratorMap();
1470
1471 if (ctrl->getControlProfile()->mModal)
1472 break;
1473 }
1474 refreshMouseControl();
1475
1476 // Force the canvas to update the sizing of the new content control
1477 maintainSizing();
1478
1479 // Do this last so onWake gets called first

Callers 1

guiCanvas.cppFile · 0.45

Calls 12

getContentControlFunction · 0.85
executefFunction · 0.85
getIntArgFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
findFirstTabableMethod · 0.80
buildAcceleratorMapMethod · 0.80
getIdMethod · 0.65
sizeFunction · 0.50
addObjectMethod · 0.45
setFirstResponderMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected