xh_treebk.h 2.3 KB

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