MCPcopy Create free account
hub / github.com/MyGUI/mygui / update

Method update

MyGUIEngine/src/MyGUI_MenuControl.cpp:148–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146 }
147
148 void MenuControl::update()
149 {
150 IntSize size;
151
152 if (mVerticalAlignment)
153 {
154 for (auto& iter : mItemsInfo)
155 {
156 IntSize contentSize = iter.item->_getContentSize();
157 iter.item->setCoord(0, size.height, _getClientWidget()->getWidth(), contentSize.height);
158 size.height += contentSize.height + mDistanceButton;
159
160 if (contentSize.width > size.width)
161 size.width = contentSize.width;
162 }
163 if (!mItemsInfo.empty())
164 size.height -= mDistanceButton;
165 }
166 else
167 {
168 int maxHeight = 0;
169 for (const auto& iter : mItemsInfo)
170 {
171 IntSize contentSize = iter.item->_getContentSize();
172 if (maxHeight < contentSize.height)
173 maxHeight = contentSize.height;
174 }
175
176 for (auto& iter : mItemsInfo)
177 {
178 IntSize contentSize = iter.item->_getContentSize();
179 iter.item->setCoord(size.width, 0, contentSize.width, maxHeight);
180 size.width += contentSize.width + mDistanceButton;
181 }
182
183 if (!mItemsInfo.empty())
184 size.width -= mDistanceButton;
185 }
186
187 if (mResizeToContent)
188 setSize(size + mCoord.size() - _getClientWidget()->getSize());
189 }
190
191 void MenuControl::setItemDataAt(size_t _index, Any _data)
192 {

Callers

nothing calls this directly

Calls 7

setSizeFunction · 0.85
_getContentSizeMethod · 0.80
setCoordMethod · 0.45
getWidthMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected