65 UInt_t extra_space = 0;
70 Int_t bw = fMain->GetBorderWidth();
71 TGDimension
size(0, 0), csize(0, 0);
72 TGDimension msize = fMain->GetSize();
73 UInt_t pad_left, pad_top, pad_right, pad_bottom;
74 Int_t size_expand = 0, esize_expand = 0, rem_expand = 0, tmp_expand = 0;
81 bottom = msize.fHeight - (top = bw);
82 remain = msize.fHeight - (bw << 1);
84 std::vector<int> expandSizes;
85 expandSizes.reserve(
fList->GetSize());
87 while ((ptr = (TGFrameElement *)
next())) {
90 size = ptr->fFrame->GetDefaultSize();
92 hints =
layout->GetLayoutHints();
93 if ((hints & kLHintsExpandY) || (hints & kLHintsCenterY)) {
96 if (hints & kLHintsExpandY) {
98 expandSizes.push_back(
size.fHeight);
102 remain -=
size.fHeight;
110 size_expand = remain / nb_expand;
112 if (size_expand < exp_max)
113 esize_expand = (remain -
exp) / nb_expand;
114 rem_expand = remain % nb_expand;
117 std::sort(expandSizes.begin(), expandSizes.end(), std::less<int>());
119 for (std::vector<int>::iterator it = expandSizes.begin(), itEnd = expandSizes.end(); it != itEnd; ++it) {
120 if (*it > size_expand) {
129 size_expand = remain / nb_expand;
131 size_expand = msize.fHeight - (bw << 1);
136 while ((ptr = (TGFrameElement *)
next())) {
138 hints = (
layout = ptr->fLayout)->GetLayoutHints();
139 csize = ptr->fFrame->GetDefaultSize();
140 pad_left =
layout->GetPadLeft();
141 pad_top =
layout->GetPadTop();
142 pad_right =
layout->GetPadRight();
143 pad_bottom =
layout->GetPadBottom();
145 if (hints & kLHintsRight) {
146 x = msize.fWidth - bw - csize.fWidth - pad_right;
147 }
else if (hints & kLHintsCenterX) {
148 x = (msize.fWidth - (bw << 1) - csize.fWidth) >> 1;
153 if (hints & kLHintsExpandX) {
154 size.fWidth = msize.fWidth - (bw << 1) - pad_left - pad_right;
157 size.fWidth = csize.fWidth;
160 if (hints & kLHintsExpandY) {
161 if (size_expand >= exp_max)
162 if (static_cast<int>(csize.fHeight) > size_expand) {
163 size.fHeight = size_expand - pad_top - pad_bottom;
165 size.fHeight = csize.fHeight;
168 size.fHeight = csize.fHeight + esize_expand;
170 tmp_expand += rem_expand;
171 if (tmp_expand >= nb_expand) {
173 tmp_expand -= nb_expand;
176 size.fHeight = csize.fHeight;
177 if (hints & kLHintsCenterY) {
178 if (size_expand >= exp_max) {
179 extra_space = (size_expand - pad_top - pad_bottom -
size.fHeight) >> 1;
181 extra_space = esize_expand >> 1;
187 if (hints & kLHintsBottom) {
188 y = bottom -
size.fHeight - pad_bottom;
189 bottom -=
size.fHeight + pad_top + pad_bottom;
192 top +=
size.fHeight + pad_top + pad_bottom;
195 if (hints & kLHintsCenterY)
198 if (
size.fWidth > 32768)
200 if (
size.fHeight > 32768)
202 ptr->fFrame->MoveResize(
x,
y,
size.fWidth,
size.fHeight);
204 fModified = fModified || (ptr->fFrame->GetX() !=
x) || (ptr->fFrame->GetY() !=
y) ||
205 (ptr->fFrame->GetWidth() !=
size.fWidth) || (ptr->fFrame->GetHeight() !=
size.fHeight);