Debian Codegraph @

wxcrafter/xrc_handlers/myxh_treebk.h

raw
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/xrc/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 <[email protected]>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_MYXH_TREEBK_H_
11 #define _WX_MYXH_TREEBK_H_
12
13 #include <wx/xrc/xmlres.h>
14
15 #if wxUSE_XRC && wxUSE_TREEBOOK
16
17 class WXDLLIMPEXP_FWD_CORE wxTreebook;
18 #include "wx/dynarray.h"
19
20 WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(size_t, wxArrayTbkPageIndexes, class WXDLLIMPEXP_XRC);
21
22 // ---------------------------------------------------------------------
23 // MYwxTreebookXmlHandler class
24 // ---------------------------------------------------------------------
25 // Resource xml structure have to be almost the "same" as for wxNotebook
26 // except the additional (size_t)depth parameter for treebookpage nodes
27 // which indicates the depth of the page in the tree.
28 // There is only one logical constraint on this parameter :
29 // it cannot be greater than the previous page depth plus one
30 class MYwxTreebookXmlHandler : public wxXmlResourceHandler
31 {
32 public:
33 MYwxTreebookXmlHandler();
34 virtual wxObject* DoCreateResource();
35 virtual bool CanHandle(wxXmlNode* node);
36
37 private:
38 wxTreebook* m_tbk;
39 wxArrayTbkPageIndexes m_treeContext;
40 bool m_isInside;
41 };
42
43 // Example:
44 // -------
45 // Label
46 // \--First
47 // | \--Second
48 // \--Third
49 //
50 //<resource>
51 // ...
52 // <object class="wxTreebook">
53 // <object class="treebookpage">
54 // <object class="wxWindow" />
55 // <label>My first page</label>
56 // <depth>0</depth>
57 // </object>
58 // <object class="treebookpage">
59 // <object class="wxWindow" />
60 // <label>First</label>
61 // <depth>1</depth>
62 // </object>
63 // <object class="treebookpage">
64 // <object class="wxWindow" />
65 // <label>Second</label>
66 // <depth>2</depth>
67 // </object>
68 // <object class="treebookpage">
69 // <object class="wxWindow" />
70 // <label>Third</label>
71 // <depth>1</depth>
72 // </object>
73 // </object>
74 // ...
75 //</resource>
76
77 #endif // wxUSE_XRC && wxUSE_TREEBOOK
78
79 #endif // _WX_XH_TREEBK_H_