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

Method _setAlign

MyGUIEngine/src/MyGUI_TileRect.cpp:53–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 void TileRect::_setAlign(const IntSize& _oldsize)
54 {
55 // первоначальное выравнивание
56 if (mAlign.isHStretch())
57 {
58 // растягиваем
59 mCoord.width = mCoord.width + (mCroppedParent->getWidth() - _oldsize.width);
60 mIsMargin = true; // при изменении размеров все пересчитывать
61 }
62 else if (mAlign.isRight())
63 {
64 // двигаем по правому краю
65 mCoord.left = mCoord.left + (mCroppedParent->getWidth() - _oldsize.width);
66 }
67 else if (mAlign.isHCenter())
68 {
69 // выравнивание по горизонтали без растяжения
70 mCoord.left = (mCroppedParent->getWidth() - mCoord.width) / 2;
71 }
72
73 if (mAlign.isVStretch())
74 {
75 // растягиваем
76 mCoord.height = mCoord.height + (mCroppedParent->getHeight() - _oldsize.height);
77 mIsMargin = true; // при изменении размеров все пересчитывать
78 }
79 else if (mAlign.isBottom())
80 {
81 // двигаем по нижнему краю
82 mCoord.top = mCoord.top + (mCroppedParent->getHeight() - _oldsize.height);
83 }
84 else if (mAlign.isVCenter())
85 {
86 // выравнивание по вертикали без растяжения
87 mCoord.top = (mCroppedParent->getHeight() - mCoord.height) / 2;
88 }
89
90 mCurrentCoord = mCoord;
91 if (!mTileH)
92 mTileSize.width = mCoord.width;
93 if (!mTileV)
94 mTileSize.height = mCoord.height;
95 _updateView();
96 }
97
98 void TileRect::_updateView()
99 {

Callers

nothing calls this directly

Calls 3

_updateViewFunction · 0.85
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected