2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: treebook.h
|
2008-08-01 09:46:46 -04:00
|
|
|
// Purpose: interface of wxTreebook
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxTreebook
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
To use the class simply create it and populate with pages using
|
2008-05-20 03:48:30 -04:00
|
|
|
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.
|
|
|
|
|
2008-08-01 09:46:46 -04:00
|
|
|
@beginEventTable{wxBookCtrlEvent}
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TREEBOOK_PAGE_CHANGED(id, func)}
|
2008-10-13 06:27:19 -04:00
|
|
|
The page selection was changed.
|
|
|
|
Processes a @c wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event.
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TREEBOOK_PAGE_CHANGING(id, func)}
|
2008-10-13 06:27:19 -04:00
|
|
|
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".
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TREEBOOK_NODE_COLLAPSED(id, func)}
|
2008-10-13 06:27:19 -04:00
|
|
|
The page node is going to be collapsed.
|
|
|
|
Processes a @c wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED event.
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TREEBOOK_NODE_EXPANDED(id, func)}
|
2008-10-13 06:27:19 -04:00
|
|
|
The page node is going to be expanded.
|
|
|
|
Processes a @c wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED event.
|
2008-05-20 03:48:30 -04:00
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-08-01 09:46:46 -04:00
|
|
|
@see wxBookCtrl, wxBookCtrlEvent, wxNotebook, wxTreeCtrl, wxImageList,
|
2008-05-20 03:48:30 -04:00
|
|
|
@ref overview_bookctrl, @ref page_samples_notebook
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-05-20 03:48:30 -04:00
|
|
|
class wxTreebook : public wxBookCtrlBase
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxTreebook();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates an empty wxTreebook.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
The parent window. Must be non-@NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The window identifier.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
The window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
The window size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The window style. See wxNotebook.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The name of the control (used only under Motif).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxTreebook(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2008-04-19 17:56:10 -04:00
|
|
|
long style = wxBK_DEFAULT,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxString& name = wxEmptyString);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-13 06:27:19 -04:00
|
|
|
Destroys the wxTreebook object.
|
|
|
|
Also deletes all the pages owned by the control (inserted previously into it).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxTreebook();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool AddPage(wxWindow* page, const wxString& text,
|
|
|
|
bool bSelect = false, int imageId = wxNOT_FOUND);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Adds a new child-page to the last top-level page. @NULL could be
|
|
|
|
specified for page to create an empty page.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool AddSubPage(wxWindow* page, const wxString& text,
|
|
|
|
bool bSelect = false, int imageId = wxNOT_FOUND);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Shortcut for @ref wxTreebook::ExpandNode() "ExpandNode"( @a pageId,
|
|
|
|
@false ).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool CollapseNode(size_t pageId);
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Creates a treebook control. See wxTreebook::wxTreebook() for the
|
|
|
|
description of the parameters.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2008-04-19 17:56:10 -04:00
|
|
|
long style = wxBK_DEFAULT,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxString& name = wxEmptyString);
|
|
|
|
|
|
|
|
/**
|
2008-10-13 06:27:19 -04:00
|
|
|
Deletes the page at the specified position and all its children.
|
|
|
|
Could trigger page selection change in a case when selected page is removed.
|
2008-05-20 03:48:30 -04:00
|
|
|
In that case its parent is selected (or the next page if no parent).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool DeletePage(size_t pagePos);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-13 06:27:19 -04:00
|
|
|
Expands (collapses) the @a pageId node. Returns the previous state.
|
|
|
|
May generate page changing events (if selected page is under the collapsed
|
2008-05-20 03:48:30 -04:00
|
|
|
branch, then its parent is autoselected).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ExpandNode(size_t pageId, bool expand = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the parent page of the given one or @c wxNOT_FOUND if this is a
|
|
|
|
top-level page.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetPageParent(size_t page) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-13 06:27:19 -04:00
|
|
|
Returns the currently selected page, or @c wxNOT_FOUND if none was selected.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
@note This method may return either the previously or newly selected
|
2008-10-13 06:27:19 -04:00
|
|
|
page when called from the EVT_TREEBOOK_PAGE_CHANGED() handler
|
|
|
|
depending on the platform and so wxBookCtrlEvent::GetSelection()
|
|
|
|
should be used instead in this case.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual int GetSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-13 06:27:19 -04:00
|
|
|
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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool InsertPage(size_t pagePos, wxWindow* page,
|
|
|
|
const wxString& text, bool bSelect = false,
|
|
|
|
int imageId = wxNOT_FOUND);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Inserts a sub page under the specified page.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@NULL could be specified for page to create an empty page.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool InsertSubPage(size_t pagePos, wxWindow* page,
|
|
|
|
const wxString& text, bool bSelect = false,
|
|
|
|
int imageId = wxNOT_FOUND);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns @true if the page represented by @a pageId is expanded.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsNodeExpanded(size_t pageId) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|