]>
git.saurik.com Git - wxWidgets.git/blob - interface/treebook.h
c79325f1fdbbe13504326b1a2d552c47c61cf09a
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.
91 The window identifier.
100 The window style. See wxNotebook.
103 The name of the control (used only under Motif).
106 wxTreebook(wxWindow
* parent
, wxWindowID id
,
107 const wxPoint
& pos
= wxDefaultPosition
,
108 const wxSize
& size
= wxDefaultSize
,
109 long style
= wxTBK_DEFAULT
,
110 const wxString
& name
= wxEmptyString
);
114 Destroys the wxTreebook object.
116 Also deletes all the pages owned by the control (inserted previously into it).
121 Adds a new page. The page is placed at the topmost level after all other pages.
122 @NULL could be specified for page to create an empty page.
124 bool AddPage(wxWindow
* page
, const wxString
& text
,
125 bool bSelect
= @
false,
126 int imageId
= wxNOT_FOUND
);
129 Adds a new child-page to the last top-level page.
130 @NULL could be specified for page to create an empty page.
132 bool AddSubPage(wxWindow
* page
, const wxString
& text
,
133 bool bSelect
= @
false,
134 int imageId
= wxNOT_FOUND
);
137 Sets the image list for the page control and takes ownership of the list.
139 @sa wxImageList, SetImageList()
141 void AssignImageList(wxImageList
* imageList
);
144 Changes the selection for the given page, returning the previous selection.
146 The call to this function does not generate the page changing events.
147 This is the only difference with SetSelection().
148 See @ref overview_progevent "this topic" for more info.
150 int ChangeSelection(size_t page
);
153 Shortcut for wxTreebook::ExpandNode(pageId, @false).
155 bool CollapseNode(size_t pageId
);
158 Creates a treebook control. See wxTreebook() for the description of the
161 bool Create(wxWindow
* parent
, wxWindowID id
,
162 const wxPoint
& pos
= wxDefaultPosition
,
163 const wxSize
& size
= wxDefaultSize
,
164 long style
= wxTBK_DEFAULT
,
165 const wxString
& name
= wxEmptyString
);
168 Deletes all pages inserted into the treebook. No event is generated.
170 bool DeleteAllPages();
173 Deletes the page at the specified position and all its children. Could trigger
174 page selection change
175 in a case when selected page is removed. In that case its parent is selected
176 (or the next page if no parent).
178 bool DeletePage(size_t pagePos
);
181 Expands (collapses) the pageId node. Returns the previous state.
182 May generate page changing events (if selected page
183 is under the collapsed branch, then its parent is autoselected).
185 bool ExpandNode(size_t pageId
, bool expand
= @
true);
188 Returns the image index for the given page.
190 int GetPageImage(size_t n
);
193 Returns the parent page of the given one or @c wxNOT_FOUND if this is a
196 int GetPageParent(size_t page
);
199 Returns the string for the given page.
201 wxString
GetPageText(size_t n
);
204 Returns the currently selected page, or wxNOT_FOUND if none was selected.
206 Note that this method may return either the previously or newly selected page
207 when called from the EVT_TREEBOOK_PAGE_CHANGED handler
208 depending on the platform and so wxTreebookEvent::GetSelection should be used
209 instead in this case.
214 Inserts a new page just before the page indicated by pagePos.
215 The new page is placed before pagePos page and on the same level.
216 @NULL could be specified for page to create an empty page.
218 bool InsertPage(size_t pagePos
, wxWindow
* page
,
219 const wxString
& text
,
220 bool bSelect
= @
false,
221 int imageId
= wxNOT_FOUND
);
224 Inserts a sub page under the specified page.
226 @NULL could be specified for page to create an empty page.
228 bool InsertSubPage(size_t pagePos
, wxWindow
* page
,
229 const wxString
& text
,
230 bool bSelect
= @
false,
231 int imageId
= wxNOT_FOUND
);
234 Gets the pagePos page state -- whether it is expanded or collapsed
236 bool IsNodeExpanded(size_t pageId
);
239 Sets the image list for the page control. It does not take ownership of the
240 image list, you must delete it yourself.
242 @sa wxImageList, AssignImageList()
244 void SetImageList(wxImageList
* imageList
);
247 Sets the image index for the given page. ImageId is an index into the image list
248 which was set with SetImageList().
250 bool SetPageImage(size_t page
, int imageId
);
253 Sets the text for the given page.
255 bool SetPageText(size_t page
, const wxString
& text
);
258 Sets the selection for the given page, returning the previous selection.
260 The call to this function generates the page changing events.
262 This function is deprecated and should not be used in new code. Please use the
263 ChangeSelection() function instead.
267 int SetSelection(size_t n
);