CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Protected Member Functions | Private Attributes
FWLayoutBuilder Class Reference

#include <FWDialogBuilder.h>

Inheritance diagram for FWLayoutBuilder:
FWDialogBuilder

Protected Member Functions

TGCompositeFrame * currentFrame (void)
 
FWLayoutBuilderexpand (bool expandX=true, bool expandY=false)
 
FWLayoutBuilderfloatLeft (size_t spacing)
 
void frameForTab ()
 
FWLayoutBuilderframeSpaceDown (size_t spacing)
 
FWLayoutBuilderframeSpaceLeft (size_t spacing)
 
FWLayoutBuilderframeSpaceRight (size_t spacing)
 
FWLayoutBuilderframeSpaceUp (size_t spacing)
 
 FWLayoutBuilder (TGCompositeFrame *window, bool expandY=true)
 
FWLayoutBuilderindent (int left=2, int right=-1)
 
bool isFloatingLeft ()
 
FWLayoutBuildernewRow ()
 
TGCompositeFrame * nextFrame ()
 
TGLayoutHints * nextHints ()
 
FWLayoutBuilderspaceDown (size_t spacing)
 
FWLayoutBuilderspaceLeft (size_t spacing)
 
FWLayoutBuilderspaceRight (size_t spacing)
 
FWLayoutBuilderspaceUp (size_t spacing)
 
FWLayoutBuilderunindent (void)
 
TGVerticalFrame * verticalFrame ()
 

Private Attributes

TGCompositeFrame * m_currentFrame
 
TGLayoutHints * m_currentFrameHints
 
TGLayoutHints * m_currentHints
 
bool m_floatLeft
 
std::vector< TGVerticalFrame * > m_framesStack
 
size_t m_leftSpacing
 
size_t m_topSpacing
 
TGCompositeFrame * m_window
 

Detailed Description

Definition at line 24 of file FWDialogBuilder.h.

Constructor & Destructor Documentation

FWLayoutBuilder::FWLayoutBuilder ( TGCompositeFrame *  window,
bool  expandY = true 
)
protected

Definition at line 20 of file FWDialogBuilder.cc.

References m_framesStack, and m_window.

21  : m_window(window),
22  m_currentFrame(0),
23  m_floatLeft(false),
24  m_topSpacing(0),
25  m_leftSpacing(0),
26  m_currentHints(0),
28 {
29  TGVerticalFrame *mainFrame = new TGVerticalFrame(window);
30  TGLayoutHints *hints = new TGLayoutHints(expandY ? kLHintsExpandX|kLHintsExpandY : kLHintsExpandX,
31  0, 0, 0, 0);
32  m_window->AddFrame(mainFrame, hints);
33  m_framesStack.push_back(mainFrame);
34 }
TGCompositeFrame * m_window
def window
Definition: svgfig.py:642
std::vector< TGVerticalFrame * > m_framesStack
TGLayoutHints * m_currentHints
TGCompositeFrame * m_currentFrame
TGLayoutHints * m_currentFrameHints

Member Function Documentation

TGCompositeFrame* FWLayoutBuilder::currentFrame ( void  )
inlineprotected
FWLayoutBuilder & FWLayoutBuilder::expand ( bool  expandX = true,
bool  expandY = false 
)
protected

Set whether or not the previous layout element should expand and in which direction.

Definition at line 159 of file FWDialogBuilder.cc.

References m_currentHints.

Referenced by FWDialogBuilder::expand(), and indent().

160 {
161  UInt_t style = 0;
162  style |= expandX ? kLHintsExpandX : 0;
163  style |= expandY ? kLHintsExpandY : 0;
164 
165  if (m_currentHints)
166  m_currentHints->SetLayoutHints(style);
167  return *this;
168 }
TGLayoutHints * m_currentHints
FWLayoutBuilder & FWLayoutBuilder::floatLeft ( size_t  spacing)
protected

Make sure that the current layout element is going to float on the left of the next one.

Definition at line 83 of file FWDialogBuilder.cc.

References m_floatLeft, and m_leftSpacing.

Referenced by FWDialogBuilder::floatLeft().

84 {
85  m_floatLeft = true;
86  m_leftSpacing = spacing;
87  return *this;
88 }
void FWLayoutBuilder::frameForTab ( )
protected

Definition at line 202 of file FWDialogBuilder.cc.

References m_currentFrame, and m_framesStack.

Referenced by FWDialogBuilder::tabs().

203 {
204  m_currentFrame = new TGVerticalFrame(m_framesStack.back());
205  m_currentFrame->SetBackgroundColor(0x000000);
206  m_framesStack.back()->AddFrame(m_currentFrame, new TGLayoutHints(kLHintsExpandX| kLHintsExpandY));
207  // m_frameStack.push_back(m_currentFrame);
208 }
std::vector< TGVerticalFrame * > m_framesStack
TGCompositeFrame * m_currentFrame
FWLayoutBuilder & FWLayoutBuilder::frameSpaceDown ( size_t  spacing)
protected

