wxNotebook Class Reference
[Miscellaneous Windows]

#include <wx/notebook.h>

List of all members.


Detailed Description

This class represents a notebook control, which manages multiple windows with associated tabs.

To use the class, create a wxNotebook object and call wxNotebook::AddPage or wxNotebook::InsertPage, passing a window to be used as the page. Do not explicitly delete the window for a page that is currently managed by wxNotebook.

wxNotebookPage is a typedef for wxWindow.

Styles:

Library:  wxCore

Category:  Miscellaneous Windows

See also:
wxBookCtrl, wxBookCtrlEvent, wxImageList, Notebook Sample

Public Member Functions

 wxNotebook ()
 wxNotebook (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxNotebookNameStr)
virtual ~wxNotebook ()
bool AddPage (wxNotebookPage *page, const wxString &text, bool select=false, int imageId=-1)
void AdvanceSelection (bool forward=true)
void AssignImageList (wxImageList *imageList)
virtual int ChangeSelection (size_t page)
bool Create (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxNotebookNameStr)
virtual bool DeleteAllPages ()
bool DeletePage (size_t page)
wxWindowGetCurrentPage () const
wxImageListGetImageList () const
wxNotebookPage * GetPage (size_t page)
size_t GetPageCount () const
virtual int GetPageImage (size_t nPage) const
virtual wxString GetPageText (size_t nPage) const
virtual int GetRowCount () const
virtual int GetSelection () const
virtual wxColour GetThemeBackgroundColour () const
virtual int HitTest (const wxPoint &pt, long *flags=NULL) const
virtual bool InsertPage (size_t index, wxNotebookPage *page, const wxString &text, bool select=false, int imageId=-1)
void OnSelChange (wxBookCtrlEvent &event)
bool RemovePage (size_t page)
void SetImageList (wxImageList *imageList)
virtual void SetPadding (const wxSize &padding)
virtual bool SetPageImage (size_t page, int image)
virtual void SetPageSize (const wxSize &size)
virtual bool SetPageText (size_t page, const wxString &text)
virtual int SetSelection (size_t page)

Constructor & Destructor Documentation

wxNotebook::wxNotebook (  ) 

Constructs a notebook control.

wxNotebook::wxNotebook ( wxWindow parent,
wxWindowID  id,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = 0,
const wxString name = wxNotebookNameStr 
)

Constructs a notebook control. Note that sometimes you can reduce flicker by passing the wxCLIP_CHILDREN window style.

Parameters:
parent The parent window. Must be non-NULL.
id The window identifier.
pos The window position.
size The window size.
style The window style. See wxNotebook.
name The name of the control (used only under Motif).

virtual wxNotebook::~wxNotebook (  )  [virtual]

Destroys the wxNotebook object.


Member Function Documentation

bool wxNotebook::AddPage ( wxNotebookPage *  page,
const wxString text,
bool  select = false,
int  imageId = -1 
)

Adds a new page. The call to this function may generate the page changing events.

Parameters:
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.
Returns:
true if successful, false otherwise.
Remarks:
Do not delete the page, it will be deleted by the notebook.
See also:
InsertPage()

void wxNotebook::AdvanceSelection ( bool  forward = true  ) 

Cycles through the tabs. The call to this function generates the page changing events.

void wxNotebook::AssignImageList ( wxImageList imageList  ) 

Sets the image list for the page control and takes ownership of the list.

See also:
wxImageList, SetImageList()

virtual int wxNotebook::ChangeSelection ( size_t  page  )  [virtual]

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 User Generated Events for more infomation.

bool wxNotebook::Create ( wxWindow parent,
wxWindowID  id,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = 0,
const wxString name = wxNotebookNameStr 
)

Creates a notebook control. See wxNotebook() for a description of the parameters.

virtual bool wxNotebook::DeleteAllPages (  )  [virtual]

Deletes all pages.

