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

Method beginToItemAt

MyGUIEngine/src/MyGUI_TabControl.cpp:265–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263 }
264
265 void TabControl::beginToItemAt(size_t _index)
266 {
267 MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "TabControl::beginToItemAt");
268
269 // подстраховка
270 if (_getWidgetBar()->getWidth() < 1)
271 return;
272
273 if (_index == mStartIndex)
274 return;
275 if (_index < mStartIndex)
276 {
277 mStartIndex = _index;
278 updateBar();
279 }
280 else
281 {
282 // длинна бара от старт индекса до нужной включительно
283 int width = 0;
284 for (size_t pos = mStartIndex; pos <= _index; pos++)
285 {
286 width += mItemsInfo[pos].width;
287 }
288
289 // уменьшем старт индекс пока не появиться нужная
290 bool change = false;
291 while ((mStartIndex < _index) && (width > _getWidgetBar()->getWidth()))
292 {
293 width -= mItemsInfo[mStartIndex].width;
294 mStartIndex++;
295 change = true;
296 }
297 if (change)
298 updateBar();
299 }
300 }
301
302 void TabControl::setButtonDefaultWidth(int _width)
303 {

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected