]> git.saurik.com Git - wxWidgets.git/blob - include/wx/xrc/xh_treebk.h
wxMGL revitalised with OpenWatcom.
[wxWidgets.git] / include / wx / xrc / xh_treebk.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_treebk.h
3 // Purpose: XML resource handler for wxTreebook
4 // Author: Evgeniy Tarassov
5 // Created: 2005/09/28
6 // Copyright: (c) 2005 TT-Solutions <vadim@tt-solutions.com>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_XH_TREEBK_H_
11 #define _WX_XH_TREEBK_H_
12
13 #include "wx/xrc/xmlres.h"
14
15 #if wxUSE_TREEBOOK
16
17 #include "wx/treebook.h"
18 #include "wx/dynarray.h"
19
20 WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(size_t, wxArrayTbkPageIndexes,
21 class WXDLLIMPEXP_XRC);
22
23 // ---------------------------------------------------------------------
24 // wxTreebookXmlHandler class
25 // ---------------------------------------------------------------------
26 // Resource xml structure have to be almost the "same" as for wxNotebook
27 // except the additional (size_t)depth parameter for treebookpage nodes
28 // which indicates the depth of the page in the tree.
29 // There is only one logical constraint on this parameter :
30 // it cannot be greater than the previous page depth plus one
31 class WXDLLIMPEXP_XRC wxTreebookXmlHandler : public wxXmlResourceHandler
32 {
33 public:
34 wxTreebookXmlHandler();
35 virtual wxObject *DoCreateResource();
36 virtual bool CanHandle(wxXmlNode *node);
37
38 private:
39 wxTreebook *m_tbk;
40 wxArrayTbkPageIndexes m_treeContext;
41 bool m_isInside;
42
43 DECLARE_DYNAMIC_CLASS(wxTreebookXmlHandler)
44 };
45
46
47 // Example:
48 // -------
49 // Label
50 // \--First
51 // | \--Second
52 // \--Third
53 //
54 //<resource>
55 // ...
56 // <object class="wxTreebook">
57 // <object class="treebookpage">
58 // <object class="wxWindow" />
59 // <label>My first page</label>
60 // <depth>0</depth>
61 // </object>
62 // <object class="treebookpage">
63 // <object class="wxWindow" />
64 // <label>First</label>
65 // <depth>1</depth>
66 // </object>
67 // <object class="treebookpage">
68 // <object class="wxWindow" />
69 // <label>Second</label>
70 // <depth>2</depth>
71 // </object>
72 // <object class="treebookpage">
73 // <object class="wxWindow" />
74 // <label>Third</label>
75 // <depth>1</depth>
76 // </object>
77 // </object>
78 // ...
79 //</resource>
80
81 #endif // wxUSE_TREEBOOK
82
83 #endif // _WX_XH_TREEBK_H_
84