#include <wx/bookctrl.h>
A book control is a convenient way of displaying multiple pages of information, displayed one page at a time.
wxWidgets has five variants of this control:
This abstract class is the parent of all these book controls, and provides their basic interface. This is a pure virtual class so you cannot allocate it directly.
Public Member Functions | |
wxBookCtrlBase () | |
Default ctor. | |
wxBookCtrlBase (wxWindow *parent, wxWindowID winid, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxEmptyString) | |
Constructs the book control with the given parameters. | |
bool | Create (wxWindow *parent, wxWindowID winid, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxEmptyString) |
Constructs the book control with the given parameters. | |
virtual void | SetPageSize (const wxSize &size) |
Sets the width and height of the pages. | |
virtual int | HitTest (const wxPoint &pt, long *flags=NULL) const |
Returns the index of the tab at the specified position or wxNOT_FOUND if none. | |
Image list functions | |
void | AssignImageList (wxImageList *imageList) |
Sets the image list for the page control and takes ownership of the list. | |
wxImageList * | GetImageList () const |
Returns the associated image list. | |
virtual int | GetPageImage (size_t nPage) const =0 |
Returns the image index for the given page. | |
virtual void | SetImageList (wxImageList *imageList) |
Sets the image list for the page control. | |
virtual bool | SetPageImage (size_t page, int image)=0 |
Sets the image index for the given page. | |
Page text functions | |
virtual wxString | GetPageText (size_t nPage) const =0 |
Returns the string for the given page. | |
virtual bool | SetPageText (size_t page, const wxString &text)=0 |
Sets the text for the given page. | |
Selection functions | |
virtual int | GetSelection () const =0 |
Returns the currently selected page, or wxNOT_FOUND if none was selected. | |
wxWindow * | GetCurrentPage () const |
Returns the currently selected page or NULL. | |
virtual int | SetSelection (size_t page)=0 |
Sets the selection for the given page, returning the previous selection. | |
void | AdvanceSelection (bool forward=true) |
Cycles through the tabs. | |
virtual int | ChangeSelection (size_t page)=0 |
Changes the selection for the given page, returning the previous selection. | |
Page management functions | |
virtual bool | AddPage (wxWindow *page, const wxString &text, bool select=false, int imageId=wxNOT_FOUND) |
Adds a new page. | |
virtual bool | DeleteAllPages () |
Deletes all pages. | |
virtual bool | DeletePage (size_t page) |
Deletes the specified page, and the associated window. | |
virtual bool | InsertPage (size_t index, wxWindow *page, const wxString &text, bool select=false, int imageId=wxNOT_FOUND)=0 |
Inserts a new page at the specified position. | |
virtual bool | RemovePage (size_t page) |
Deletes the specified page, without deleting the associated window. | |
virtual size_t | GetPageCount () const |
Returns the number of pages in the control. | |
wxWindow * | GetPage (size_t page) const |
Returns the window at the given page position. |
wxBookCtrlBase::wxBookCtrlBase | ( | ) |
Default ctor.
wxBookCtrlBase::wxBookCtrlBase | ( | wxWindow * | parent, | |
wxWindowID | winid, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = 0 , |
|||
const wxString & | name = wxEmptyString | |||
) |
Constructs the book control with the given parameters.
See Create() for two-step construction.
virtual bool wxBookCtrlBase::AddPage | ( | wxWindow * | page, | |
const wxString & | text, | |||
bool | select = false , |
|||
int | imageId = wxNOT_FOUND | |||
) | [virtual] |
Adds a new page.
The call to this function may generate the page changing events.
page | Specifies the new page. | |
text | Specifies the text for the new page. | |
select | Specifies whether the page should be selected. | |
imageId | Specifies the optional image index for the new page. |
Reimplemented in wxTreebook.
void wxBookCtrlBase::AdvanceSelection | ( | bool | forward = true |
) |
Cycles through the tabs.
The call to this function generates the page changing events.
void wxBookCtrlBase::AssignImageList | ( | wxImageList * | imageList | ) |
Sets the image list for the page control and takes ownership of the list.
virtual int wxBookCtrlBase::ChangeSelection | ( | size_t | page | ) | [pure virtual] |
Changes the selection for the given page, returning the previous selection.
This function behaves as SetSelection() but does not generate the page changing events.
See User Generated Events vs Programmatically Generated Events for more information.
bool wxBookCtrlBase::Create | ( | wxWindow * | parent, | |
wxWindowID | winid, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = 0 , |
|||
const wxString & | name = wxEmptyString | |||
) |
Constructs the book control with the given parameters.
Reimplemented in wxNotebook, and wxTreebook.
virtual bool wxBookCtrlBase::DeleteAllPages | ( | ) | [virtual] |
Deletes all pages.
virtual bool wxBookCtrlBase::DeletePage | ( | size_t | page | ) | [virtual] |
Deletes the specified page, and the associated window.
The call to this function generates the page changing events.
Reimplemented in wxTreebook.
wxWindow* wxBookCtrlBase::GetCurrentPage | ( | ) | const |
Returns the currently selected page or NULL.
wxImageList* wxBookCtrlBase::GetImageList | ( | ) | const |
Returns the associated image list.
wxWindow* wxBookCtrlBase::GetPage | ( | size_t | page | ) | const |
Returns the window at the given page position.
virtual size_t wxBookCtrlBase::GetPageCount | ( | ) | const [virtual] |
Returns the number of pages in the control.
virtual int wxBookCtrlBase::GetPageImage | ( | size_t | nPage | ) | const [pure virtual] |
Returns the image index for the given page.
virtual wxString wxBookCtrlBase::GetPageText | ( | size_t | nPage | ) | const [pure virtual] |
Returns the string for the given page.
virtual int wxBookCtrlBase::GetSelection | ( | ) | const [pure virtual] |
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_BOOKCTRL_PAGE_CHANGED
handler depending on the platform and so wxBookCtrlEvent::GetSelection should be used instead in this case.
Implemented in wxTreebook.
virtual int wxBookCtrlBase::HitTest | ( | const wxPoint & | pt, | |
long * | flags = NULL | |||
) | const [virtual] |
Returns the index of the tab at the specified position or wxNOT_FOUND
if none.
If flags parameter is non-NULL, the position of the point inside the tab is returned as well.
pt | Specifies the point for the hit test. | |||||||||||
flags | Return value for detailed information. One of the following values:
|
wxNOT_FOUND
if there is no tab at the specified position. virtual bool wxBookCtrlBase::InsertPage | ( | size_t | index, | |
wxWindow * | page, | |||
const wxString & | text, | |||
bool | select = false , |
|||
int | imageId = wxNOT_FOUND | |||
) | [pure virtual] |
Inserts a new page at the specified position.
index | Specifies the position for the new page. | |
page | Specifies the new page. | |
text | Specifies the text for the new page. | |
select | Specifies whether the page should be selected. | |
imageId | Specifies the optional image index for the new page. |
Implemented in wxTreebook.
virtual bool wxBookCtrlBase::RemovePage | ( | size_t | page | ) | [virtual] |
Deletes the specified page, without deleting the associated window.
virtual void wxBookCtrlBase::SetImageList | ( | wxImageList * | imageList | ) | [virtual] |
Sets the image list for the page control.
It does not take ownership of the image list, you must delete it yourself.
virtual bool wxBookCtrlBase::SetPageImage | ( | size_t | page, | |
int | image | |||
) | [pure virtual] |
Sets the image index for the given page.
image is an index into the image list which was set with SetImageList().
virtual void wxBookCtrlBase::SetPageSize | ( | const wxSize & | size | ) | [virtual] |
Sets the width and height of the pages.
virtual bool wxBookCtrlBase::SetPageText | ( | size_t | page, | |
const wxString & | text | |||
) | [pure virtual] |
Sets the text for the given page.
virtual int wxBookCtrlBase::SetSelection | ( | size_t | page | ) | [pure virtual] |
Sets the selection for the given page, returning the previous selection.
Notice that the call to this function generates the page changing events, use the ChangeSelection() function if you don't want these events to be generated.
![]() |
[ top ] |