00001 // $Id: xh_treebook.h 1089 2006-05-16 17:57:54Z alex $ 00002 /* @@tag:xara-cn-tp@@ THIRD PARTY COPYRIGHT */ 00003 // The following line makes normalize.pl skip type fixing 00004 /* SKIPFIXTYPES: START */ 00005 00007 // Name: xh_treebk.h 00008 // Purpose: XML resource handler for wxTreebook 00009 // Author: Evgeniy Tarassov 00010 // Created: 2005/09/28 00011 // Copyright: (c) 2005 TT-Solutions <vadim@tt-solutions.com> 00012 // Licence: wxWindows licence 00014 00015 #ifndef _WXXTRA_XH_TREEBK_H_ 00016 #define _WXXTRA_XH_TREEBK_H_ 00017 00018 #include "treebook.h" 00019 00020 #if wxXTRA_TREEBOOK 00021 00022 #include <wx/xrc/xmlres.h> 00023 #include <wx/dynarray.h> 00024 00025 WX_DEFINE_USER_EXPORTED_ARRAY_SIZE_T(size_t, wxArrayTbkPageIndexes, 00026 class WXDLLIMPEXP_XRC); 00027 00028 // --------------------------------------------------------------------- 00029 // wxTreebookXmlHandler class 00030 // --------------------------------------------------------------------- 00031 // Resource xml structure have to be almost the "same" as for wxNotebook 00032 // except the additional (size_t)depth parameter for treebookpage nodes 00033 // which indicates the depth of the page in the tree. 00034 // There is only one logical constraint on this parameter : 00035 // it cannot be greater than the previous page depth plus one 00036 class WXDLLIMPEXP_XRC wxTreebookXmlHandler : public wxXmlResourceHandler 00037 { 00038 public: 00039 wxTreebookXmlHandler(); 00040 virtual wxObject *DoCreateResource(); 00041 virtual bool CanHandle(wxXmlNode *node); 00042 00043 private: 00044 wxTreebook *m_tbk; 00045 wxArrayTbkPageIndexes m_treeContext; 00046 bool m_isInside; 00047 00048 DECLARE_DYNAMIC_CLASS(wxTreebookXmlHandler) 00049 }; 00050 00051 00052 // Example: 00053 // ------- 00054 // Label 00055 // \--First 00056 // | \--Second 00057 // \--Third 00058 // 00059 //<resource> 00060 // ... 00061 // <object class="wxTreebook"> 00062 // <object class="treebookpage"> 00063 // <object class="wxWindow" /> 00064 // <label>My first page</label> 00065 // <depth>0</depth> 00066 // </object> 00067 // <object class="treebookpage"> 00068 // <object class="wxWindow" /> 00069 // <label>First</label> 00070 // <depth>1</depth> 00071 // </object> 00072 // <object class="treebookpage"> 00073 // <object class="wxWindow" /> 00074 // <label>Second</label> 00075 // <depth>2</depth> 00076 // </object> 00077 // <object class="treebookpage"> 00078 // <object class="wxWindow" /> 00079 // <label>Third</label> 00080 // <depth>1</depth> 00081 // </object> 00082 // </object> 00083 // ... 00084 //</resource> 00085 00086 #endif // wxXTRA_TREEBOOK 00087 00088 #endif // _WX_XH_TREEBK_H_ 00089