CMS 3D CMS Logo

FWDialogBuilder.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWDialogBuilder_h
2 #define Fireworks_Core_FWDialogBuilder_h
3 
4 #include "TGNumberEntry.h"
5 
6 class TGCompositeFrame;
7 class TGLayoutHints;
8 class TGVerticalFrame;
9 class TGLabel;
10 class FWColorSelect;
11 class TGTextView;
12 class TGTextEntry;
13 class TGTextButton;
14 class TGHSlider;
15 class FWTableManagerBase;
16 class FWTableWidget;
17 class TGCheckButton;
19 class TGTab;
20 class FWColorManager;
21 class TGTextEdit;
22 class TGHtml;
23 
25 {
26 protected:
27  FWLayoutBuilder(TGCompositeFrame *window, bool expandY = true);
29 
30  FWLayoutBuilder &indent(int left = 2, int right = -1);
31 
33  TGCompositeFrame *currentFrame(void) { return m_currentFrame; }
34  FWLayoutBuilder &floatLeft(size_t spacing);
35  FWLayoutBuilder &spaceUp(size_t spacing);
36  FWLayoutBuilder &spaceDown(size_t spacing);
37  FWLayoutBuilder &spaceLeft(size_t spacing);
38  FWLayoutBuilder &spaceRight(size_t spacing);
39  FWLayoutBuilder &frameSpaceUp(size_t spacing);
40  FWLayoutBuilder &frameSpaceDown(size_t spacing);
41  FWLayoutBuilder &frameSpaceLeft(size_t spacing);
42  FWLayoutBuilder &frameSpaceRight(size_t spacing);
43  FWLayoutBuilder &expand(bool expandX = true, bool expandY = false);
44 
45  bool isFloatingLeft() { return m_floatLeft; }
46  TGLayoutHints *nextHints();
47  TGCompositeFrame *nextFrame();
48  TGVerticalFrame *verticalFrame();
49  void frameForTab();
50 
51 private:
52  TGCompositeFrame *m_window;
53 
54  std::vector<TGVerticalFrame *> m_framesStack;
55  // TGCompositeFrame *m_lastFrame;
56  TGCompositeFrame *m_currentFrame;
57 
59  size_t m_topSpacing;
60  size_t m_leftSpacing;
61  TGLayoutHints *m_currentHints;
62  TGLayoutHints *m_currentFrameHints;
63 };
64 
95 {
96 public:
97  FWDialogBuilder(TGCompositeFrame *window, FWDialogBuilder *parent = nullptr, bool expandY = true);
98 
100  FWDialogBuilder &indent(int left = 2, int right = -1);
101  FWDialogBuilder &unindent(void);
102 
103  FWDialogBuilder &addLabel(const char *text,
104  size_t fontSize = 12,
105  size_t weight = 0,
106  TGLabel **out = nullptr);
107 
108  FWDialogBuilder &addTextView(const char *defaultText = nullptr,
109  TGTextView **out = nullptr);
110 
111  // Is default text meaningful here as the html is
112  // a document with structure?
113  FWDialogBuilder &addHtml(TGHtml **out = nullptr);
114 
115  FWDialogBuilder &addTextEdit(const char *defaultText = nullptr,
116  TGTextEdit **out = nullptr);
117  FWDialogBuilder &addColorPicker(const FWColorManager *manager,
118  FWColorSelect **out = nullptr);
119 
120  FWDialogBuilder &addHSlider(size_t size, TGHSlider **out = nullptr);
121 
122  FWDialogBuilder &addTextButton(const char *text, TGTextButton **out = nullptr);
123  FWDialogBuilder &addValidatingTextEntry(const char *defaultText,
125  FWDialogBuilder &addTextEntry(const char *defaultText, TGTextEntry **out);
126  FWDialogBuilder &addNumberEntry(float defaultValue, size_t digits,
127  TGNumberFormat::EStyle style,
128  int min, int max,
129  TGNumberEntry **out);
130 
131  FWDialogBuilder &addCheckbox(const char *text, TGCheckButton **out = nullptr);
132  FWDialogBuilder &addTable(FWTableManagerBase *manager, FWTableWidget **out = nullptr);
133 
134 
135  FWDialogBuilder &addHSeparator(size_t horizontalPadding = 4,
136  size_t verticalPadding = 3);
137 
138  FWDialogBuilder &tabs(TGTab **out);
139  FWDialogBuilder &untabs(void);
140  FWDialogBuilder &beginTab(const char *label);
141  FWDialogBuilder &endTab(void);
142 
143  FWDialogBuilder &floatLeft(size_t spacing = 3);
144 
145  FWDialogBuilder &spaceUp(size_t spacing = 3);
146  FWDialogBuilder &spaceDown(size_t spacing = 3);
147  FWDialogBuilder &spaceUpDown(size_t spacing = 3);
148  FWDialogBuilder &spaceLeft(size_t spacing = 3);
149  FWDialogBuilder &spaceRight(size_t spacing = 3);
150  FWDialogBuilder &spaceLeftRight(size_t spacing = 3);
151 
152  FWDialogBuilder &frameSpaceUp(size_t spacing = 3);
153  FWDialogBuilder &frameSpaceDown(size_t spacing = 3);
154  FWDialogBuilder &frameSpaceUpDown(size_t spacing = 3);
155  FWDialogBuilder &frameSpaceLeft(size_t spacing = 3);
156  FWDialogBuilder &frameSpaceRight(size_t spacing = 3);
157  FWDialogBuilder &frameSpaceLeftRight(size_t spacing = 3);
158 
159  FWDialogBuilder &expand(size_t expandX = true, size_t expandY = false);
160  FWDialogBuilder &vSpacer(size_t size = 0);
161  FWDialogBuilder &hSpacer(size_t size = 0);
162 
163 protected:
164  template <class T> FWDialogBuilder &extract(T *in, T **out)
165  {
166  if (out)
167  *out = in;
168  return *this;
169  }
170 
171 private:
173  TGTab *m_tabs;
174 };
175 
176 #endif
size
Write out results.
TGVerticalFrame * verticalFrame()
TGCompositeFrame * m_window
FWDialogBuilder & extract(T *in, T **out)
TGCompositeFrame * nextFrame()
FWLayoutBuilder & frameSpaceRight(size_t spacing)
FWLayoutBuilder & spaceRight(size_t spacing)
Definition: weight.py:1
std::vector< TGVerticalFrame * > m_framesStack
FWLayoutBuilder(TGCompositeFrame *window, bool expandY=true)
TGLayoutHints * m_currentHints
FWLayoutBuilder & frameSpaceDown(size_t spacing)
FWLayoutBuilder & frameSpaceUp(size_t spacing)
FWLayoutBuilder & spaceUp(size_t spacing)
TGCompositeFrame * m_currentFrame
Definition: style.py:1
FWLayoutBuilder & floatLeft(size_t spacing)
TGLayoutHints * m_currentFrameHints
FWLayoutBuilder & unindent(void)
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:642
TGCompositeFrame * currentFrame(void)
T min(T a, T b)
Definition: MathUtil.h:58
FWLayoutBuilder & indent(int left=2, int right=-1)
FWLayoutBuilder & newRow()
TGLayoutHints * nextHints()
FWLayoutBuilder & spaceDown(size_t spacing)
FWDialogBuilder * m_parent
FWLayoutBuilder & expand(bool expandX=true, bool expandY=false)
long double T
FWLayoutBuilder & spaceLeft(size_t spacing)
FWLayoutBuilder & frameSpaceLeft(size_t spacing)