]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/treebook.h
Return wxFONTFAMILY_DEFAULT, not UNKNOWN, from wxFont::GetFamily().
[wxWidgets.git] / interface / wx / treebook.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: treebook.h
3e97a905 3// Purpose: interface of wxTreebook
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
23324ae1
FM
9/**
10 @class wxTreebook
7c913512 11
7977b62a
BP
12 This class is an extension of the wxNotebook class that allows a tree
13 structured set of pages to be shown in a control. A classic example is a
14 netscape preferences dialog that shows a tree of preference sections on
15 the left and select section page on the right.
7c913512 16
23324ae1 17 To use the class simply create it and populate with pages using
7977b62a
BP
18 InsertPage(), InsertSubPage(), AddPage(), AddSubPage().
19
20 If your tree is no more than 1 level in depth then you could simply use
21 AddPage() and AddSubPage() to sequentially populate your tree by adding at
22 every step a page or a subpage to the end of the tree.
23
3051a44a 24 @beginEventEmissionTable{wxBookCtrlEvent}
7977b62a 25 @event{EVT_TREEBOOK_PAGE_CHANGED(id, func)}
340e9651
FM
26 The page selection was changed.
27 Processes a @c wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event.
7977b62a 28 @event{EVT_TREEBOOK_PAGE_CHANGING(id, func)}
340e9651
FM
29 The page selection is about to be changed.
30 Processes a @c wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING event.
31 This event can be @ref wxNotifyEvent::Veto() "vetoed".
7977b62a 32 @event{EVT_TREEBOOK_NODE_COLLAPSED(id, func)}
340e9651
FM
33 The page node is going to be collapsed.
34 Processes a @c wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED event.
7977b62a 35 @event{EVT_TREEBOOK_NODE_EXPANDED(id, func)}
340e9651
FM
36 The page node is going to be expanded.
37 Processes a @c wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED event.
7977b62a 38 @endEventTable
7c913512 39
23324ae1 40 @library{wxcore}
3c99e2fd 41 @category{bookctrl}
7c913512 42
3e97a905 43 @see wxBookCtrl, wxBookCtrlEvent, wxNotebook, wxTreeCtrl, wxImageList,
7977b62a 44 @ref overview_bookctrl, @ref page_samples_notebook
23324ae1 45*/
7977b62a 46class wxTreebook : public wxBookCtrlBase
23324ae1
FM
47{
48public:
23324ae1 49 /**
7977b62a
BP
50 Default constructor.
51 */
52 wxTreebook();
53
54 /**
55 Creates an empty wxTreebook.
3c4f71cc 56
7c913512 57 @param parent
4cc4bfaf 58 The parent window. Must be non-@NULL.
7c913512 59 @param id
4cc4bfaf 60 The window identifier.
7c913512 61 @param pos
4cc4bfaf 62 The window position.
7c913512 63 @param size
4cc4bfaf 64 The window size.
7c913512 65 @param style
4cc4bfaf 66 The window style. See wxNotebook.
7c913512 67 @param name
4cc4bfaf 68 The name of the control (used only under Motif).
23324ae1 69 */
7c913512
FM
70 wxTreebook(wxWindow* parent, wxWindowID id,
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
bfb6fde3 73 long style = wxBK_DEFAULT,
7c913512 74 const wxString& name = wxEmptyString);
23324ae1
FM
75
76 /**
340e9651
FM
77 Destroys the wxTreebook object.
78 Also deletes all the pages owned by the control (inserted previously into it).
23324ae1 79 */
adaaa686 80 virtual ~wxTreebook();
23324ae1
FM
81
82 /**
7977b62a
BP
83 Adds a new page. The page is placed at the topmost level after all other
84 pages. @NULL could be specified for page to create an empty page.
23324ae1 85 */
adaaa686
FM
86 virtual bool AddPage(wxWindow* page, const wxString& text,
87 bool bSelect = false, int imageId = wxNOT_FOUND);
23324ae1
FM
88
89 /**
7977b62a
BP
90 Adds a new child-page to the last top-level page. @NULL could be
91 specified for page to create an empty page.
23324ae1 92 */
adaaa686
FM
93 virtual bool AddSubPage(wxWindow* page, const wxString& text,
94 bool bSelect = false, int imageId = wxNOT_FOUND);
23324ae1 95
23324ae1
FM
96
97 /**
7977b62a
BP
98 Shortcut for @ref wxTreebook::ExpandNode() "ExpandNode"( @a pageId,
99 @false ).
23324ae1
FM
100 */
101 bool CollapseNode(size_t pageId);
102
103 /**
7977b62a
BP
104 Creates a treebook control. See wxTreebook::wxTreebook() for the
105 description of the parameters.
23324ae1
FM
106 */
107 bool Create(wxWindow* parent, wxWindowID id,
108 const wxPoint& pos = wxDefaultPosition,
109 const wxSize& size = wxDefaultSize,
bfb6fde3 110 long style = wxBK_DEFAULT,
23324ae1
FM
111 const wxString& name = wxEmptyString);
112
113 /**
340e9651
FM
114 Deletes the page at the specified position and all its children.
115 Could trigger page selection change in a case when selected page is removed.
7977b62a 116 In that case its parent is selected (or the next page if no parent).
23324ae1 117 */
adaaa686 118 virtual bool DeletePage(size_t pagePos);
23324ae1
FM
119
120 /**
340e9651
FM
121 Expands (collapses) the @a pageId node. Returns the previous state.
122 May generate page changing events (if selected page is under the collapsed
7977b62a 123 branch, then its parent is autoselected).
23324ae1 124 */
adaaa686 125 virtual bool ExpandNode(size_t pageId, bool expand = true);
23324ae1 126
23324ae1
FM
127 /**
128 Returns the parent page of the given one or @c wxNOT_FOUND if this is a
129 top-level page.
130 */
328f5751 131 int GetPageParent(size_t page) const;
23324ae1
FM
132
133 /**
340e9651 134 Returns the currently selected page, or @c wxNOT_FOUND if none was selected.
7977b62a
BP
135
136 @note This method may return either the previously or newly selected
340e9651
FM
137 page when called from the EVT_TREEBOOK_PAGE_CHANGED() handler
138 depending on the platform and so wxBookCtrlEvent::GetSelection()
139 should be used instead in this case.
23324ae1 140 */
adaaa686 141 virtual int GetSelection() const;
23324ae1
FM
142
143 /**
340e9651
FM
144 Inserts a new page just before the page indicated by @a pagePos.
145 The new page is placed before @a pagePos page and on the same level.
146 @NULL could be specified for page to create an empty page.
23324ae1 147 */
adaaa686
FM
148 virtual bool InsertPage(size_t pagePos, wxWindow* page,
149 const wxString& text, bool bSelect = false,
150 int imageId = wxNOT_FOUND);
23324ae1
FM
151
152 /**
153 Inserts a sub page under the specified page.
7977b62a 154
23324ae1
FM
155 @NULL could be specified for page to create an empty page.
156 */
adaaa686
FM
157 virtual bool InsertSubPage(size_t pagePos, wxWindow* page,
158 const wxString& text, bool bSelect = false,
159 int imageId = wxNOT_FOUND);
23324ae1
FM
160
161 /**
7977b62a 162 Returns @true if the page represented by @a pageId is expanded.
23324ae1 163 */
adaaa686 164 virtual bool IsNodeExpanded(size_t pageId) const;
23324ae1 165};
e54c96f1 166