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

Method showPopup

Engine/source/gui/editor/popupMenu.cpp:297–458  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

295
296//////////////////////////////////////////////////////////////////////////
297void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */)
298{
299 if (owner == NULL)
300 return;
301
302 GuiPopupMenuBackgroundCtrl* backgroundCtrl;
303 Sim::findObject("PopUpMenuControl", backgroundCtrl);
304
305 GuiControlProfile* profile;
306 Sim::findObject("ToolsGuiMenuBarProfile", profile);
307
308 if (!profile)
309 return;
310
311 if (mTextList == nullptr)
312 {
313 mTextList = new GuiPopupMenuTextListCtrl();
314 mTextList->registerObject();
315 mTextList->setControlProfile(profile);
316 mTextList->mRowHeightPadding = 5;
317
318 mTextList->mPopup = this;
319 mTextList->mMenuBar = getMenuBarCtrl();
320 }
321
322 if (!backgroundCtrl)
323 {
324 backgroundCtrl = new GuiPopupMenuBackgroundCtrl();
325
326 backgroundCtrl->registerObject("PopUpMenuControl");
327 }
328
329 if (!backgroundCtrl || !mTextList)
330 return;
331
332 if (!mIsSubmenu)
333 {
334 //if we're a 'parent' menu, then tell the background to clear out all existing other popups
335
336 backgroundCtrl->clearPopups();
337 }
338
339 //find out if we're doing a first-time add
340 S32 popupIndex = backgroundCtrl->findPopupMenu(this);
341
342 if (popupIndex == -1)
343 {
344 backgroundCtrl->addObject(mTextList);
345 backgroundCtrl->mPopups.push_back(this);
346 }
347
348 mTextList->mBackground = backgroundCtrl;
349
350 owner->pushDialogControl(backgroundCtrl, 10);
351
352 //Set the background control's menubar, if any, and if it's not already set
353 if(backgroundCtrl->mMenuBarCtrl == nullptr)
354 backgroundCtrl->mMenuBarCtrl = getMenuBarCtrl();

Callers 3

onActionMethod · 0.80
popupMenu.cppFile · 0.80
onCellHighlightedMethod · 0.80

Calls 15

dSprintfFunction · 0.85
setControlProfileMethod · 0.80
clearPopupsMethod · 0.80
findPopupMenuMethod · 0.80
pushDialogControlMethod · 0.80
setExtentMethod · 0.80
getExtentMethod · 0.80
getStrWidthMethod · 0.80
setEntryActiveMethod · 0.80
getCursorPosLocalMethod · 0.80
findObjectFunction · 0.50
Point2IClass · 0.50

Tested by

no test coverage detected