Definition at line 132 of file FWDialogBuilder.cc.

References m_currentFrameHints.

Referenced by FWDialogBuilder::frameSpaceDown(), and FWDialogBuilder::frameSpaceUpDown().

133 {
135  m_currentFrameHints->SetPadBottom(spacing);
136  return *this;
137 }
TGLayoutHints * m_currentFrameHints
FWLayoutBuilder & FWLayoutBuilder::frameSpaceLeft ( size_t  spacing)
protected

Definition at line 140 of file FWDialogBuilder.cc.

References m_currentFrameHints.

Referenced by FWDialogBuilder::frameSpaceLeft(), and FWDialogBuilder::frameSpaceLeftRight().

141 {
143  m_currentFrameHints->SetPadLeft(spacing);
144  return *this;
145 }
TGLayoutHints * m_currentFrameHints
FWLayoutBuilder & FWLayoutBuilder::frameSpaceRight ( size_t  spacing)
protected

Definition at line 148 of file FWDialogBuilder.cc.

References m_currentFrameHints.

Referenced by FWDialogBuilder::frameSpaceLeftRight(), and FWDialogBuilder::frameSpaceRight().

149 {
151  m_currentFrameHints->SetPadRight(spacing);
152  return *this;
153 }
TGLayoutHints * m_currentFrameHints
FWLayoutBuilder & FWLayoutBuilder::frameSpaceUp ( size_t  spacing)
protected

Definition at line 124 of file FWDialogBuilder.cc.

References m_currentFrameHints.

Referenced by FWDialogBuilder::frameSpaceUp(), and FWDialogBuilder::frameSpaceUpDown().

125 {
127  m_currentFrameHints->SetPadTop(spacing);
128  return *this;
129 }
TGLayoutHints * m_currentFrameHints
FWLayoutBuilder & FWLayoutBuilder::indent ( int  left = 2,
int  right = -1 
)
protected

Definition at line 48 of file FWDialogBuilder.cc.

References expand(), m_currentHints, m_framesStack, and newRow().

Referenced by FWDialogBuilder::indent().

49 {
50  if (right < 0)
51  right = left;
52 
53  TGVerticalFrame *parent = m_framesStack.back();
54  TGLayoutHints *hints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,
55  left, right, 0, 0);
56  m_currentHints = 0;
57  m_framesStack.push_back(new TGVerticalFrame(parent));
58  parent->AddFrame(m_framesStack.back(), hints);
59  return newRow().expand(true, false);
60 }
std::vector< TGVerticalFrame * > m_framesStack
TGLayoutHints * m_currentHints
FWLayoutBuilder & newRow()
FWLayoutBuilder & expand(bool expandX=true, bool expandY=false)
bool FWLayoutBuilder::isFloatingLeft ( )
inlineprotected

Definition at line 45 of file FWDialogBuilder.h.

References m_floatLeft.

Referenced by nextFrame().

45 { return m_floatLeft; }
FWLayoutBuilder & FWLayoutBuilder::newRow ( void  )
protected

Definition at line 37 of file FWDialogBuilder.cc.

References m_currentFrame, m_currentFrameHints, m_currentHints, and m_framesStack.

Referenced by indent(), FWDialogBuilder::newRow(), and nextFrame().

38 {
39  m_currentFrameHints = m_currentHints = new TGLayoutHints(kLHintsExpandX);
40  m_currentFrame = new TGHorizontalFrame(m_framesStack.back());
41  m_framesStack.back()->AddFrame(m_currentFrame, m_currentHints);
42  return *this;
43 }
std::vector< TGVerticalFrame * > m_framesStack
TGLayoutHints * m_currentHints
TGCompositeFrame * m_currentFrame
TGLayoutHints * m_currentFrameHints
TGCompositeFrame * FWLayoutBuilder::nextFrame ( )
protected
TGLayoutHints * FWLayoutBuilder::nextHints ( )
protected

Definition at line 172 of file FWDialogBuilder.cc.

References assert(), m_currentHints, m_floatLeft, m_leftSpacing, and m_topSpacing.

Referenced by FWDialogBuilder::addCheckbox(), FWDialogBuilder::addColorPicker(), FWDialogBuilder::addHSlider(), FWDialogBuilder::addHtml(), FWDialogBuilder::addLabel(), FWDialogBuilder::addNumberEntry(), FWDialogBuilder::addTextButton(), FWDialogBuilder::addTextEdit(), FWDialogBuilder::addTextEntry(), FWDialogBuilder::addTextView(), FWDialogBuilder::addValidatingTextEntry(), FWDialogBuilder::hSpacer(), and FWDialogBuilder::vSpacer().

