MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / onAction

Method onAction

Engine/source/gui/editor/guiMenuBar.cpp:1683–1794  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1681
1682//------------------------------------------------------------------------------
1683void GuiMenuBar::onAction()
1684{
1685 if(!mouseDownMenu)
1686 return;
1687
1688 // first, call the script callback for menu selection:
1689 onMenuSelect_callback(mouseDownMenu->id, mouseDownMenu->text);
1690
1691 MenuItem *visWalk = mouseDownMenu->firstMenuItem;
1692 while(visWalk)
1693 {
1694 if(visWalk->visible)
1695 break;
1696 visWalk = visWalk->nextMenuItem;
1697 }
1698 if(!visWalk)
1699 {
1700 mouseDownMenu = NULL;
1701 return;
1702 }
1703
1704 mTextList = new GuiMenuTextListCtrl(this);
1705 mTextList->setControlProfile(mProfile);
1706
1707 mBackground = new GuiMenuBackgroundCtrl(this, mTextList);
1708
1709 GuiCanvas *root = getRoot();
1710 Point2I windowExt = root->getExtent();
1711
1712 mBackground->resize( Point2I(0,0), root->getExtent());
1713 S32 textWidth = 0, width = 0;
1714 S32 acceleratorWidth = 0;
1715
1716 GFont *font = mProfile->mFont;
1717
1718 for(MenuItem *walk = mouseDownMenu->firstMenuItem; walk; walk = walk->nextMenuItem)
1719 {
1720 if(!walk->visible)
1721 continue;
1722
1723 S32 iTextWidth = font->getStrWidth(walk->text);
1724 S32 iAcceleratorWidth = walk->accelerator ? font->getStrWidth(walk->accelerator) : 0;
1725
1726 if(iTextWidth > textWidth)
1727 textWidth = iTextWidth;
1728 if(iAcceleratorWidth > acceleratorWidth)
1729 acceleratorWidth = iAcceleratorWidth;
1730 }
1731 width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4;
1732
1733 mTextList->setCellSize(Point2I(width, font->getHeight()+2));
1734 mTextList->clearColumnOffsets();
1735 mTextList->addColumnOffset(-1); // add an empty column in for the bitmap index.
1736 mTextList->addColumnOffset(maxBitmapSize.x + 1);
1737 mTextList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4);
1738
1739 U32 entryCount = 0;
1740

Callers

nothing calls this directly

Calls 15

dSprintfFunction · 0.85
setControlProfileMethod · 0.80
getExtentMethod · 0.80
getStrWidthMethod · 0.80
setEntryActiveMethod · 0.80
pushDialogControlMethod · 0.80
Point2IClass · 0.50
resizeMethod · 0.45
getHeightMethod · 0.45
sizeMethod · 0.45
addEntryMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected