Use new vnc syntax (with a colon).
[qemu-gui.git] / guibuilder.h
bloba8f09db22f578b77e3080456e75409c503f2e95a
1 #ifndef __WX__SIZERPROD__
2 #define __WX__SIZERPROD__
4 #define wxGB_VERSION_HIGH "0"
5 #define wxGB_VERSION_LOW "9"
6 #define wxGB_VERSION_RELEASE "beta"
8 // no doxygen
9 #ifndef _NO_DOXYGEN_
11 #define wxGB_SIZER_BEGIN '{' // begin symbol for sizer
12 #define wxGB_SIZER_END '}' // end symbol for sizer
13 #define wxGB_SIZER_HTYPE 'H' // symbol for horizontal sizer
14 #define wxGB_SIZER_VTYPE 'V' // symbol for vertical sizer
15 #define wxGB_SIZER_GTYPE 'G' // wxGridSizer
16 #define wxGB_SIZER_FTYPE 'F' // wxFlexGridSizer
17 #define wxGB_TABSHEET_START 'T' // symbol for tabsheet
18 #define wxGB_PANEL_ITEM '#' // indicates we need to create a panel for this
19 #define wxGB_ALIGN_BOTTOM '_' // align bottom
20 #define wxGB_ALIGN_TOP '^' // align top
21 #define wxGB_ALIGN_LEFT '<' // align left
22 #define wxGB_ALIGN_RIGHT '>' // align right
23 #define wxGB_ALIGN_CENTER '|' // align center
24 #define wxGB_ALIGN_HOR '-' // align horizontal
25 #define wxGB_ALIGN_VER '/' // align vertical
26 #define wxGB_EXPAND '+' // expand the element when needed
27 #define wxGB_PROPORTION ',' // proportional
28 #define wxGB_WND_SUBSTITUTE '$' // window item substitute
29 #define wxGB_DEFAULT_FLAGS '%' // default sizer or window flag %w or %s
30 #define wxGB_WND_CHECK_START '[' // start of a checkbox
31 #define wxGB_WND_CHECK_END ']' // end of a checkbox
32 #define wxGB_WND_RADIO_START '(' // start of a radio button
33 #define wxGB_WND_RADIO_END ')' // end of a radio button
34 #define wxGB_WND_BUTTON_START '[' // start of a button
35 #define wxGB_WND_BUTTON_END ']' // end of button
36 #define wxGB_WND_SPECIAL_START '<' // static line vertical
37 #define wxGB_WND_SPECIAL_END '>' // static line horizontal
38 #define wxGB_WND_TEXTCTL_START '[' // start of a text ctrl
39 #define wxGB_WND_TEXTCTL_END ']' // end of a text ctrl
40 #define wxGB_WND_TEXTCTL_MULTI '=' // end of a text ctrl
41 #define wxGB_WND_TEXTCTL_SINGLE '-' // end of a text ctrl
42 #define wxGB_WND_CHOICE_START '|' // start of a choice (readonly combo)
43 #define wxGB_WND_COMBO_START '|' // start of a combobox
44 #define wxGB_WND_LISTCTRL_START '|' // start of a listctrl
45 #define wxGB_WND_TREECTRL_START '|' // start of a treectrl
46 #define wxGB_WND_LABEL_START '\'' // start of a static text
47 #define wxGB_LABEL_ESCAPE '\\' // escape character
48 #define wxGB_BORDER_MARK '.' // border seperator
49 #define wxGB_LABEL_MARK ':' // label seperator
50 #define wxGB_BORDER_ALL 'a' // border all
51 #define wxGB_BORDER_LEFT 'l' // border left
52 #define wxGB_BORDER_RIGHT 'r' // border right
53 #define wxGB_BORDER_BOTTOM 'b' // border bottom
54 #define wxGB_BORDER_TOP 't' // border top
55 #define wxGB_ASSIGN '=' // assign
56 #define wxGB_WND_AUTOID_START '_' // button auto ID start
57 #define wxGB_WND_AUTOID_END '_' // button auto ID end
58 #define wxGB_TUPLE_START '(' // begin of a tuple
59 #define wxGB_TUPLE_END ')' // end of a tuple
60 #define wxGB_GROW_ROW 'r' // growable row
61 #define wxGB_GROW_COL 'c' // growable col
63 #include <vector>
65 enum
67 wxGB_BOXSIZER_H = 0, // create a horizontal boxsizer
68 wxGB_BOXSIZER_V, // create a vertical boxsizer
69 wxGB_FLEXGRIDSIZER, // create a flexgrid sizer
70 wxGB_STATICBOXSIZER_H, // create a static horizontal box sizer
71 wxGB_STATICBOXSIZER_V, // create a static vertical box sizer
72 wxGB_GRIDSIZER, // create a grid sizer
73 //wxGB_GRIDBAGSIZER, // create a grid bag sizer
74 wxGB_UNDEFINED // keep last in list
77 typedef struct _wxGbParseBufferState
79 // position
80 size_t pos;
81 // row marker
82 size_t row;
83 // col marker
84 size_t col;
85 } wxGbParseBufferState;
87 typedef struct _wxSizerItemFlexInfo
89 char rowcol; // 0 = row, 1 = col
90 size_t idx; // index of the row / col
91 size_t prop; // proportion factor
92 } wxSizerItemFlexInfo;
94 // this class will aid the other classes in parsing the contents of the
95 // sizer text. It contains the necessary helper functions to make
96 // parsing easier. SHOULD NOT BE USED DIRECTLY
97 class wxGbParseBuffer
99 public:
100 wxGbParseBuffer(const wxString &buffer)
101 : m_buffer(buffer)
103 // push the base state on the stack
104 wxGbParseBufferState pb = {0, 1, 1};
105 m_states.push_back(pb);
108 virtual ~wxGbParseBuffer() {
111 // push the buffer on the stack, so that we have a snapshot
112 // of where we were
113 void Push() {
114 wxGbParseBufferState pb = m_states[m_states.size() - 1];
115 m_states.push_back(pb);
118 // pop the state, or give error when we are at the base state
119 void Pop() {
120 wxCHECK2(m_states.size() > 1, return);
121 m_states.pop_back();
124 // pop but keep the latest state
125 void Delegate() {
126 // store the latest
127 wxGbParseBufferState gb = State();
128 Pop();
129 // store back to reference
130 State() = gb;
133 // this relation has all the items that belong to this
134 // peeks a character from the buffer, if none left,
135 // a 0 char is returned
136 wxChar PeekChar(size_t offset = 0) const;
138 // gets a character from the buffer, if none is left
139 // a 0 char is returned
140 wxChar PopChar(int times = 1);
142 // helper function to eat CR / LF and whitepaces until
143 // we choke
144 void EatWhites();
146 // convert the next number to a size_t value. If
147 // false is returned, there is no number
148 bool ToLong(size_t &value);
150 // returns true if the current pos is a digit
151 bool IsDigit() const;
153 // returns true if the current pos is alpha
154 bool IsAlpha() const;
156 // gets the next quoted string at this location
157 bool ToString(wxString &value);
159 // returns a standard line like 'At Row, Col (pos) - '
160 wxString GetAt() const {
161 return wxString::Format(wxT("At Row %i, Col %i (Pos %i) - "), CState().row, CState().col, CState().pos);
164 // returns position
165 size_t GetPos() const {
166 return CState().pos;
169 // returns the label at the current pos (if true)
170 bool ToLabel(wxString &value);
172 // get the last state
173 wxGbParseBufferState &State() {
174 return m_states[m_states.size() - 1];
177 // get the last state (const) read only object
178 const wxGbParseBufferState &CState() const {
179 return m_states[m_states.size() - 1];
182 // parses x,y where the method also allows the absence
183 // of one or the other, which will remain the default
184 // value given.
185 bool ParseTuple(int &x, int &y);
188 private:
189 // the buffer of the parser
190 wxString m_buffer;
191 // the pushed states
192 std::vector<wxGbParseBufferState> m_states;
196 // The base item is the abstract class that can either be a sizer
197 // or a window item. When it is a sizer item, multiple window or sizer
198 // items can be added. SHOULD NOT BE USED DIRECTLY
199 class wxGbSizerItem;
200 class wxGuiBuilder;
201 class wxGbBaseItem
203 public:
204 wxGbBaseItem(wxGbSizerItem *parent, const wxSizerFlags &defwnd,
205 const wxSizerFlags &defsizer)
206 : m_parent(parent)
207 , m_flags(0)
208 , m_defWindowFlags(defwnd)
209 , m_defSizerFlags(defsizer)
213 virtual ~wxGbBaseItem() {
216 // parse the common flags which belong to every item
217 // something like :{label} or .{border}{align}:{label}
218 int ParseCommonFlags(wxGbParseBuffer &buf,wxSizerFlags &flags, wxString &label);
220 // returns label reference of this object
221 const wxString &GetLabel() const {
222 return m_label;
225 // return the parent of this sizer
226 wxGbSizerItem *GetParent() {
227 return m_parent;
230 // return the sizer flags
231 const wxSizerFlags &GetSizerFlags() const {
232 return m_flags;
235 // a method to verify the contents if
236 // everything is set up allright
237 virtual bool Verify(wxGbBaseItem *item);
239 // method to get the window elements for in the
240 // lookup list. This methid needs to be overridden
241 // and the class should handle the population of the
242 // lookup list
243 virtual void AddToLookup(std::vector<wxGbBaseItem *> &list) = 0;
245 // returns window caption
246 const wxString &GetCaption() const {
247 return m_caption;
251 protected:
252 // our parent
253 wxGbSizerItem *m_parent;
254 // the flags belonging to this item (window or sizer)
255 wxSizerFlags m_flags;
256 // label of any control
257 wxString m_label;
258 // default flags for any window item
259 wxSizerFlags m_defWindowFlags;
260 // default flags for any sizer item
261 wxSizerFlags m_defSizerFlags;
262 // a caption that belongs to this window item, like a static text,
263 // check box, button, etc
264 wxString m_caption;
267 // The sizer item holds a list of window / sizer items in a recursive
268 // way so that a tree structure can exist with sizers and window items
269 // SHOULD NOT BE USED DIRECTLY
270 class wxGbSizerItem : public wxGbBaseItem
272 public:
273 wxGbSizerItem(wxGbSizerItem *parent, const wxSizerFlags &defwnd,
274 const wxSizerFlags &defsizer)
275 : wxGbBaseItem(parent, defwnd, defsizer)
276 , m_type(wxGB_UNDEFINED)
277 , m_sizer(0)
278 , m_cols(0)
279 , m_rows(0)
283 virtual ~wxGbSizerItem() {
284 // mass cleanup!
285 for(size_t n = 0; n < m_items.size(); n++)
286 delete m_items[n];
289 // parses the sizer, returns -1 when an error occured, otherwise
290 // the offset where the next action can take place. The wxString
291 // should contain the sizer text to be parsed. The structures are
292 // populated as the sizer is parsed.
293 int Parse(wxGbParseBuffer &buf);
295 // scans for valid sizer type begin, and returns the type
296 static size_t ScanSizerType(const wxGbParseBuffer &buf);
298 // return count of all sub items
299 size_t GetCount() const {
300 return m_items.size();
303 // return sub item as base class
304 wxGbBaseItem *GetItem(size_t n) const {
305 wxCHECK(n < m_items.size(), 0);
306 return m_items[n];
309 // create sizer structure from this node on
310 wxSizer *RealizeSizer(wxGuiBuilder &owner, wxWindow *parent);
312 // a method to verify the contents if
313 // everything is set up allright
314 virtual bool Verify(wxGbBaseItem *item);
316 // add to lookup list
317 virtual void AddToLookup(std::vector<wxGbBaseItem *> &list);
319 private:
320 void DoCreateSizer(wxWindow *parent);
321 // method that parses a BoxSizer and StaticBoxSizer depending on
322 // what the type is
323 int ParseStaticBoxSizer(wxGbParseBuffer &buf, bool withlabel);
324 // parse grid box sizer
325 int ParseGridSizer(wxGbParseBuffer &buf, bool withgrow);
326 // parse all controls between the sizer
327 int ParseWindowControls(wxGbParseBuffer &buf, wxChar sizer_end);
328 // parse sizer contents
329 int ParseSizerContents(wxGbParseBuffer &buf, wxChar szbegin, wxChar szend);
331 // sizer which can be sizers as well as window items
332 std::vector<wxGbBaseItem *> m_items;
333 // growable rows, columns
334 std::vector<wxSizerItemFlexInfo> m_growinfo;
335 // the type of sizer
336 size_t m_type;
337 // parent sizer
338 wxGbSizerItem *m_parent;
339 // the instantiated sizer
340 wxSizer *m_sizer;
341 // column size
342 int m_cols;
343 // row size
344 int m_rows;
347 // The window item
348 class wxGbWindowItem : public wxGbBaseItem
350 public:
351 wxGbWindowItem(wxGbSizerItem *parent,const wxSizerFlags &defwnd,
352 const wxSizerFlags &defsizer)
353 : wxGbBaseItem(parent, defwnd, defsizer)
354 , m_number(0)
355 , m_windowType(WI_UNKNOWN)
356 , m_wnd(0)
357 , m_sizer(0)
358 , m_id(wxID_ANY)
359 , m_checked(false)
360 , m_multiLine(false)
361 , m_width(5)
362 , m_height(5)
366 enum {
367 WI_UNKNOWN = -1, // undefined, should never happen!
368 WI_SUBSTITUTE = 0, // substitute, we need a handle to a wxWindow*
369 WI_PANEL, // a panel, which means we have one sizer
370 // that is assigned to this window item
371 WI_TABSHEET, // a tabsheet, which contains multiple window elements
372 WI_BUTTON, // button element
373 WI_RADIO, // radio button
374 WI_TEXT, // text ctrl
375 WI_CHECK, // check box
376 WI_LINE_H, // static line h
377 WI_LINE_V, // static line v
378 WI_STATICTEXT, // static text
379 WI_SPACER // spacer item (not really a window)
382 virtual ~wxGbWindowItem() {
383 // delete sizer item
384 if(m_sizer != NULL)
385 delete m_sizer;
387 // delete window items
388 for(size_t i = 0; i < m_windowItems.size(); i++)
389 delete m_windowItems[i];
392 // parses the window, returns -1 when an error occured, otherwise
393 // the offset where the next action can take place.
394 int Parse(wxGbParseBuffer &buf);
396 // static method that determines ifthe next item in the buffer
397 // is actually a qualifier for a window item
398 static bool IsWindowQualifier(const wxGbParseBuffer &buf);
400 // return Number
401 size_t GetNumber() const {
402 return m_number;
405 // return the sizer that might be assigned to this window item
406 wxGbSizerItem *GetAssignedSizer() {
407 return m_sizer;
410 // returns type of the window
411 int GetWindowType() const {
412 return m_windowType;
415 // returns window handle
416 wxWindow *GetWindow() const {
417 return m_wnd;
420 // assigns the window element
421 void AssignWindow(wxWindow *wnd) {
422 m_wnd = wnd;
425 // get height of the window which should be the value of m_height
426 int GetHeight() const {
427 return m_height;
430 // get width of the window which should be the value of m_width
431 int GetWidth() const {
432 return m_width;
435 // a method to verify the contents if
436 // everything is set up allright
437 virtual bool Verify(wxGbBaseItem *item);
439 // realize function to get a wxWindow object back for adding it to the sizer
440 wxWindow *RealizeWindow(wxGuiBuilder &owner, wxWindow *parent);
442 // add to lookup list
443 virtual void AddToLookup(std::vector<wxGbBaseItem *> &list);
445 private:
446 void DoCreateWindow(wxGuiBuilder &owner, wxWindow *parent);
448 // attempts a parsing of a substitute element
449 int ParseSubstitute(wxGbParseBuffer &buf);
451 // attempts a parsing of a static text element
452 int ParseStaticText(wxGbParseBuffer &buf);
454 // attempts a parsing of a panel assign element
455 int ParsePanel(wxGbParseBuffer &buf);
457 // attempts to parse a button
458 int ParseButton(wxGbParseBuffer &buf);
460 // attempts to parse a radio
461 int ParseRadioButton(wxGbParseBuffer &buf);
463 // attempt to parse the checkbox
464 int ParseCheckBox(wxGbParseBuffer &buf);
466 // attempt to parse the text ctrl (multi or single line)
467 int ParseTextCtrl(wxGbParseBuffer &buf);
469 // attempt to parse a static line
470 int ParseSpecial(wxGbParseBuffer &buf);
472 // attempt to parse a tabsheet
473 int ParseTabsheet(wxGbParseBuffer &buf);
475 // reset type in case parsing of type
476 // fails we know about it
477 void ResetType() {
478 m_windowType = WI_UNKNOWN;
480 // we still set to zero here, also non owned control
481 // pointers should be reset in this stage
482 m_id = wxID_ANY;
483 m_wnd = 0;
484 m_sizer = 0;
485 m_caption.Clear();
486 m_checked = false;
487 m_multiLine = false; // single text ctrl
490 // the ID of the item
491 size_t m_number;
492 // window type
493 int m_windowType;
494 // pointer that holds the class, if m_ownMade is true, we created this
495 // class. If not, it is assigned
496 wxWindow *m_wnd;
497 // the only sizer allowed to be added to this panel
498 wxGbSizerItem *m_sizer;
499 // this is a container class for a wxTabSheet. All elements need to be
500 // of a wxSpWindowItem type (preferrably a panel)
501 std::vector<wxGbWindowItem *> m_windowItems;
502 // the ID assigned to this window, if none wxID_ANY is used
503 long m_id;
504 // checked state of the radio or checkbox
505 bool m_checked;
506 // single text ctrl or multi text ctrl
507 bool m_multiLine;
508 // width and height of the entity, only used for spacers at the moment
509 int m_width, m_height;
512 #endif // _NO_DOXYGEN_
514 /** \brief Internal class. Do not use this class unless you wish to extend wxGuiBuilder with extra classes to register.
516 This class is used by wxGuiBuilder to inherit classes from that are used to assign window properties to the substitute windows.
518 class wxGbRegWindowBase
520 public:
521 /** Copy operator to make a deep copy of the regwindow class that is passed along */
522 void operator=(const wxGbRegWindowBase &rw) {
523 m_label = rw.m_label;
524 m_size = rw.m_size;
525 m_style = rw.m_style;
526 m_ptr = rw.m_ptr;
527 m_id = rw.m_id;
530 /** Destructor */
531 virtual ~wxGbRegWindowBase() {
534 /** Returns assigned label. The label is given to link a GUI element from wxGuiBuilder to a
535 pointer-pointer, window styles, position or ID */
536 const wxString &GetLabel() const {
537 return m_label;
540 /** returns the ID of this item. The ID is the window ID that is used to assign to the created
541 GUI control. */
542 long GetId() const {
543 return m_id;
546 /** Returns the window style assigned to this item. The style is a long which is totally
547 independent of the wxWindow it is assigned to. If the style remains 0, wxGuiBuilder
548 will not include this style in window creation, but instead will take the default
549 style that is used if the style parameter is omitted in the GUI control creation */
550 long GetStyle() const {
551 return m_style;
554 /** Returns the associated size. By default the wxDefaultSize is taken, which is passing
555 a parameter of (-1,-1) to let the control determine the size. If another size is given
556 then the default size, the control that is created by wxGuiBuilder will inform the
557 sizer system that the minimal initial size is different then the default size */
558 const wxSize &GetSize() const {
559 return m_size;
562 #ifndef _NO_DOXYGEN_
563 /** Needs to be overridden to set the pointer to the internal wxGbWindowItem which is
564 created by wxGuiBuilder */
565 virtual bool SetPointer(wxGbWindowItem *w) = 0;
567 protected:
568 wxGbRegWindowBase(const wxString &label, void **ptr, long id, const wxSize &size, long style)
569 : m_label(label)
570 , m_size(size)
571 , m_style(style)
572 , m_id(id)
573 , m_ptr(ptr)
575 if(ptr != NULL)
576 (*ptr) = NULL;
579 wxGbRegWindowBase(const wxGbRegWindowBase &rwb) {
580 (*this) = rwb;
583 wxString m_label;
584 wxSize m_size;
585 long m_style;
586 long m_id;
587 void **m_ptr;
588 #endif
591 #define WX_GB_DECLARE_REGWINDOW(gbwin, wxctrl) \
592 class gbwin : public wxGbRegWindowBase \
594 public: \
595 gbwin(const wxString &label, wxctrl **item, long id = wxID_ANY, \
596 const wxSize &size = wxDefaultSize, long style = 0) \
597 : wxGbRegWindowBase(label, (void **)item, id, size, style) \
599 }; \
601 gbwin(const gbwin &item) \
602 : wxGbRegWindowBase(item) \
604 }; \
606 virtual bool SetPointer(wxGbWindowItem *w) { \
607 if(m_ptr != NULL) \
609 wxctrl *item = dynamic_cast<wxctrl *>(w->GetWindow()); \
610 (*m_ptr) = item; \
611 return item != NULL; \
613 return true; \
614 }; \
617 /** \brief The class that needs to be passed to wxGuiBuilder when you used substitute windows.
619 The wxGbWindowStub class needs to be passed to wxGuiBuilder via the register command or
620 with the operator<<(const wxGbWindowStub &) when you are using $1 ... $x references in your
621 code. Window stubs are needed when the wxWindow derived class is not supported by wxGuiBuilder
622 or you created an own foreign window. Consider the following example:
624 \code
625 wxGuiBuilder gb("H{ 'Select your data' $1 $2 }");
627 wxChoice *my_choices = new wxChoice(this, -1);
628 my_choices->Append("Choice 1");
629 my_choices->Append("Choice 2");
631 // now tell wxGuiBuilder that the wxChoice needs to be substituted
632 gb << wxGbWindowStub(1, my_choices);
634 // add a button
635 gb << wxGbWindowStub(2, new wxButton(this, ID_CLICKME, "Click Me"));
637 if(gb.Build(this))
639 // now your dialog is realized with the use of
640 // a wxChoice and a text in a horizontal sizer.
641 this->SetSizerAndFit(gb.GetSizer());
644 \endcode
646 The substitute class needs an ID which needs to match the number following the $ (in this case 1)
647 and a wxWindow pointer. The wxWindow needs to be created as child of the parent window the sizer
648 will be assigned to. If a sub panel or notebook will become the new parent of the substitute
649 it will be reparented internally.
651 See also \ref grm_substitute .
653 class wxGbWindowStub : public wxGbRegWindowBase
655 public:
656 /** Use this class construction to pass the ID of the substitute in question to wxGuiBuilder. The ID
657 is the number following the $, like $1 or $2. The wxWindow will be positioned and reparented
658 if needed to fit in the GUI. This class is copied internally so it is safe to pass it on
659 the stack, no need to create it on the heap */
660 wxGbWindowStub(int id, wxWindow *window)
661 : wxGbRegWindowBase(wxEmptyString, NULL, id, wxDefaultSize, 0)
662 , m_wnd(window)
666 #ifndef _NO_DOXYGEN_
667 /** Copy constructor, only for internal use */
668 wxGbWindowStub(const wxGbWindowStub &src)
669 : wxGbRegWindowBase(src)
671 m_wnd = src.m_wnd;
674 ~wxGbWindowStub() {
677 void operator=(const wxGbWindowStub &src) {
678 (*(wxGbRegWindowBase *)this) = src;
679 m_wnd = src.m_wnd;
682 virtual bool SetPointer(wxGbWindowItem *w) {
683 return true;
686 int GetId() const {
687 return m_id;
690 wxWindow *GetWindow() const {
691 return m_wnd;
694 private:
695 wxWindow *m_wnd;
696 #endif
699 /** \class wxGbButton
700 \brief Pass this class to wxGuiBuilder to retrieve the pointer of the created wxButton, assign it a fixed ID, style or size.
702 The wxGbButton class needs to be passed to wxGuiBuilder to retrieve a pointer to your wxButton, or when you wish to assign
703 it extra button styles, or define a fixed size.
705 Consider the following example:
707 \code
709 wxGuiBuilder gb("H{ 'Press button A' ['A']:but_a }");
711 gb << wxGbButton(wxT("but_a"), &m_button_a, ID_BUTTON_A, wxSize(10,20), wxNO_BORDER);
713 if(gb.Build(this))
715 SetSizerAndFit(gb.GetSizer());
717 // TODO:
720 \endcode
722 See also \ref gb_refs and \ref grm_button
724 WX_GB_DECLARE_REGWINDOW(wxGbButton, wxButton);
726 /** \class wxGbTextCtrl
727 \brief Pass this class to wxGuiBuilder to retrieve the pointer of the created wxTextCtr, assign it a fixed ID, style or size.
729 The wxGbTextCtrl class needs to be passed to wxGuiBuilder to retrieve a pointer to your wxTextCtrl, or when you wish to assign it extra button styles, or define a fixed size.
731 Consider the following example:
733 \code
735 wxGuiBuilder gb("H{ 'Enter text' [--------------]:text }");
737 gb << wxGbTextCtrl(wxT("text"), &m_myText, ID_TEXT_CTRL, wxDefaultSize, wxTE_READONLY);
739 if(gb.Build(this))
741 SetSizerAndFit(gb.GetSizer());
743 // set the text
744 m_myText->SetValue("Hello there!");
747 \endcode
749 See also \ref gb_refs and \ref grm_textctrl
751 WX_GB_DECLARE_REGWINDOW(wxGbTextCtrl, wxTextCtrl);
753 /** \class wxGbStaticText
754 \brief Pass this class to wxGuiBuilder to retrieve the pointer of the created wxStaticText, assign it a fixed ID, style or size.
756 The wxGbStaticText class needs to be passed to wxGuiBuilder to retrieve a pointer to your wxStaticText, or when you wish to assign it extra styles, or define a fixed size.
758 Consider the following example:
760 \code
762 wxGuiBuilder gb("H{ 'Status:' '-status-':stat }");
764 gb << wxGbTextCtrl(wxT("stat"), &m_myStatus, wxID_ANY, wxDefaultSize, wxSIMPLE_BORDER);
766 if(gb.Build(this))
768 SetSizerAndFit(gb.GetSizer());
770 // set status
771 m_myStatus->SetLabel(wxT("Status READY!"));
774 \endcode
776 See also \ref gb_refs and \ref grm_statictext
778 WX_GB_DECLARE_REGWINDOW(wxGbStaticText, wxStaticText);
780 /** \class wxGbRadioButton
781 \brief Pass this class to wxGuiBuilder to retrieve the pointer of the created wxRadioButton, assign it a fixed ID, style or size.
783 The wxGbRadioButton class needs to be passed to wxGuiBuilder to retrieve a pointer to your wxRadioButton, or when you wish to assign it extra styles, or define a fixed size.
785 Consider the following example:
787 \code
789 wxGuiBuilder gb("H{ 'Choose:' ( ) 'Option 1':opt1 "
790 " (*) 'Option 2':opt2 }");
792 gb << wxGbRadioButton(wxT("opt1"), &m_opt1, ID_OPTION1);
793 gb << wxGbRadioButton(wxT("opt2"), &m_opt2, ID_OPTION2);
795 if(gb.Build(this))
797 SetSizerAndFit(gb.GetSizer());
799 // hook up events
800 this->Connect(ID_OPTION1, wxEVT_COMMAND_RADIOBOX_SELECTED,
801 wxCommandEventHandler(ThisDlg::OnRadio));
802 this->Connect(ID_OPTION2, wxEVT_COMMAND_RADIOBOX_SELECTED,
803 wxCommandEventHandler(ThisDlg::OnRadio));
806 \endcode
808 For the event handler:
810 \code
811 void ThisDlg::OnRadio(wxCommandEvent &event)
813 // toggle radio buttons opposite
814 if(event.GetId() == ID_OPTION1)
815 m_opt2->SetValue(true);
816 else if(event.GetId() == ID_OPTION2)
817 m_opt1->SetValue(true);
820 \endcode
822 See also \ref gb_refs and \ref grm_radiobutton
824 WX_GB_DECLARE_REGWINDOW(wxGbRadioButton, wxRadioButton);
826 /** \class wxGbCheckBox
827 \brief Pass this class to wxGuiBuilder to retrieve the pointer of the created wxCheckBox, assign it a fixed ID, style or size.
829 The wxGbCheckBox class needs to be passed to wxGuiBuilder to retrieve a pointer to your wxCheckBox, or when you wish to assign it extra styles, or define a fixed size.
831 Consider the following example:
833 \code
835 wxGuiBuilder gb("H{ 'Choose:' [ ] 'Option 1':opt1 "
836 " [X] 'Option 2':opt2 }");
838 gb << wxGbCheckBox(wxT("opt1"), &m_opt1, ID_OPTION1);
839 gb << wxGbCheckBox(wxT("opt2"), &m_opt2, ID_OPTION2);
841 if(gb.Build(this))
843 SetSizerAndFit(gb.GetSizer());
845 // hook up events
846 this->Connect(ID_OPTION1, wxEVT_COMMAND_CHECKBOX_CLICKED,
847 wxCommandEventHandler(ThisDlg::OnCheck));
848 this->Connect(ID_OPTION2, wxEVT_COMMAND_CHECKBOX_CLICKED,
849 wxCommandEventHandler(ThisDlg::OnCheck));
852 \endcode
854 For the event handler:
856 \code
857 void ThisDlg::OnCheck(wxCommandEvent &event)
859 // toggle check boxes opposite
860 if(event.GetId() == ID_OPTION1)
862 m_opt1->SetValue(false);
863 m_opt2->SetValue(true);
865 else if(event.GetId() == ID_OPTION2)
867 m_opt2->SetValue(false);
868 m_opt1->SetValue(true);
871 \endcode
873 See also \ref gb_refs and \ref grm_checkbox
875 WX_GB_DECLARE_REGWINDOW(wxGbCheckBox, wxCheckBox);
877 /** \class wxGbPanel
878 \brief Pass this class to wxGuiBuilder to retrieve the pointer of the created wxPanel, assign it a fixed ID, style or size.
880 The wxGbPanel class needs to be passed to wxGuiBuilder to retrieve a pointer to your wxPanel, or when you wish to assign it extra styles, or define a fixed size.
882 Consider the following example:
884 \code
886 wxGuiBuilder gb("H{ "
887 " #:pnl=V{ "
888 " 'Set background color of wxPanel' "
889 " H{ ['Black']:blk ['White']:wht } "
890 " } "
891 " } ");
893 // give panel a border, and a fixed size of 300,300
894 gb << wxGbPanel("pnl", &m_myPanel, wxID_ANY, wxSize(300,300), wxSIMPLE_BORDER);
896 // get the buttons to assign events
897 gb << wxGbButton("blk", &m_blackBut);
898 gb << wxGbButton("wht", &m_whiteBut);
900 if(gb.Build(this))
902 SetSizerAndFit(gb.GetSizer());
904 // hook up events
905 this->Connect(m_blackBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
906 wxCommandEventHandler(MyDialog::OnBlackClick));
907 this->Connect(m_whiteBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,
908 wxCommandEventHandler(MyDialog::OnWhiteClick));
911 \endcode
913 For the event handlers:
915 \code
916 void MyDialog::OnBlackClick(wxCommandEvent &event)
918 // make the panel black
919 m_myPanel->SetBackgroundColour(*wxBLACK);
922 void MyDialog::OnWhiteClick(wxCommandEvent &event)
924 // make the panel white
925 m_myPanel->SetBackgroundColour(*wxWHITE);
928 \endcode
930 See also \ref gb_refs and \ref grm_panel
932 WX_GB_DECLARE_REGWINDOW(wxGbPanel, wxPanel);
934 /** \class wxGbNotebook
935 \brief Pass this class to wxGuiBuilder to retrieve the pointer of the created wxNotebook, assign it a fixed ID, style or size.
937 The wxGbNotebook class needs to be passed to wxGuiBuilder to retrieve a pointer to your wxNotebook, or when you wish to assign it extra styles, or define a fixed size.
939 Consider the following example:
941 \code
943 // simple example how the GUI builder should be used. The
944 // contents is parsed, and all you have to do is set the sizer
945 wxGuiBuilder gb("H{ "
946 " T{ "
947 " #'Page 1'=V{ "
948 " ( ) 'Some option' "
949 " (.) 'Some other option' "
950 " } "
953 " }+,1:nbook "
954 " } ");
956 // get the notebook pointer to eventually add a few pages
957 gb << wxGbNotebook("nbook", &m_notebook);
959 if(gb.Build(this))
961 SetSizerAndFit(gb.GetSizer());
963 // add a page to the notebook
964 wxNotebookPage *page = GetPage();
965 if(page != NULL)
966 m_notebook->AddPage(page, "Another Page");
969 \endcode
971 For the page add code:
973 \code
974 wxNotebookPage *MyDialog::GetPage()
976 wxPanel *pnl = new wxPanel(m_notebook, -1);
978 // another guibuilder instance
979 wxGuiBuilder gb("V{ "
980 " 'Name' "
981 " [------------]"
982 " 'Age' "
983 " [------------]"
984 " } ");
986 if(gb.Build(pnl, wxID_ANY))
987 pnl->SetSizerAndFit(gb.GetSizer());
989 return dynamic_cast<wxNotebookPage *>(pnl);
991 \endcode
993 See also \ref gb_refs and \ref grm_notebook
995 WX_GB_DECLARE_REGWINDOW(wxGbNotebook, wxNotebook);
997 /** \class wxGuiBuilder
998 \brief The main object that parses the given text and creates a GUI with sizers from it
1000 This class produces a wxSizer object after parsing a text. This should provide an alternative to using
1001 sizers directly, but provide at least as much flexibility to allow users to semi-visually design their
1002 forms / panels real quickly using sizers.
1004 It is recommended to read the \ref welcome_gb "main page" for the general purpose of wxGuiBuilder, and
1005 after that the \ref wxgb_controls "wxGuiGuilder grammar" and the \ref gb_refs "substitutes section" to
1006 learn how to change the default looks and flags of the controls that are created.
1008 class wxGuiBuilder
1010 public:
1011 /** Creates a wxGuiBuilder object. This object should most likely be created on the stack. Once the
1012 object loses scope, only the internal structure is deleted, the generated sizers and controls
1013 will not be deleted and stay assigned to the parent that is given during wxGuiBuilder::Build.
1015 Pass the sizer string structure in the \a sizer argument. In UNICODE this must be a multi byte
1016 string, in ANSI it is single byte. The string can be read from disk, or simply copied from a
1017 char array if needed.
1019 See \ref what_gb "a small example" of how this is used.
1021 wxGuiBuilder(const wxString &sizer)
1022 : m_buffer(sizer)
1023 , m_topSizer(0)
1024 , m_startID(0)
1025 , m_lastIndex(0)
1026 , m_flags(0)
1027 , m_sizerType(wxGB_BOXSIZER_H)
1028 , m_workID(wxID_ANY)
1029 , m_realizeError(false)
1030 , m_sizer(NULL)
1031 , m_demoMode(false)
1033 // set default flags
1034 m_defWindowFlags.Center().Border(wxALL, 5);
1035 m_defSizerFlags.Center().Border(wxALL, 5);
1038 #ifndef _NO_DOXYGEN_
1039 friend void SetRealizeError(wxGuiBuilder &owner);
1041 // use this method to change what sizer is used per default if there is no
1042 // sizer specification
1043 void SetSizerDefaults(size_t sizerType = wxGB_BOXSIZER_H,
1044 const wxSizerFlags &flags = wxSizerFlags(0)) {
1045 m_sizerType = sizerType;
1046 m_flags = flags;
1048 #endif
1050 /** The main method. After you created the wxGuiBuilder object, and used the \ref gb_refs "reference classes" to
1051 add extra information on how the windows should be created, call this Build() method to initiate the building
1052 of the GUI.
1054 If you wanted to start the whole sizer with different default window flags or sizer flags, before calling buils
1055 call wxGuiBuilder::SetWindowFlags() or wxGuiBuilder::SetSizerFlags() to influence the start values of the default
1056 sizer flags.
1058 Arguments:
1059 - \a parent is the window the controls that are created will become a child of. This is the same dialog / panel or
1060 other container object you assign the sizer (retrieved with wxGuiBuilder::GetSizer()) to after a succesful build.
1061 It is not certain that all child GUI objects or substitute wxWindow classes will keep the same parent. For
1062 example when a wxNotebook or wxPanel is created inside the wxGuiBuilder, the wxWindow items used inside this
1063 container object will be reparented to belong to the proper parent. This is done automatically.
1064 - \a startID is the ID from which all auto created controls should get their ID from. If wxID_ANY is used, the
1065 internal wxWidgets method ::wxNewId() is used to obtain a new ID for every control. If an ID is given as argument,
1066 all successive classes will get an ID equal to the startID + increment.
1067 - \a recompile can be used to re-use the same wxGuiBuilder string that is passed. The internal data structure is
1068 thrown away, <B>PLEASE BE AWARE</b> that all classes that are NOT auto created are also thrown away. This means
1069 all substitute windows need to be passed again. This is necessary to make sure the same window control is not
1070 re-used between sessions. It is not recommended to recompile. It is more safe to simply recreate a wxGuiBuilder
1071 object and start from scratch.
1073 An example piece of code:
1075 \code
1076 wxGuiBuilder gb(" "
1077 "H{ "
1078 " V'Select some options'{ "
1079 " %w.0a< "
1080 " ( ) 'Generate code on the fly' "
1081 " (.) 'Generate code after saving' "
1083 " [ ] 'Use original file' "
1084 " [ ] 'Use backup file' "
1086 " %w.5lr| "
1087 " H{ <spc:15,0> 'Select your backup file' [----------],1 ['...'] }+"
1088 " }+,1 "
1089 "} ");
1091 if(gb.Build(this, wxID_ANY))
1093 SetSizerAndFit(gb.GetSizer());
1095 // TODO: Initialize your dialog further
1097 \endcode
1099 Will result in this dialog:
1101 \image html dialog_example.png
1103 The error handling of this Build() command goes through wxLogError messages. The messages are very verbose,
1104 and also pinpoint the exact row, column and position inside the text that a syntax error or problem occured.
1105 If this method returns <b>false</b> the build failed. Most usual there are three situations occuring:
1107 <h4>Syntax errors occured</h4>
1108 When syntax errors occur, you are usually presented with a dialog like this:
1110 \image html gb_29.png
1112 The errors propagate. The top error is the most important one, and it goes all the way down to the top sizer
1113 that could not be parsed. It is not recommended to suppress these errors as they are useful in debugging the
1114 GUI markup code.
1116 <h4>Verification errors occured</h4>
1117 This is more serious. There is either something wrong in the code, or in the sizer text. For example when you
1118 define two substitute windows of ID 1 like <b>H{ $1 $1 }</b>. The verification procedure will make sure that
1119 substitute windows are not defined double, if all substitutes have an assigned pointer, if labels are not
1120 defined more then once, if the top sizer has at least one element, etc. The following window will be shown
1121 when verification errors occur:
1123 \image html gb_30.png
1125 <h4>Fatal errors occured</h4>
1126 This is dead serious! When this occurs it is wise to abort your application or close it ASAP. Fatal errors occur
1127 when you passed pointer-pointers to GUI controls like;
1129 \code
1130 gb << wxGbButton("my_button", &m_button);
1131 \endcode
1133 And you rely on the fact that m_button (which is a wxButton *) is filled with a pointer. The fatal error is
1134 presented to you when one or more of those pointers are not set, risking NULL pointer assignments. Fatal errors
1135 look like;
1137 \image html gb_25.png
1139 If YES is chosen, the methog wxLogFatalError() is called and the application is aborted.
1141 bool Build(wxWindow *parent, int startID = wxID_ANY, bool recompile = false);
1143 /** Destructor. Everything is deleted, except all the wxWindow controls that are created or used as substitutes. These
1144 windows are now child of one or more panels and are destroyed when the GUI is destroyed.
1146 <B>IT IS NOT RECOMMENDED</B> to keep wxGuiBuilder as a member variable in your class, as it keeps an internal data
1147 structure which keeps memory occupied for no reason, and re-using it is not recommended to begin with. Always use
1148 this object on the stack
1150 virtual ~wxGuiBuilder() {
1151 Reset();
1153 for(size_t i = 0; i < m_regitems.size(); i++)
1154 delete m_regitems[i];
1155 m_regitems.clear();
1158 /** After the wxGuiBuilder::Build() action returns <b>true</b> the wxSizer that needs to be assigned can be retrieved
1159 from this method. When <b>false</b> is returned, this method returns a NULL sizer. */
1160 wxSizer *GetSizer() {
1161 return m_sizer;
1164 #ifndef _NO_DOXYGEN_
1165 // method that returns a new ID to be used. If the work ID is wxID_ANY
1166 // we define one ourselves, if the ID has another value, we return and
1167 // increment
1168 long RequestID(const wxString &label);
1170 // request style and size
1171 bool RequestWindowParams(const wxString &label, long &style, wxSize &size);
1172 #endif
1174 /** Sets default window flags. Set this function BEFORE you call the Build function. All windows created
1175 will carry at least these flags, until they are overridden by another flags set. The default
1176 window flags are:
1178 - Border of 5
1179 - Centered in the area given
1181 See wxSizerFlags in the wxWidgets documentation for more information.
1183 void SetWindowFlags(wxSizerFlags &flags) {
1184 m_defWindowFlags = flags;
1186 /** Sets default sizer flags. Set this function BEFORE you call the Build function. All sizers created will
1187 carry at least these flags, until they are overridden by another flags set. The default sizer flags are:
1189 - Border of 5
1190 - Centred in the area given
1192 void SetSizerFlags(wxSizerFlags &flags) {
1193 m_defSizerFlags = flags;
1196 /** Registers a wxGbButton class that carries either a pointer-pointer, wxWindow ID, size or flags to the wxButton to
1197 be created. By using a label in the GUI text, the wxGbButton reference is linked to the control to be created.
1199 Also see operator<<(const wxGbButton &) which is a convenience operator and works easier.
1201 \sa wxGbButton
1203 bool Register(const wxGbButton &button) {
1204 if(!CanRegister(button))
1205 return false;
1206 m_regitems.push_back(new wxGbButton(button));
1207 return true;
1210 /** Registers a wxGbTextCtrl class that carries either a pointer-pointer, wxWindow ID, size or flags to the wxTextCtrl to
1211 be created. By using a label in the GUI text, the wxGbTextCtrl reference is linked to the control to be created.
1213 Also see operator<<(const wxGbTextCtrl &) which is a convenience operator and works easier.
1215 \sa wxGbTextCtrl
1217 bool Register(const wxGbTextCtrl &text) {
1218 if(!CanRegister(text))
1219 return false;
1220 m_regitems.push_back(new wxGbTextCtrl(text));
1221 return true;
1224 /** Registers a wxGbRadioButton class that carries either a pointer-pointer, wxWindow ID, size or flags to the
1225 wxRadioButton to be created. By using a label in the GUI text, the wxGbRadioButton reference is linked to
1226 the control to be created.
1228 Also see operator<<(const wxGbRadioButton &) which is a convenience operator and works easier.
1230 \sa wxGbRadioButton
1232 bool Register(const wxGbRadioButton &rb) {
1233 if(!CanRegister(rb))
1234 return false;
1235 m_regitems.push_back(new wxGbRadioButton(rb));
1236 return true;
1239 /** Registers a wxGbCheckBox class that carries either a pointer-pointer, wxWindow ID, size or flags to the
1240 wxCheckBox to be created. By using a label in the GUI text, the wxGbCheckBox reference is linked to
1241 the control to be created.
1243 Also see operator<<(const wxGbCheckBox &) which is a convenience operator and works easier.
1245 \sa wxGbCheckBox
1247 bool Register(const wxGbCheckBox &cb) {
1248 if(!CanRegister(cb))
1249 return false;
1250 m_regitems.push_back(new wxGbCheckBox(cb));
1251 return true;
1254 /** Registers a wxGbStaticText class that carries either a pointer-pointer, wxWindow ID, size or flags to the
1255 wxStaticText to be created. By using a label in the GUI text, the wxGbStaticText reference is linked to
1256 the control to be created.
1258 Also see operator<<(const wxGbStaticText &) which is a convenience operator and works easier.
1260 \sa wxGbStaticText
1262 bool Register(const wxGbStaticText &st) {
1263 if(!CanRegister(st))
1264 return false;
1265 m_regitems.push_back(new wxGbStaticText(st));
1266 return true;
1269 /** Registers a wxGbPanel class that carries either a pointer-pointer, wxWindow ID, size or flags to the
1270 wxPanel to be created. By using a label in the GUI text, the wxGbPanel reference is linked to
1271 the control to be created.
1273 Also see operator<<(const wxGbPanel &) which is a convenience operator and works easier.
1275 \sa wxGbPanel
1277 bool Register(const wxGbPanel &st) {
1278 if(!CanRegister(st))
1279 return false;
1280 m_regitems.push_back(new wxGbPanel(st));
1281 return true;
1284 /** Registers a wxGbNotebook class that carries either a pointer-pointer, wxWindow ID, size or flags to the
1285 wxNotebook to be created. By using a label in the GUI text, the wxGbNotebook reference is linked to
1286 the control to be created.
1288 Also see operator<<(const wxGbNotebook &) which is a convenience operator and works easier.
1290 \sa wxGbNotebook
1292 bool Register(const wxGbNotebook &st) {
1293 if(!CanRegister(st))
1294 return false;
1295 m_regitems.push_back(new wxGbNotebook(st));
1296 return true;
1299 /** Registers an existing wxWindow derived class to take the place in the stub assigned
1300 with the ID. If the window ID already exists an error is thrown. The stubs will
1301 be filled in and reparented (if needed) once the GUI is built by wxGuiBuilder
1303 \sa wxGbWindowStub
1305 bool Register(const wxGbWindowStub &item) {
1306 if(!CanRegister(item))
1307 return false;
1308 m_regitems.push_back(new wxGbWindowStub(item));
1309 return true;
1312 /** Registers an existing wxWindow derived class to take the place in the stub assigned
1313 with the ID. If the window ID already exists an error is thrown. The stubs will
1314 be filled in and reparented (if needed) once the GUI is built by wxGuiBuilder
1316 This version does not use a class but only an \a id and \a window pointer.
1317 See more information at \ref gb_refs .
1319 bool Register(int id, wxWindow *window) {
1320 wxGbWindowStub st(id, window);
1321 return Register(st);
1324 /** Convenience operator for wxGbPanel. See wxGuiBuilder::Register(const wxGbPanel &)
1325 for more information. */
1326 wxGuiBuilder &operator<<(const wxGbPanel &item) {
1327 Register(item);
1328 return (*this);
1331 /** Convenience operator for wxGbButton. See wxGuiBuilder::Register(const wxGbButton &)
1332 for more information. */
1333 wxGuiBuilder &operator<<(const wxGbButton &item) {
1334 Register(item);
1335 return (*this);
1338 /** Convenience operator for wxGbTextCtrl. See wxGuiBuilder::Register(const wxGbTextCtrl &)
1339 for more information. */
1340 wxGuiBuilder &operator<<(const wxGbTextCtrl &item) {
1341 Register(item);
1342 return (*this);
1345 /** Convenience operator for wxGbCheckBox. See wxGuiBuilder::Register(const wxGbCheckBox &)
1346 for more information. */
1347 wxGuiBuilder &operator<<(const wxGbCheckBox &item) {
1348 Register(item);
1349 return (*this);
1352 /** Convenience operator for wxGbRadioButton. See wxGuiBuilder::Register(const wxGbRadioButton &)
1353 for more information. */
1354 wxGuiBuilder &operator<<(const wxGbRadioButton &item) {
1355 Register(item);
1356 return (*this);
1359 /** Convenience operator for wxGbStaticText. See wxGuiBuilder::Register(const wxGbStaticText &)
1360 for more information. */
1361 wxGuiBuilder &operator<<(const wxGbStaticText &item) {
1362 Register(item);
1363 return (*this);
1366 /** Convenience operator for wxGbNotebook. See wxGuiBuilder::Register(const wxGbNotebook &)
1367 for more information. */
1368 wxGuiBuilder &operator<<(const wxGbNotebook &item) {
1369 Register(item);
1370 return (*this);
1373 /** Convenience operator for wxGbWindowStub. See wxGuiBuilder::Register(const wxGbWindowStub &)
1374 for more information. */
1375 wxGuiBuilder &operator<<(const wxGbWindowStub &item) {
1376 Register(item);
1377 return (*this);
1380 /** This method will auto create substitute windows ($1, $2 etc) so that the verification after the
1381 build will not fail. This is only for demo purposes when code that is shown does not have the
1382 ability to set substitute windows
1384 void SetDemoMode() {
1385 m_demoMode = true;
1388 #ifndef _USE_DOXYGEN_
1389 private:
1390 /** Maps all registered controls to the proper pointers. If after mapping some pointers
1391 are still NULL, false is returned. This will allow the user to take measures like
1392 raising an assertion. */
1393 void MapControlPointers();
1395 // demo mode lookup assigning
1396 void DoDemoMode(wxWindow *parent);
1398 // sets error flag, so the Realize method knows something
1399 // went wrong (if not shown in release mode)
1400 void SetErrorFlag() {
1401 m_realizeError = true;
1404 // clean up sizer and unassign it
1405 void Reset();
1407 // method that parses and compiles the sizer to give back the sizer
1408 // pointer of the top sizer containing the layout
1409 bool Compile();
1411 // creates a flat list of window and sizer items, easy to quickly
1412 // scan through
1413 void FillLookupList(wxGbSizerItem *si);
1415 // A function to check for the list integrity, which means
1416 // no double labels, or double subsititute ID's, window ID's etc
1417 bool VerifyLookupList();
1419 wxGbWindowItem *DoFindWindowByLabel(const wxString &label);
1421 bool CanRegister(const wxGbRegWindowBase &item);
1423 // lookup table with all added window items, for quick ID lookup
1424 // it will be one time composed, and when the window items should be
1425 // added this list can help determining ID's and if there is already
1426 // a window attached to it.
1427 std::vector<wxGbBaseItem *> m_lookup;
1428 // items that are registered to be written to in the method MapControls
1429 // which will write to all given pointer pointers.
1430 std::vector<wxGbRegWindowBase *> m_regitems;
1431 // buffer of the sizer
1432 wxString m_buffer;
1433 // the starting sizer
1434 wxGbSizerItem *m_topSizer;
1435 // start ID
1436 long m_startID;
1437 // the index last used, which means when operator<< is used to slide in
1438 // ready created controls, the last count is used to look up that particular
1439 // item
1440 size_t m_lastIndex;
1441 // default sizer flags
1442 wxSizerFlags m_flags;
1443 // default sizer type to take if none is defined
1444 size_t m_sizerType;
1445 // ID for next control
1446 long m_workID;
1447 // error in realize procedure
1448 bool m_realizeError;
1449 // default window flags, e.g. with a border or alligned a certain way
1450 wxSizerFlags m_defWindowFlags;
1451 // default sizer flags, e.g. with a border or alligned a certain way
1452 wxSizerFlags m_defSizerFlags;
1453 // the sizer that is returned
1454 wxSizer *m_sizer;
1455 // the demo mode
1456 bool m_demoMode;
1457 #endif // _USE_DOXYGEN_
1460 #endif