bool wxNotebook::DeletePage ( size_t  page  ) 

Deletes the specified page, and the associated window. The call to this function generates the page changing events.

wxWindow* wxNotebook::GetCurrentPage (  )  const

Returns the currently selected notebook page or NULL.

wxImageList* wxNotebook::GetImageList (  )  const

Returns the associated image list.

See also:
wxImageList, SetImageList()

wxNotebookPage* wxNotebook::GetPage ( size_t  page  ) 

Returns the window at the given page position.

size_t wxNotebook::GetPageCount (  )  const

Returns the number of pages in the notebook control.

virtual int wxNotebook::GetPageImage ( size_t  nPage  )  const [virtual]

Returns the image index for the given page.

virtual wxString wxNotebook::GetPageText ( size_t  nPage  )  const [virtual]

Returns the string for the given page.

virtual int wxNotebook::GetRowCount (  )  const [virtual]

Returns the number of rows in the notebook control.

virtual int wxNotebook::GetSelection (  )  const [virtual]

Returns the currently selected page, or -1 if none was selected. Note that this method may return either the previously or newly selected page when called from the EVT_NOTEBOOK_PAGE_CHANGED handler depending on the platform and so wxBookCtrlEvent::GetSelection should be used instead in this case.

virtual wxColour wxNotebook::GetThemeBackgroundColour (  )  const [virtual]

If running under Windows and themes are enabled for the application, this function returns a suitable colour for painting the background of a notebook page, and can be passed to SetBackgroundColour. Otherwise, an uninitialised colour will be returned.

virtual int wxNotebook::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.

Parameters:
pt Specifies the point for the hit test.
flags Return value for detailed information. One of the following values:
wxBK_HITTEST_NOWHERE There was no tab under this point.
wxBK_HITTEST_ONICON The point was over an icon (currently wxMSW only).
wxBK_HITTEST_ONLABEL The point was over a label (currently wxMSW only).
wxBK_HITTEST_ONITEM The point was over an item, but not on the label or icon.
wxBK_HITTEST_ONPAGE The point was over a currently selected page, not over any tab. Note that this flag is present only if wxNOT_FOUND is returned.
Returns:
Returns the zero-based tab index or wxNOT_FOUND if there is no tab at the specified position.

virtual bool wxNotebook::InsertPage ( size_t  index,
wxNotebookPage *  page,
const wxString text,
bool  select = false,
int  imageId = -1 
) [virtual]

Inserts a new page at the specified position.

Parameters:
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.
Returns:
true if successful, false otherwise.
Remarks:
Do not delete the page, it will be deleted by the notebook.
See also:
AddPage()

void wxNotebook::OnSelChange ( wxBookCtrlEvent event  ) 

An event handler function, called when the page selection is changed.

See also:
wxBookCtrlEvent

bool wxNotebook::RemovePage ( size_t  page  ) 

Deletes the specified page, without deleting the associated window.

void wxNotebook::SetImageList ( wxImageList imageList  ) 

Sets the image list for the page control. It does not take ownership of the image list, you must delete it yourself.

See also:
wxImageList, AssignImageList()

virtual void wxNotebook::SetPadding ( const wxSize padding  )  [virtual]

Sets the amount of space around each page's icon and label, in pixels.

Note:
The vertical padding cannot be changed in wxGTK.

virtual bool wxNotebook::SetPageImage ( size_t  page,
int  image 
) [virtual]

Sets the image index for the given page. image is an index into the image list which was set with SetImageList().

virtual void wxNotebook::SetPageSize ( const wxSize size  )  [virtual]

Sets the width and height of the pages.

Note:
This method is currently not implemented for wxGTK.

virtual bool wxNotebook::SetPageText ( size_t  page,
const wxString text 
) [virtual]

Sets the text for the given page.

virtual int wxNotebook::SetSelection ( size_t  page  )  [virtual]

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 also:
GetSelection()



wxWidgets logo

[ top ]