CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
FWCompactVerticalLayout Class Reference

#include <Fireworks/Core/interface/FWCompactVerticalLayout.h>

Inheritance diagram for FWCompactVerticalLayout:

Public Member Functions

 FWCompactVerticalLayout (TGCompositeFrame *iMain)
 
virtual TGDimension GetDefaultSize () const
 
virtual void Layout ()
 
ClassDef(FWCompactVerticalLayout,
0) private const
FWCompactVerticalLayout
operator= (const FWCompactVerticalLayout &)
 
virtual ~FWCompactVerticalLayout ()
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 29 of file FWCompactVerticalLayout.h.

Constructor & Destructor Documentation

FWCompactVerticalLayout::FWCompactVerticalLayout ( TGCompositeFrame *  iMain)

Definition at line 33 of file FWCompactVerticalLayout.cc.

33  :
34 TGVerticalLayout(iMain)
35 {
36 }
FWCompactVerticalLayout::~FWCompactVerticalLayout ( )
virtual

Definition at line 43 of file FWCompactVerticalLayout.cc.

44 {
45 }

Member Function Documentation

TGDimension FWCompactVerticalLayout::GetDefaultSize ( ) const
virtual

Definition at line 220 of file FWCompactVerticalLayout.cc.

References kIsVisible(), siStripFEDMonitor_P5_cff::Max, AlCaHLTBitMon_ParallelJobs::options, and findQualityFiles::size.

221 {
222  // Return default dimension of the vertical layout.
223 
224  TGFrameElement *ptr;
225  TGDimension size(0,0), msize = fMain->GetSize(), csize;
226  UInt_t options = fMain->GetOptions();
227 
228  if ((options & kFixedWidth) && (options & kFixedHeight))
229  return msize;
230 
231  TIter next(fList);
232  while ((ptr = (TGFrameElement *) next())) {
233  if (ptr->fState & kIsVisible) {
234  csize = ptr->fFrame->GetDefaultSize();
235  size.fWidth = TMath::Max(size.fWidth, csize.fWidth + ptr->fLayout->GetPadLeft() +
236  ptr->fLayout->GetPadRight());
237  size.fHeight += csize.fHeight + ptr->fLayout->GetPadTop() +
238  ptr->fLayout->GetPadBottom();
239  }
240  }
241 
242  size.fWidth += fMain->GetBorderWidth() << 1;
243  size.fHeight += fMain->GetBorderWidth() << 1;
244 
245  if (options & kFixedWidth) size.fWidth = msize.fWidth;
246  if (options & kFixedHeight) size.fHeight = msize.fHeight;
247 
248  return size;
249 }
unsigned int UInt_t
Definition: FUTypes.h:12
static const std::string kIsVisible("isVisible")
tuple size
Write out results.
void FWCompactVerticalLayout::Layout ( )
virtual

Definition at line 63 of file FWCompactVerticalLayout.cc.

References create_public_lumi_plots::exp, kIsVisible(), makeLayoutFileForGui::layout, siStripFEDMonitor_P5_cff::Max, findQualityFiles::size, python.multivaluedict::sort(), x, and detailsBasic3DVector::y.

