This class represents a tab control, which manages multiple tabs.
Derived from
wxControl
wxWindow
wxEvtHandler
wxObject
Include files
<wx/tabctrl.h>
See also
wxTabEvent, wxImageList, wxNotebook
Members
wxTabCtrl::wxTabCtrl
wxTabCtrl::~wxTabCtrl
wxTabCtrl::Create
wxTabCtrl::DeleteAllItems
wxTabCtrl::DeleteItem
wxTabCtrl::GetCurFocus
wxTabCtrl::GetImageList
wxTabCtrl::GetItemCount
wxTabCtrl::GetItemData
wxTabCtrl::GetItemImage
wxTabCtrl::GetItemRect
wxTabCtrl::GetItemText
wxTabCtrl::GetRowCount
wxTabCtrl::GetSelection
wxTabCtrl::HitTest
wxTabCtrl::InsertItem
wxTabCtrl::SetItemData
wxTabCtrl::SetItemImage
wxTabCtrl::SetImageList
wxTabCtrl::SetItemSize
wxTabCtrl::SetItemText
wxTabCtrl::SetPadding
wxTabCtrl::SetSelection
wxTabCtrl()
Default constructor.
wxTabCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size, long style = 0, const wxString& name = "tabCtrl")
Constructs a tab control.
Parameters
parent
id
pos
size
style
~wxTabCtrl()
Destroys the wxTabCtrl object.
bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size, long style = 0, const wxString& name = "tabCtrl")
Creates a tab control. See wxTabCtrl::wxTabCtrl for a description of the parameters.
bool DeleteAllItems()
Deletes all tab items.
bool DeleteItem(int item)
Deletes the specified tab item.
int GetCurFocus() const
Returns the index for the tab with the focus, or -1 if none has the focus.
wxImageList* GetImageList() const
Returns the associated image list.
See also
wxImageList, wxTabCtrl::SetImageList
int GetItemCount() const
Returns the number of tabs in the tab control.
void* GetItemData() const
Returns the client data for the given tab.
int GetItemImage() const
Returns the image index for the given tab.
bool GetItemRect(int item, wxRect& rect) const
Returns the rectangle bounding the given tab.
See also
wxString GetItemText() const
Returns the string for the given tab.
int GetRowCount() const
Returns the number of rows in the tab control.
int GetSelection() const
Returns the index for the currently selected tab.
See also
int HitTest(const wxPoint& pt, long& flags)
Tests whether a tab is at the specified position.
Parameters
pt
flags
wxTAB_HITTEST_NOWHERE | There was no tab under this point. |
wxTAB_HITTEST_ONICON | The point was over an icon. |
wxTAB_HITTEST_ONLABEL | The point was over a label. |
wxTAB_HITTEST_ONITEM | The point was over an item, but not on the label or icon. |
Return value
Returns the zero-based tab index or -1 if no tab is at the specified position.
void InsertItem(int item, const wxString& text, int imageId = -1, void* clientData = NULL)
Inserts a new tab.
Parameters
item
text
imageId
clientData
Return value
true if successful, false otherwise.
bool SetItemData(int item, void* data)
Sets the client data for a tab.
bool SetItemImage(int item, int image)
Sets the image index for the given tab. image is an index into the image list which was set with wxTabCtrl::SetImageList.
void SetImageList(wxImageList* imageList)
Sets the image list for the tab control.
See also
void SetItemSize(const wxSize& size)
Sets the width and height of the tabs.
bool SetItemText(int item, const wxString& text)
Sets the text for the given tab.
void SetPadding(const wxSize& padding)
Sets the amount of space around each tab's icon and label.
int SetSelection(int item)
Sets the selection for the given tab, returning the index of the previously selected tab. Returns -1 if the call was unsuccessful.
See also