SECTabControlBase Class
class SECTabControlBase: public CWnd
The SECTabControlBase class defines the interface of a tab control.
Defined in: tabctrlb.h
Comments
A tab control is a rectanglar window containing one row of tabs and (optionally) buttons which allow the user to scroll the tabs left and right. Tab controls are typically used in dialog boxes or frame windows to provide the user with access to several pages of information within one window. By using a tab control, an application can define multiple pages for the same area of a window or dialog box. Each page consists of a set of information or a group of controls that the application displays when the user selects the corresponding tab.
Tabbed windows, on the other hand, are derived from the classes SECTabWndBase, SECTabWnd and SEC3DTabWnd. SECTabWndBase contains a list of pages and a row of tabs. The latter is implemented as a single instance of tab control of type SECTabControl. The single tab control object manages and displays an array of tabs. This tab control is sized and positioned by its SECTabWndBase parent such that no overlap exists between the pages and the tab control. So, a SECTabWndBase contains an instance of a SECTabControl (and zero or more pages). This organization allows the SECTabControl to be used in a different context. It may be helpful to think of tab controls as child windows, whereas tabbed windows are self-sustaining parent windows that interact with the document/view architecture.
SECTabControlBase doesn’t actually implement the tab control UI functionality. It is simply an abstract base class that defines the methods used to operate on a generic tab control. For example, SECTabControlBase defines methods for adding, removing, deleting, invalidating tabs, etc. (it provides default implementations for these methods as well). However, this class does not implement the look and feel of the tab control. That responsibility is delegated to derived classes. The derived classes inherit the methods common to all tab controls and add the implementation details necessary to define the look and feel of the particular tab control.
There are currently two implementations of the SECTabControlBase interface: SECTabControl and SEC3DTabControl. SECTabControl implements a two-dimensional look and feel. SEC3DTabControl implements a three-dimensional look and feel with optional icon. The two-dimensional tab control is more space-efficient, while the three-dimensional tab control gives a more elegant look and simpler usage model.
Note, you cannot instantiate SECTabControlBase directly, as it is an abstract base class. Instead, you must instance one of SECTabControl or SEC3DTabControl.
See Also
SECTabControl SEC3DTabControl SECTab SECTabWnd
Class Members
Public Members
Constructors
Constructs an SECTabControlBase object.
Overridable
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
Creates the tab control and attaches it to the SECTabControlBase object.
virtual void Initialize(DWORD dwStyle)
Select the visual attributes of the tab control such as the fonts and colors used to draw it.
virtual SECTab* CreateNewTab() const
A "factory method" used to instantiate a new tab when AddTab or InsertTab is called.
virtual void RecalcLayout()
Called when tab attributes or tab control size has changed to recompute any positions and sizes that
virtual void OnActivateTab(int nTab)
Called when a tab is being activated.
Operations
virtual SECTab* InsertTab(int nIndex, LPCTSTR lpszLabel = NULL, CObject *pClient = NULL, HMENU hMenu = 0, void* pExtra = NULL)
Inserts a new tab with the given label before the currently active tab.
virtual SECTab* AddTab(LPCTSTR lpszLabel = NULL, CObject* pClient = NULL, HMENU hMenu = 0, void* pExtra = NULL)
Appends a new tab to the end of the existing array of tabs.
virtual void SetTabIcon(int nIndex, HICON hIcon)
Specify an icon to add to a given tab.
virtual void SetTabIcon(int nIndex, UINT nIDIcon, int cx=SEC_TAB_DEFICON_CX, int cy=SEC_TAB_DEFICON_CY)
Specify an icon to add to a given tab.
virtual void SetTabIcon(int nIndex, LPCTSTR lpszResourceName, int cx=SEC_TAB_DEFICON_CX, int cy=SEC_TAB_DEFICON_CY)
Specify an icon to add to a given tab.
virtual void DeleteTab(int nTab)
Removes the tab at the specifed index.
virtual void RenameTab(int nTab, LPCTSTR lpszLabel)
Gives a new name to the tab at the specified index.
virtual void ActivateTab(int nTab)
Causes the specified tab to become the active tab.
virtual void SelectTab(int nTab)
Selects the tab with the given index.
virtual void ClearSelection()
All tabs are marked as unselected.
virtual void ScrollToTab(int nTab)
The specified tab is scrolled into view.
virtual void InvalidateTab(int nTab)
Trigger a redraw of the specified tab.
Queries
int GetTabCount() const
Returns the number of tabs.
BOOL GetTabInfo(int nTab, LPCTSTR& lpszLabel, BOOL& bSelected, CObject*& pClient, HMENU& hMenu, void*& pExtra) const
Returns information about the tab with the supplied index.
BOOL FindTab(const CObject* const pClient, int& nTab) const
Returns the index of the tab with the supplied client data.
BOOL GetActiveTab(int& nTab) const
If any tab is active, its index is returned.
BOOL TabExists(CObject* pClient) const
Checks to see if the particular tab exists.
BOOL TabExists(int nTab) const
Checks to see if the tab corresponding to the particular index exists.
Protected Members
Queries
SECTab& GetTab(int nTab) const
Returns a reference to the specified tab object.
SECTab* GetTabPtr(int nTab) const
Returns a pointer to the specified tab object.