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

Method _setAlign

MyGUIEngine/src/MyGUI_EditText.cpp:45–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

_updateViewFunction · 0.85
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected