CTabbedPane Class
Implements the functionality of a pane with detachable tabs.
class CTabbedPane : public CBaseTabbedPane
Members
Public Constructors
Name |
Description |
---|---|
CTabbedPane::CTabbedPane |
Default constructor. |
Public Methods
Name |
Description |
---|---|
(Overrides CBaseTabbedPane::DetachPane.) |
|
Enables or disables automatic coloring of tabs. |
|
Floats a pane, but only if the pane currently resides in a detachable tab. (Overrides CBaseTabbedPane::FloatTab.) |
|
Returns the size and position of the tab area within the tabbed window. |
|
|
|
Determines whether the tabbed pane can be switched to autohide mode. (Overrides CBaseTabbedPane::HasAutoHideMode.) |
|
Determines whether the tabs are located at the bottom of the window. |
|
Resets all tabbed panes to the default state. |
|
Sets a list of custom colors that can be used when the auto color feature is enabled. |
Data Members
Name |
Description |
---|---|
The default location for tabs in the application. |
|
Runtime class information for a custom CMFCTabCtrl-derived object. |
Remarks
The framework automatically creates an instance of this class when a user attaches one pane to another by pointing to the caption of the second pane. All of the tabbed panes that are created by the framework have an ID of -1.
To specify regular tabs instead of Outlook-style tabs, pass the AFX_CBRS_REGULAR_TABS style to the CDockablePane::CreateEx method.
If you create a tabbed pane with detachable tabs, the pane may be destroyed automatically by the framework, so you should not store the pointer. To get a pointer to the tabbed pane, call the CBasePane::GetParentTabbedPane method.
Example
In this example we create a CTabbedPane object. Next, we use CBaseTabbedPane::AddTab to attach additional tabs.
CTabbedPane* pTabbededBar = new CTabbedPane (TRUE);
if (!pTabbededBar->Create (_T(""), this, CRect (0, 0, 200, 200),
TRUE,
(UINT) -1,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT |
CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Solution Explorer bar\n");
return FALSE; // fail to create
}
pTabbededBar->AddTab (&m_wndClassView);
pTabbededBar->AddTab (&m_wndResourceView);
pTabbededBar->AddTab (&m_wndFileView);
pTabbededBar->EnableDocking(CBRS_ALIGN_ANY);
DockPane(pTabbededBar);
Another way to create a tabbed control bar object is to use CDockablePane::AttachToTabWnd. The AttachToTabWnd method dynamically creates a tabbed pane object using runtime class information set by CDockablePane::SetTabbedPaneRTC.
In this example we create a tabbed pane dynamically, attach two tabs, and make the second tab non-detachable.
DockPane(&m_wndClassView);
CTabbedPane* pTabbedBar = NULL;
m_wndResourceView.AttachToTabWnd (&m_wndClassView, DM_SHOW, TRUE,
(CDockablePane**) &pTabbedBar);
m_wndFileView.AttachToTabWnd (pTabbedBar, DM_SHOW, TRUE,
(CDockablePane**) &pTabbedBar);
pTabbedBar->GetUnderlyingWindow ()->EnableTabDetach (1, FALSE);
Inheritance Hierarchy
Requirements
Header: afxTabbedPane.h