Go to the documentation of this file.00001 #ifndef Fireworks_Core_FWDialogBuilder_h
00002 #define Fireworks_Core_FWDialogBuilder_h
00003
00004 #include "TGNumberEntry.h"
00005
00006 class TGCompositeFrame;
00007 class TGLayoutHints;
00008 class TGVerticalFrame;
00009 class TGLabel;
00010 class FWColorSelect;
00011 class TGTextView;
00012 class TGTextEntry;
00013 class TGTextButton;
00014 class TGHSlider;
00015 class FWTableManagerBase;
00016 class FWTableWidget;
00017 class TGCheckButton;
00018 class FWGUIValidatingTextEntry;
00019 class TGTab;
00020 class FWColorManager;
00021 class TGTextEdit;
00022 class TGHtml;
00023
00024 class FWLayoutBuilder
00025 {
00026 protected:
00027 FWLayoutBuilder(TGCompositeFrame *window, bool expandY = true);
00028 FWLayoutBuilder &newRow();
00029
00030 FWLayoutBuilder &indent(int left = 2, int right = -1);
00031
00032 FWLayoutBuilder &unindent(void);
00033 TGCompositeFrame *currentFrame(void) { return m_currentFrame; }
00034 FWLayoutBuilder &floatLeft(size_t spacing);
00035 FWLayoutBuilder &spaceUp(size_t spacing);
00036 FWLayoutBuilder &spaceDown(size_t spacing);
00037 FWLayoutBuilder &spaceLeft(size_t spacing);
00038 FWLayoutBuilder &spaceRight(size_t spacing);
00039 FWLayoutBuilder &frameSpaceUp(size_t spacing);
00040 FWLayoutBuilder &frameSpaceDown(size_t spacing);
00041 FWLayoutBuilder &frameSpaceLeft(size_t spacing);
00042 FWLayoutBuilder &frameSpaceRight(size_t spacing);
00043 FWLayoutBuilder &expand(bool expandX = true, bool expandY = false);
00044
00045 bool isFloatingLeft() { return m_floatLeft; }
00046 TGLayoutHints *nextHints();
00047 TGCompositeFrame *nextFrame();
00048 TGVerticalFrame *verticalFrame();
00049
00050 private:
00051 TGCompositeFrame *m_window;
00052
00053 std::vector<TGVerticalFrame *> m_framesStack;
00054
00055 TGCompositeFrame *m_currentFrame;
00056
00057 bool m_floatLeft;
00058 size_t m_topSpacing;
00059 size_t m_leftSpacing;
00060 TGLayoutHints *m_currentHints;
00061 TGLayoutHints *m_currentFrameHints;
00062 };
00063
00093 class FWDialogBuilder : public FWLayoutBuilder
00094 {
00095 public:
00096 FWDialogBuilder(TGCompositeFrame *window, FWDialogBuilder *parent = 0, bool expandY = true);
00097
00098 FWDialogBuilder &newRow();
00099 FWDialogBuilder &indent(int left = 2, int right = -1);
00100 FWDialogBuilder &unindent(void);
00101
00102 FWDialogBuilder &addLabel(const char *text,
00103 size_t fontSize = 12,
00104 size_t weight = 0,
00105 TGLabel **out = 0);
00106
00107 FWDialogBuilder &addTextView(const char *defaultText = 0,
00108 TGTextView **out = 0);
00109
00110
00111
00112 FWDialogBuilder &addHtml(TGHtml **out = 0);
00113
00114 FWDialogBuilder &addTextEdit(const char *defaultText = 0,
00115 TGTextEdit **out = 0);
00116 FWDialogBuilder &addColorPicker(const FWColorManager *manager,
00117 FWColorSelect **out = 0);
00118
00119 FWDialogBuilder &addHSlider(size_t size, TGHSlider **out = 0);
00120
00121 FWDialogBuilder &addTextButton(const char *text, TGTextButton **out = 0);
00122 FWDialogBuilder &addValidatingTextEntry(const char *defaultText,
00123 FWGUIValidatingTextEntry **out);
00124 FWDialogBuilder &addTextEntry(const char *defaultText, TGTextEntry **out);
00125 FWDialogBuilder &addNumberEntry(float defaultValue, size_t digits,
00126 TGNumberFormat::EStyle style,
00127 int min, int max,
00128 TGNumberEntry **out);
00129
00130 FWDialogBuilder &addCheckbox(const char *text, TGCheckButton **out = 0);
00131 FWDialogBuilder &addTable(FWTableManagerBase *manager, FWTableWidget **out = 0);
00132
00133
00134 FWDialogBuilder &addHSeparator(size_t horizontalPadding = 4,
00135 size_t verticalPadding = 3);
00136
00137 FWDialogBuilder &tabs(TGTab **out);
00138 FWDialogBuilder &untabs(void);
00139 FWDialogBuilder &beginTab(const char *label);
00140 FWDialogBuilder &endTab(void);
00141
00142 FWDialogBuilder &floatLeft(size_t spacing = 3);
00143
00144 FWDialogBuilder &spaceUp(size_t spacing = 3);
00145 FWDialogBuilder &spaceDown(size_t spacing = 3);
00146 FWDialogBuilder &spaceUpDown(size_t spacing = 3);
00147 FWDialogBuilder &spaceLeft(size_t spacing = 3);
00148 FWDialogBuilder &spaceRight(size_t spacing = 3);
00149 FWDialogBuilder &spaceLeftRight(size_t spacing = 3);
00150
00151 FWDialogBuilder &frameSpaceUp(size_t spacing = 3);
00152 FWDialogBuilder &frameSpaceDown(size_t spacing = 3);
00153 FWDialogBuilder &frameSpaceUpDown(size_t spacing = 3);
00154 FWDialogBuilder &frameSpaceLeft(size_t spacing = 3);
00155 FWDialogBuilder &frameSpaceRight(size_t spacing = 3);
00156 FWDialogBuilder &frameSpaceLeftRight(size_t spacing = 3);
00157
00158 FWDialogBuilder &expand(size_t expandX = true, size_t expandY = false);
00159 FWDialogBuilder &vSpacer(size_t size = 0);
00160 FWDialogBuilder &hSpacer(size_t size = 0);
00161
00162 protected:
00163 template <class T> FWDialogBuilder &extract(T *in, T **out)
00164 {
00165 if (out)
00166 *out = in;
00167 return *this;
00168 }
00169
00170 private:
00171 FWDialogBuilder *m_parent;
00172 TGTab *m_tabs;
00173 };
00174
00175 #endif