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

Method onRenderCell

Engine/source/gui/editor/guiPopupMenuCtrl.cpp:101–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver)
102{
103 //check if we're a real entry, or if it's a divider
104 if (mPopup->mMenuItems[cell.y].mIsSpacer)
105 {
106 S32 yp = offset.y + mCellSize.y / 2;
107 GFX->getDrawUtil()->drawLine(offset.x + 5, yp, offset.x + mCellSize.x - 5, yp, ColorI(128, 128, 128));
108 }
109 else
110 {
111 if (String::compare(mList[cell.y].text + 3, "-\t")) // Was: String::compare(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag
112 {
113 Parent::onRenderCell(offset, cell, selected, mouseOver);
114 }
115 else
116 {
117 S32 yp = offset.y + mCellSize.y / 2;
118 GFX->getDrawUtil()->drawLine(offset.x, yp, offset.x + mCellSize.x, yp, ColorI(128, 128, 128));
119 GFX->getDrawUtil()->drawLine(offset.x, yp + 1, offset.x + mCellSize.x, yp + 1, ColorI(255, 255, 255));
120 }
121 }
122
123 // now see if there's a bitmap...
124 U8 idx = mList[cell.y].text[0];
125 if (idx != 1)
126 {
127 // there's a bitmap...
128 U32 index = U32(idx - 2) * 4;
129 if (!mList[cell.y].active)
130 index += 3;
131 else if (selected)
132 index++;
133 else if (mouseOver)
134 index += 2;
135
136 if (mProfile->mBitmapArrayRects.size() > index)
137 {
138 RectI rect = mProfile->mBitmapArrayRects[index];
139 Point2I off = maxBitmapSize - rect.extent;
140 off /= 2;
141
142 Point2I bitPos = Point2I(offset.x + mCellSize.y / 2, offset.y + mCellSize.y / 2);
143
144 GFX->getDrawUtil()->clearBitmapModulation();
145 GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmapResource(), bitPos + off, rect);
146 }
147 }
148
149 // Check if this is a submenu
150 idx = mList[cell.y].text[1];
151 if (idx != 1)
152 {
153 // This is a submenu, so draw an arrow
154 S32 left = offset.x + mCellSize.x - 12;
155 S32 right = left + 8;
156 S32 top = mCellSize.y / 2 + offset.y - 4;
157 S32 bottom = top + 8;
158 S32 middle = top + 4;

Callers

nothing calls this directly

Calls 12

compareFunction · 0.85
getDrawUtilMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapSRMethod · 0.80
getBitmapResourceMethod · 0.80
draw2DSquareMethod · 0.80
ColorIClass · 0.50
U32Enum · 0.50
Point2IClass · 0.50
Point2FClass · 0.50
drawLineMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected