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

Method calculateListPosition

MyGUIEngine/src/MyGUI_ComboBox.cpp:382–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380 }
381
382 IntCoord ComboBox::calculateListPosition()
383 {
384 int length = 0;
385 if (mFlowDirection.isVertical())
386 length = mList->getOptimalHeight();
387 else
388 length = mMaxListLength;
389
390 if (mMaxListLength > 0 && length > mMaxListLength)
391 length = mMaxListLength;
392
393 IntCoord coord = getAbsoluteCoord();
394 // layer size
395 IntSize sizeView = mList->getParentSize();
396
397 if (mFlowDirection == FlowDirection::TopToBottom)
398 {
399 if ((coord.bottom() + length) <= sizeView.height)
400 coord.top += coord.height;
401 else
402 coord.top -= length;
403 coord.height = length;
404 }
405 else if (mFlowDirection == FlowDirection::BottomToTop)
406 {
407 if ((coord.top - length) >= 0)
408 coord.top -= length;
409 else
410 coord.top += coord.height;
411 coord.height = length;
412 }
413 else if (mFlowDirection == FlowDirection::LeftToRight)
414 {
415 if ((coord.right() + length) <= sizeView.width)
416 coord.left += coord.width;
417 else
418 coord.left -= length;
419 coord.width = length;
420 }
421 else if (mFlowDirection == FlowDirection::RightToLeft)
422 {
423 if ((coord.left - length) >= 0)
424 coord.left -= length;
425 else
426 coord.left += coord.width;
427 coord.width = length;
428 }
429
430 return coord;
431 }
432
433 void ComboBox::setPropertyOverride(std::string_view _key, std::string_view _value)
434 {

Callers

nothing calls this directly

Calls 5

getAbsoluteCoordFunction · 0.85
getOptimalHeightMethod · 0.80
getParentSizeMethod · 0.80
bottomMethod · 0.80
rightMethod · 0.80

Tested by

no test coverage detected