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