173 {
174  if (m_floatLeft)
175  {
176  size_t left = m_leftSpacing;
177  m_floatLeft = false;
178  m_leftSpacing = 0;
180  m_currentHints = new TGLayoutHints(kLHintsExpandX, left, 0,
181  m_currentHints->GetPadTop(), 0);
182  }
183  else
184  {
185  size_t top = m_topSpacing;
186  m_topSpacing = 3;
187  m_currentHints = new TGLayoutHints(kLHintsExpandX, 0, 0, top, 0);
188  }
189  return m_currentHints;
190 }
assert(m_qm.get())
TGLayoutHints * m_currentHints
FWLayoutBuilder & FWLayoutBuilder::spaceDown ( size_t  spacing)
protected

Definition at line 99 of file FWDialogBuilder.cc.

References m_currentHints.

Referenced by FWDialogBuilder::spaceDown(), and FWDialogBuilder::spaceUpDown().

100 {
101  if (m_currentHints)
102  m_currentHints->SetPadBottom(spacing);
103  return *this;
104 }
TGLayoutHints * m_currentHints
FWLayoutBuilder & FWLayoutBuilder::spaceLeft ( size_t  spacing)
protected

Definition at line 107 of file FWDialogBuilder.cc.

References m_currentHints.

Referenced by FWDialogBuilder::spaceLeft(), and FWDialogBuilder::spaceLeftRight().

108 {
109  if (m_currentHints)
110  m_currentHints->SetPadLeft(spacing);
111  return *this;
112 }
TGLayoutHints * m_currentHints
FWLayoutBuilder & FWLayoutBuilder::spaceRight ( size_t  spacing)
protected

Definition at line 115 of file FWDialogBuilder.cc.

References m_currentHints.

Referenced by FWDialogBuilder::spaceLeftRight(), and FWDialogBuilder::spaceRight().

116 {
117  if (m_currentHints)
118  m_currentHints->SetPadRight(spacing);
119  return *this;
120 }
TGLayoutHints * m_currentHints
FWLayoutBuilder & FWLayoutBuilder::spaceUp ( size_t  spacing)
protected

Definition at line 91 of file FWDialogBuilder.cc.

References m_currentHints.

Referenced by FWDialogBuilder::spaceUp(), and FWDialogBuilder::spaceUpDown().

92 {
93  if (m_currentHints)
94  m_currentHints->SetPadTop(spacing);
95  return *this;
96 }
TGLayoutHints * m_currentHints
FWLayoutBuilder & FWLayoutBuilder::unindent ( void  )
protected

Removes all the frames on the stack since last indent.

Definition at line 72 of file FWDialogBuilder.cc.

References assert(), and m_framesStack.

Referenced by FWDialogBuilder::unindent().

73 {
74  assert(!m_framesStack.empty());
75  m_framesStack.pop_back();
76  return *this;
77 }
assert(m_qm.get())
std::vector< TGVerticalFrame * > m_framesStack
TGVerticalFrame * FWLayoutBuilder::verticalFrame ( void  )
protected

Return the last vertical frame, for more control on the layout.

Definition at line 64 of file FWDialogBuilder.cc.

References assert(), and m_framesStack.

Referenced by FWDialogBuilder::addTable().

65 {
66  assert(m_framesStack.size());
67  return m_framesStack.back();
68 }
assert(m_qm.get())
std::vector< TGVerticalFrame * > m_framesStack

Member Data Documentation

TGCompositeFrame* FWLayoutBuilder::m_currentFrame
private

Definition at line 56 of file FWDialogBuilder.h.

Referenced by currentFrame(), frameForTab(), and newRow().

TGLayoutHints* FWLayoutBuilder::m_currentFrameHints
private
TGLayoutHints* FWLayoutBuilder::m_currentHints
private

Definition at line 61 of file FWDialogBuilder.h.

Referenced by expand(), indent(), newRow(), nextHints(), spaceDown(), spaceLeft(), spaceRight(), and spaceUp().

bool FWLayoutBuilder::m_floatLeft
private

Definition at line 58 of file FWDialogBuilder.h.

Referenced by floatLeft(), isFloatingLeft(), and nextHints().

std::vector<TGVerticalFrame *> FWLayoutBuilder::m_framesStack
private

Definition at line 54 of file FWDialogBuilder.h.

Referenced by frameForTab(), FWLayoutBuilder(), indent(), newRow(), unindent(), and verticalFrame().

size_t FWLayoutBuilder::m_leftSpacing
private

Definition at line 60 of file FWDialogBuilder.h.

Referenced by floatLeft(), and nextHints().

size_t FWLayoutBuilder::m_topSpacing
private

Definition at line 59 of file FWDialogBuilder.h.

Referenced by nextHints().

TGCompositeFrame* FWLayoutBuilder::m_window
private

Definition at line 52 of file FWDialogBuilder.h.

Referenced by FWLayoutBuilder().