64 {
65  // Make a vertical layout of all frames in the list.
66 
67  TGFrameElement *ptr;
68  TGLayoutHints *layout;
69  Int_t nb_expand = 0;
70  Int_t top, bottom;
71  ULong_t hints;
72  UInt_t extra_space = 0;
73  Int_t exp = 0;
74  Int_t exp_max = 0;
75  Int_t remain;
76  Int_t x = 0, y = 0;
77  Int_t bw = fMain->GetBorderWidth();
78  TGDimension size(0,0), csize(0,0);
79  TGDimension msize = fMain->GetSize();
80  UInt_t pad_left, pad_top, pad_right, pad_bottom;
81  Int_t size_expand=0, esize_expand=0, rem_expand=0, tmp_expand = 0;
82 
83  if (!fList) return;
84 
85  fModified = kFALSE;
86 
87  bottom = msize.fHeight - (top = bw);
88  remain = msize.fHeight - (bw << 1);
89 
90  std::vector<int> expandSizes;
91  expandSizes.reserve(fList->GetSize());
92  TIter next(fList);
93  while ((ptr = (TGFrameElement *) next())) {
94  if (ptr->fState & kIsVisible) {
95  layout = ptr->fLayout;
96  size = ptr->fFrame->GetDefaultSize();
97  size.fHeight += layout->GetPadTop() + layout->GetPadBottom();
98  hints = layout->GetLayoutHints();
99  if ((hints & kLHintsExpandY) || (hints & kLHintsCenterY)) {
100  nb_expand++;
101  exp += size.fHeight;
102  if (hints & kLHintsExpandY) {
103  exp_max = 0;
104  expandSizes.push_back(size.fHeight);
105  }
106  else exp_max = TMath::Max(exp_max, (Int_t)size.fHeight);
107  } else {
108  remain -= size.fHeight;
109  if (remain < 0)
110  remain = 0;
111  }
112  }
113  }
114 
115  if (nb_expand) {
116  size_expand = remain/nb_expand;
117 
118  if (size_expand < exp_max)
119  esize_expand = (remain - exp)/nb_expand;
120  rem_expand = remain % nb_expand;
121  }
122 
123  std::sort(expandSizes.begin(), expandSizes.end(),std::less<int>());
124  //Now see if expanded widgets exceed their max sizes
125  for(std::vector<int>::iterator it = expandSizes.begin(), itEnd = expandSizes.end();
126  it != itEnd;
127  ++it) {
128  if(*it > size_expand) {
129  break;
130  }
131  remain -= *it;
132  --nb_expand;
133  if(remain<0) {remain=0;}
134  if(nb_expand>0) {
135  size_expand = remain/nb_expand;
136  } else {
137  size_expand=msize.fHeight - (bw << 1);
138  }
139  }
140 
141  next.Reset();
142  while ((ptr = (TGFrameElement *) next())) {
143  if (ptr->fState & kIsVisible) {
144  hints = (layout = ptr->fLayout)->GetLayoutHints();
145  csize = ptr->fFrame->GetDefaultSize();
146  pad_left = layout->GetPadLeft();
147  pad_top = layout->GetPadTop();
148  pad_right = layout->GetPadRight();
149  pad_bottom = layout->GetPadBottom();
150 
151  if (hints & kLHintsRight) {
152  x = msize.fWidth - bw - csize.fWidth - pad_right;
153  } else if (hints & kLHintsCenterX) {
154  x = (msize.fWidth - (bw << 1) - csize.fWidth) >> 1;
155  } else { // defaults to kLHintsLeft
156  x = pad_left + bw;
157  }
158 
159  if (hints & kLHintsExpandX) {
160  size.fWidth = msize.fWidth - (bw << 1) - pad_left - pad_right;
161  x = pad_left + bw;
162  } else {
163  size.fWidth = csize.fWidth;
164  }
165 
166  if (hints & kLHintsExpandY) {
167  if (size_expand >= exp_max)
168  if(static_cast<int>(csize.fHeight) > size_expand) {
169  size.fHeight = size_expand - pad_top - pad_bottom;
170  } else {
171  size.fHeight = csize.fHeight;
172  }
173  else
174  size.fHeight = csize.fHeight + esize_expand;
175 
176  tmp_expand += rem_expand;
177  if (tmp_expand >= nb_expand) {
178  size.fHeight++;
179  tmp_expand -= nb_expand;
180  }
181  } else {
182  size.fHeight = csize.fHeight;
183  if (hints & kLHintsCenterY) {
184  if (size_expand >= exp_max) {
185  extra_space = (size_expand - pad_top - pad_bottom - size.fHeight) >> 1;
186  } else {
187  extra_space = esize_expand >> 1;
188  }
189  top += extra_space;
190  }
191  }
192 
193  if (hints & kLHintsBottom) {
194  y = bottom - size.fHeight - pad_bottom;
195  bottom -= size.fHeight + pad_top + pad_bottom;
196  } else { // kLHintsTop by default
197  y = top + pad_top;
198  top += size.fHeight + pad_top + pad_bottom;
199  }
200 
201  if (hints & kLHintsCenterY)
202  top += extra_space;
203 
204  if (size.fWidth > 32768)
205  size.fWidth = 1;
206  if (size.fHeight > 32768)
207  size.fHeight = 1;
208  ptr->fFrame->MoveResize(x, y, size.fWidth, size.fHeight);
209 
210  fModified = fModified || (ptr->fFrame->GetX() != x) ||
211  (ptr->fFrame->GetY() != y) ||
212  (ptr->fFrame->GetWidth() != size.fWidth) ||
213  (ptr->fFrame->GetHeight() != size.fHeight);
214  }
215  }
216 
217 }
unsigned int UInt_t
Definition: FUTypes.h:12
static const std::string kIsVisible("isVisible")
Definition: DDAxes.h:10
tuple size
Write out results.
ClassDef (FWCompactVerticalLayout,0) private const FWCompactVerticalLayout& FWCompactVerticalLayout::operator= ( const FWCompactVerticalLayout )