33 TGVerticalLayout(iMain)
71 UInt_t extra_space = 0;
76 Int_t bw = fMain->GetBorderWidth();
77 TGDimension
size(0,0), csize(0,0);
78 TGDimension msize = fMain->GetSize();
79 UInt_t pad_left, pad_top, pad_right, pad_bottom;
80 Int_t size_expand=0, esize_expand=0, rem_expand=0, tmp_expand = 0;
86 bottom = msize.fHeight - (top = bw);
87 remain = msize.fHeight - (bw << 1);
89 std::vector<int> expandSizes;
90 expandSizes.reserve(fList->GetSize());
92 while ((ptr = (TGFrameElement *)
next())) {
94 layout = ptr->fLayout;
95 size = ptr->fFrame->GetDefaultSize();
96 size.fHeight += layout->GetPadTop() + layout->GetPadBottom();
97 hints = layout->GetLayoutHints();
98 if ((hints & kLHintsExpandY) || (hints & kLHintsCenterY)) {
101 if (hints & kLHintsExpandY) {
103 expandSizes.push_back(
size.fHeight);
107 remain -=
size.fHeight;
115 size_expand = remain/nb_expand;
117 if (size_expand < exp_max)
118 esize_expand = (remain -
exp)/nb_expand;
119 rem_expand = remain % nb_expand;
122 std::sort(expandSizes.begin(), expandSizes.end(),std::less<int>());
124 for(std::vector<int>::iterator it = expandSizes.begin(), itEnd = expandSizes.end();
127 if(*it > size_expand) {
132 if(remain<0) {remain=0;}
134 size_expand = remain/nb_expand;
136 size_expand=msize.fHeight - (bw << 1);
141 while ((ptr = (TGFrameElement *)
next())) {
143 hints = (layout = ptr->fLayout)->GetLayoutHints();
144 csize = ptr->fFrame->GetDefaultSize();
145 pad_left = layout->GetPadLeft();
146 pad_top = layout->GetPadTop();
147 pad_right = layout->GetPadRight();
148 pad_bottom = layout->GetPadBottom();
150 if (hints & kLHintsRight) {
151 x = msize.fWidth - bw - csize.fWidth - pad_right;
152 }
else if (hints & kLHintsCenterX) {
153 x = (msize.fWidth - (bw << 1) - csize.fWidth) >> 1;
158 if (hints & kLHintsExpandX) {
159 size.fWidth = msize.fWidth - (bw << 1) - pad_left - pad_right;
162 size.fWidth = csize.fWidth;
165 if (hints & kLHintsExpandY) {
166 if (size_expand >= exp_max)
167 if(static_cast<int>(csize.fHeight) > size_expand) {
168 size.fHeight = size_expand - pad_top - pad_bottom;
170 size.fHeight = csize.fHeight;
173 size.fHeight = csize.fHeight + esize_expand;
175 tmp_expand += rem_expand;
176 if (tmp_expand >= nb_expand) {
178 tmp_expand -= nb_expand;
181 size.fHeight = csize.fHeight;
182 if (hints & kLHintsCenterY) {
183 if (size_expand >= exp_max) {
184 extra_space = (size_expand - pad_top - pad_bottom -
size.fHeight) >> 1;
186 extra_space = esize_expand >> 1;
192 if (hints & kLHintsBottom) {
193 y = bottom -
size.fHeight - pad_bottom;
194 bottom -=
size.fHeight + pad_top + pad_bottom;
197 top +=
size.fHeight + pad_top + pad_bottom;
200 if (hints & kLHintsCenterY)
203 if (
size.fWidth > 32768)
205 if (
size.fHeight > 32768)
207 ptr->fFrame->MoveResize(x,
y,
size.fWidth,
size.fHeight);
209 fModified = fModified || (ptr->fFrame->GetX() !=
x) ||
210 (ptr->fFrame->GetY() !=
y) ||
211 (ptr->fFrame->GetWidth() !=
size.fWidth) ||
212 (ptr->fFrame->GetHeight() !=
size.fHeight);
224 TGDimension
size(0,0), msize = fMain->GetSize(), csize;
225 UInt_t
options = fMain->GetOptions();
227 if ((options & kFixedWidth) && (options & kFixedHeight))
231 while ((ptr = (TGFrameElement *)
next())) {
233 csize = ptr->fFrame->GetDefaultSize();
235 ptr->fLayout->GetPadRight());
236 size.fHeight += csize.fHeight + ptr->fLayout->GetPadTop() +
237 ptr->fLayout->GetPadBottom();
241 size.fWidth += fMain->GetBorderWidth() << 1;
242 size.fHeight += fMain->GetBorderWidth() << 1;
244 if (options & kFixedWidth)
size.fWidth = msize.fWidth;
245 if (options & kFixedHeight)
size.fHeight = msize.fHeight;
TGDimension GetDefaultSize() const override
static const std::string kIsVisible("isVisible")
~FWCompactVerticalLayout() override
FWCompactVerticalLayout(TGCompositeFrame *iMain)