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

Method _setAlign

MyGUIEngine/src/MyGUI_PolygonalSkin.cpp:116–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114 }
115
116 void PolygonalSkin::_setAlign(const IntSize& _oldsize)
117 {
118 // первоначальное выравнивание
119 if (mAlign.isHStretch())
120 {
121 // растягиваем
122 mCoord.width = mCoord.width + (mCroppedParent->getWidth() - _oldsize.width);
123 mIsMargin = true; // при изменении размеров все пересчитывать
124 }
125 else if (mAlign.isRight())
126 {
127 // двигаем по правому краю
128 mCoord.left = mCoord.left + (mCroppedParent->getWidth() - _oldsize.width);
129 }
130 else if (mAlign.isHCenter())
131 {
132 // выравнивание по горизонтали без растяжения
133 mCoord.left = (mCroppedParent->getWidth() - mCoord.width) / 2;
134 }
135
136 if (mAlign.isVStretch())
137 {
138 // растягиваем
139 mCoord.height = mCoord.height + (mCroppedParent->getHeight() - _oldsize.height);
140 mIsMargin = true; // при изменении размеров все пересчитывать
141 }
142 else if (mAlign.isBottom())
143 {
144 // двигаем по нижнему краю
145 mCoord.top = mCoord.top + (mCroppedParent->getHeight() - _oldsize.height);
146 }
147 else if (mAlign.isVCenter())
148 {
149 // выравнивание по вертикали без растяжения
150 mCoord.top = (mCroppedParent->getHeight() - mCoord.height) / 2;
151 }
152
153 mCurrentCoord = mCoord;
154 _updateView();
155 }
156
157 void PolygonalSkin::_updateView()
158 {

Callers

nothing calls this directly

Calls 3

_updateViewFunction · 0.85
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected