]>
git.saurik.com Git - wxWidgets.git/blob - interface/treebook.h
d4d469e12ec1e657e93927b8a81074ad791a8dc8
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxTreebookEvent class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxTreebookEvent
13 This class represents the events generated by a treebook control: currently,
14 there are four of them. The PAGE_CHANGING and PAGE_CHANGED - have exactly the
16 behaviour as wxNotebookEvent.
18 The other two NODE_COLLAPSED and NODE_EXPANDED are triggered when page node in
20 is collapsed/expanded. The page index could be retreived by calling
21 wxTreebookEvent::GetSelection.
28 wxNotebookEvent, wxTreebook
30 class wxTreebookEvent
: public wxNotifyEvent
36 wxTreebookEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0,
37 int nSel
= wxNOT_FOUND
,
38 int nOldSel
= wxNOT_FOUND
);
41 Returns the page that was selected before the change, wxNOT_FOUND if none was
44 int GetOldSelection();
47 Returns the currently selected page, or wxNOT_FOUND if none was selected.
57 This class is an extension of the Notebook class that allows a tree structured
58 set of pages to be shown in a control.
59 A classic example is a netscape preferences dialog that shows a tree
60 of preference sections on the left and select section page on the right.
62 To use the class simply create it and populate with pages using
63 wxTreebook::InsertPage,
64 wxTreebook::InsertSubPage,
66 wxTreebook::AddSubPage.
68 If your tree is no more than 1 level in depth then you could
69 simply use wxTreebook::AddPage and
70 wxTreebook::AddSubPage to sequentially populate your tree
71 by adding at every step a page or a subpage to the end of the tree.
77 wxNotebook, wxTreebookEvent, wxImageList, @ref overview_samplenotebook
80 class wxTreebook
: public wxBookCtrl overview
85 Creates an empty TreeBook control.
88 The parent window. Must be non-@NULL.
90 The window identifier.
96 The window style. See wxNotebook.
98 The name of the control (used only under Motif).
101 wxTreebook(wxWindow
* parent
, wxWindowID id
,
102 const wxPoint
& pos
= wxDefaultPosition
,
103 const wxSize
& size
= wxDefaultSize
,
104 long style
= wxTBK_DEFAULT
,
105 const wxString
& name
= wxEmptyString
);
109 Destroys the wxTreebook object.
110 Also deletes all the pages owned by the control (inserted previously into it).
115 Adds a new page. The page is placed at the topmost level after all other pages.
116 @NULL could be specified for page to create an empty page.
118 bool AddPage(wxWindow
* page
, const wxString
& text
,
119 bool bSelect
= false,
120 int imageId
= wxNOT_FOUND
);
123 Adds a new child-page to the last top-level page.
124 @NULL could be specified for page to create an empty page.
126 bool AddSubPage(wxWindow
* page
, const wxString
& text
,
127 bool bSelect
= false,
128 int imageId
= wxNOT_FOUND
);
131 Sets the image list for the page control and takes ownership of the list.
133 @see wxImageList, SetImageList()
135 void AssignImageList(wxImageList
* imageList
);
138 Changes the selection for the given page, returning the previous selection.
139 The call to this function does not generate the page changing events.
140 This is the only difference with SetSelection().
141 See @ref overview_progevent "this topic" for more info.
143 int ChangeSelection(size_t page
);
146 Shortcut for wxTreebook::ExpandNode(pageId, @false).
148 bool CollapseNode(size_t pageId
);
151 Creates a treebook control. See wxTreebook() for the description of the
154 bool Create(wxWindow
* parent
, wxWindowID id
,
155 const wxPoint
& pos
= wxDefaultPosition
,
156 const wxSize
& size
= wxDefaultSize
,
157 long style
= wxTBK_DEFAULT
,
158 const wxString
& name
= wxEmptyString
);
161 Deletes all pages inserted into the treebook. No event is generated.
163 bool DeleteAllPages();
166 Deletes the page at the specified position and all its children. Could trigger
167 page selection change
168 in a case when selected page is removed. In that case its parent is selected
169 (or the next page if no parent).
171 bool DeletePage(size_t pagePos
);
174 Expands (collapses) the pageId node. Returns the previous state.
175 May generate page changing events (if selected page
176 is under the collapsed branch, then its parent is autoselected).
178 bool ExpandNode(size_t pageId
, bool expand
= true);
181 Returns the image index for the given page.
183 int GetPageImage(size_t n
);
186 Returns the parent page of the given one or @c wxNOT_FOUND if this is a
189 int GetPageParent(size_t page
);
192 Returns the string for the given page.
194 wxString
GetPageText(size_t n
);
197 Returns the currently selected page, or wxNOT_FOUND if none was selected.
198 Note that this method may return either the previously or newly selected page
199 when called from the EVT_TREEBOOK_PAGE_CHANGED handler
200 depending on the platform and so wxTreebookEvent::GetSelection should be used
201 instead in this case.
206 Inserts a new page just before the page indicated by pagePos.
207 The new page is placed before pagePos page and on the same level.
208 @NULL could be specified for page to create an empty page.
210 bool InsertPage(size_t pagePos
, wxWindow
* page
,
211 const wxString
& text
,
212 bool bSelect
= false,
213 int imageId
= wxNOT_FOUND
);
216 Inserts a sub page under the specified page.
217 @NULL could be specified for page to create an empty page.
219 bool InsertSubPage(size_t pagePos
, wxWindow
* page
,
220 const wxString
& text
,
221 bool bSelect
= false,
222 int imageId
= wxNOT_FOUND
);
225 Gets the pagePos page state -- whether it is expanded or collapsed
227 bool IsNodeExpanded(size_t pageId
);
230 Sets the image list for the page control. It does not take ownership of the
231 image list, you must delete it yourself.
233 @see wxImageList, AssignImageList()
235 void SetImageList(wxImageList
* imageList
);
238 Sets the image index for the given page. ImageId is an index into the image list
239 which was set with SetImageList().
241 bool SetPageImage(size_t page
, int imageId
);
244 Sets the text for the given page.
246 bool SetPageText(size_t page
, const wxString
& text
);
249 Sets the selection for the given page, returning the previous selection.
250 The call to this function generates the page changing events.
251 This function is deprecated and should not be used in new code. Please use the
252 ChangeSelection() function instead.
256 int SetSelection(size_t n
);