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

Method updateBarNew

MyGUIEngine/src/MyGUI_TabControl.cpp:930–1069  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

928 }
929
930 void TabControl::updateBarNew()
931 {
932 if (mHeaderPlace == nullptr)
933 return;
934
935 // подстраховка
936 if (mHeaderPlace->getWidth() < 1)
937 return;
938
939 int widthControls = 0;
940 if (mControls != nullptr)
941 widthControls = mControls->getWidth();
942
943 if ((mHeaderPlace->getWidth() < mWidthBar) && (1 < mItemsInfo.size()) &&
944 (mHeaderPlace->getWidth() >= widthControls))
945 {
946 if (!mButtonShow)
947 {
948 mButtonShow = true;
949
950 if (nullptr != mControls)
951 mControls->setVisible(true);
952 }
953
954 if (mControls != nullptr)
955 mControls->setCoord(
956 mHeaderPlace->getWidth() - mControls->getWidth(),
957 0,
958 mControls->getWidth(),
959 mHeaderPlace->getHeight());
960 }
961 else
962 {
963 if (mButtonShow)
964 {
965 mButtonShow = false;
966
967 if (nullptr != mControls)
968 mControls->setVisible(false);
969 }
970
971 widthControls = 0;
972 }
973
974 // проверяем правильность стартового индекса
975 if (mStartIndex > 0)
976 {
977 // считаем длинну видимых кнопок
978 int width = 0;
979 for (size_t pos = mStartIndex; pos < mItemsInfo.size(); pos++)
980 width += mItemsInfo[pos].width;
981
982 // уменьшаем индекс до тех пор пока кнопка до индекста полностью не влезет в бар
983 while ((mStartIndex > 0) &&
984 ((width + mItemsInfo[mStartIndex - 1].width) <= (mHeaderPlace->getWidth() - widthControls)))
985 {
986 mStartIndex--;
987 width += mItemsInfo[mStartIndex].width;

Callers

nothing calls this directly

Calls 8

setStateSelectedMethod · 0.80
getWidthMethod · 0.45
sizeMethod · 0.45
setVisibleMethod · 0.45
setCoordMethod · 0.45
getHeightMethod · 0.45
setCaptionMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected