X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e54c96f187f46c06bd36be8cd52b35c19884aa2b..ddb57e45571e9a0a09503908184aac5d19bc6a7a:/interface/treebook.h diff --git a/interface/treebook.h b/interface/treebook.h index 364a23d931..c950031b2d 100644 --- a/interface/treebook.h +++ b/interface/treebook.h @@ -11,20 +11,34 @@ @wxheader{treebook.h} This class represents the events generated by a treebook control: currently, - there are four of them. The PAGE_CHANGING and PAGE_CHANGED - have exactly the - same - behaviour as wxNotebookEvent. - - The other two NODE_COLLAPSED and NODE_EXPANDED are triggered when page node in - the tree control - is collapsed/expanded. The page index could be retreived by calling - wxTreebookEvent::GetSelection. - - + there are four of them. The EVT_TREEBOOK_PAGE_CHANGING() and + EVT_TREEBOOK_PAGE_CHANGED() - have exactly the same behaviour as + wxNotebookEvent. + + The other two EVT_TREEBOOK_NODE_COLLAPSED() and EVT_TREEBOOK_NODE_EXPANDED() + are triggered when page node in the tree control is collapsed/expanded. The + page index could be retreived by calling GetSelection(). + + @beginEventTable{wxTreebookEvent} + @event{EVT_TREEBOOK_PAGE_CHANGED(id, func)} + The page selection was changed. Processes a @c + wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event. + @event{EVT_TREEBOOK_PAGE_CHANGING(id, func)} + The page selection is about to be changed. Processes a @c + wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING event. This event can be @ref + wxNotifyEvent::Veto() "vetoed". + @event{EVT_TREEBOOK_NODE_COLLAPSED(id, func)} + The page node is going to be collapsed. Processes a @c + wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED event. + @event{EVT_TREEBOOK_NODE_EXPANDED(id, func)} + The page node is going to be expanded. Processes a @c + wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED event. + @endEventTable + @library{wxcore} @category{events} - @see wxNotebookEvent, wxTreebook + @see wxTreebook, wxNotebookEvent */ class wxTreebookEvent : public wxNotifyEvent { @@ -37,13 +51,16 @@ public: int nOldSel = wxNOT_FOUND); /** - Returns the page that was selected before the change, wxNOT_FOUND if none was - selected. + Returns the page that was selected before the change, @c wxNOT_FOUND if + none was selected. */ int GetOldSelection() const; /** - Returns the currently selected page, or wxNOT_FOUND if none was selected. + Returns the currently selected page, or @c wxNOT_FOUND if none was + selected. + + @see wxNotebookEvent::GetSelection() */ int GetSelection() const; }; @@ -54,35 +71,51 @@ public: @class wxTreebook @wxheader{treebook.h} - This class is an extension of the Notebook class that allows a tree structured - set of pages to be shown in a control. - A classic example is a netscape preferences dialog that shows a tree - of preference sections on the left and select section page on the right. + This class is an extension of the wxNotebook class that allows a tree + structured set of pages to be shown in a control. A classic example is a + netscape preferences dialog that shows a tree of preference sections on + the left and select section page on the right. To use the class simply create it and populate with pages using - wxTreebook::InsertPage, - wxTreebook::InsertSubPage, - wxTreebook::AddPage, - wxTreebook::AddSubPage. - - If your tree is no more than 1 level in depth then you could - simply use wxTreebook::AddPage and - wxTreebook::AddSubPage to sequentially populate your tree - by adding at every step a page or a subpage to the end of the tree. + InsertPage(), InsertSubPage(), AddPage(), AddSubPage(). + + If your tree is no more than 1 level in depth then you could simply use + AddPage() and AddSubPage() to sequentially populate your tree by adding at + every step a page or a subpage to the end of the tree. + + @beginEventTable{wxTreebookEvent} + @event{EVT_TREEBOOK_PAGE_CHANGED(id, func)} + The page selection was changed. Processes a @c + wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event. + @event{EVT_TREEBOOK_PAGE_CHANGING(id, func)} + The page selection is about to be changed. Processes a @c + wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING event. This event can be @ref + wxNotifyEvent::Veto() "vetoed". + @event{EVT_TREEBOOK_NODE_COLLAPSED(id, func)} + The page node is going to be collapsed. Processes a @c + wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED event. + @event{EVT_TREEBOOK_NODE_EXPANDED(id, func)} + The page node is going to be expanded. Processes a @c + wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED event. + @endEventTable @library{wxcore} @category{miscwnd} - @see wxNotebook, wxTreebookEvent, wxImageList, @ref overview_samplenotebook - "notebook sample" + @see wxTreebookEvent, wxNotebook, wxTreeCtrl, wxImageList, + @ref overview_bookctrl, @ref page_samples_notebook */ -class wxTreebook : public wxBookCtrl overview +class wxTreebook : public wxBookCtrlBase { public: - //@{ /** - Creates an empty TreeBook control. - + Default constructor. + */ + wxTreebook(); + + /** + Creates an empty wxTreebook. + @param parent The parent window. Must be non-@NULL. @param id @@ -96,64 +129,66 @@ public: @param name The name of the control (used only under Motif). */ - wxTreebook(); wxTreebook(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTBK_DEFAULT, + long style = wxBK_DEFAULT, const wxString& name = wxEmptyString); - //@} /** - Destroys the wxTreebook object. - Also deletes all the pages owned by the control (inserted previously into it). + Destroys the wxTreebook object. Also deletes all the pages owned by the + control (inserted previously into it). */ ~wxTreebook(); /** - Adds a new page. The page is placed at the topmost level after all other pages. - @NULL could be specified for page to create an empty page. + Adds a new page. The page is placed at the topmost level after all other + pages. @NULL could be specified for page to create an empty page. */ bool AddPage(wxWindow* page, const wxString& text, bool bSelect = false, int imageId = wxNOT_FOUND); /** - Adds a new child-page to the last top-level page. - @NULL could be specified for page to create an empty page. + Adds a new child-page to the last top-level page. @NULL could be + specified for page to create an empty page. */ bool AddSubPage(wxWindow* page, const wxString& text, bool bSelect = false, int imageId = wxNOT_FOUND); /** - Sets the image list for the page control and takes ownership of the list. - + Sets the image list for the page control and takes ownership of the + list. + @see wxImageList, SetImageList() */ void AssignImageList(wxImageList* imageList); /** - Changes the selection for the given page, returning the previous selection. + Changes the selection for the given page, returning the previous + selection. + The call to this function does not generate the page changing events. - This is the only difference with SetSelection(). - See @ref overview_progevent "this topic" for more info. + This is the only difference with SetSelection(). See + @ref overview_eventhandling_prog for more info. */ int ChangeSelection(size_t page); /** - Shortcut for wxTreebook::ExpandNode(pageId, @false). + Shortcut for @ref wxTreebook::ExpandNode() "ExpandNode"( @a pageId, + @false ). */ bool CollapseNode(size_t pageId); /** - Creates a treebook control. See wxTreebook() for the description of the - parameters. + Creates a treebook control. See wxTreebook::wxTreebook() for the + description of the parameters. */ bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTBK_DEFAULT, + long style = wxBK_DEFAULT, const wxString& name = wxEmptyString); /** @@ -162,17 +197,16 @@ public: bool DeleteAllPages(); /** - Deletes the page at the specified position and all its children. Could trigger - page selection change - in a case when selected page is removed. In that case its parent is selected - (or the next page if no parent). + Deletes the page at the specified position and all its children. Could + trigger page selection change in a case when selected page is removed. + In that case its parent is selected (or the next page if no parent). */ bool DeletePage(size_t pagePos); /** - Expands (collapses) the pageId node. Returns the previous state. - May generate page changing events (if selected page - is under the collapsed branch, then its parent is autoselected). + Expands (collapses) the @a pageId node. Returns the previous state. May + generate page changing events (if selected page is under the collapsed + branch, then its parent is autoselected). */ bool ExpandNode(size_t pageId, bool expand = true); @@ -193,18 +227,20 @@ public: wxString GetPageText(size_t n) const; /** - Returns the currently selected page, or wxNOT_FOUND if none was selected. - Note that this method may return either the previously or newly selected page - when called from the EVT_TREEBOOK_PAGE_CHANGED handler - depending on the platform and so wxTreebookEvent::GetSelection should be used - instead in this case. + Returns the currently selected page, or @c wxNOT_FOUND if none was + selected. + + @note This method may return either the previously or newly selected + page when called from the EVT_TREEBOOK_PAGE_CHANGED() handler + depending on the platform and so wxTreebookEvent::GetSelection() + should be used instead in this case. */ int GetSelection() const; /** - Inserts a new page just before the page indicated by pagePos. - The new page is placed before pagePos page and on the same level. - @NULL could be specified for page to create an empty page. + Inserts a new page just before the page indicated by @a pagePos. The new + page is placed before @a pagePos page and on the same level. @NULL could + be specified for page to create an empty page. */ bool InsertPage(size_t pagePos, wxWindow* page, const wxString& text, @@ -213,6 +249,7 @@ public: /** Inserts a sub page under the specified page. + @NULL could be specified for page to create an empty page. */ bool InsertSubPage(size_t pagePos, wxWindow* page, @@ -221,36 +258,37 @@ public: int imageId = wxNOT_FOUND); /** - Gets the pagePos page state -- whether it is expanded or collapsed + Returns @true if the page represented by @a pageId is expanded. */ bool IsNodeExpanded(size_t pageId) const; /** - Sets the image list for the page control. It does not take ownership of the - image list, you must delete it yourself. - + Sets the image list for the page control. It does not take ownership of + the image list, you must delete it yourself. + @see wxImageList, AssignImageList() */ void SetImageList(wxImageList* imageList); /** - Sets the image index for the given page. ImageId is an index into the image list - which was set with SetImageList(). + Sets the image index for the given @a page. @a imageId is an index into + the image list which was set with SetImageList(). */ bool SetPageImage(size_t page, int imageId); /** - Sets the text for the given page. + Sets the @a text for the given @a page. */ bool SetPageText(size_t page, const wxString& text); /** + @deprecated Please use ChangeSelection() instead. + Sets the selection for the given page, returning the previous selection. - The call to this function generates the page changing events. - This function is deprecated and should not be used in new code. Please use the - ChangeSelection() function instead. - - @see GetSelection() + + The call to this function generates page changing events. + + @see GetSelection(), ChangeSelection() */ int SetSelection(size_t n); };