Delen via


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

CTabbedPane::DetachPane

  (Overrides CBaseTabbedPane::DetachPane.)

CTabbedPane::EnableTabAutoColor

Enables or disables automatic coloring of tabs.

CTabbedPane::FloatTab

Floats a pane, but only if the pane currently resides in a detachable tab. (Overrides CBaseTabbedPane::FloatTab.)

CTabbedPane::GetTabArea

Returns the size and position of the tab area within the tabbed window.

CTabbedPane::GetTabWnd

 

CTabbedPane::HasAutoHideMode

Determines whether the tabbed pane can be switched to autohide mode. (Overrides CBaseTabbedPane::HasAutoHideMode.)

CTabbedPane::IsTabLocationBottom

Determines whether the tabs are located at the bottom of the window.

CTabbedPane::ResetTabs

Resets all tabbed panes to the default state.

CTabbedPane::SetTabAutoColors

Sets a list of custom colors that can be used when the auto color feature is enabled.

Data Members

Name

Description

CTabbedPane::m_bTabsAlwaysTop

The default location for tabs in the application.

CTabbedPane::m_pTabWndRTC

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

CObject

   CCmdTarget

      CWnd

         CBasePane

            CPane

               CDockablePane

                  CBaseTabbedPane

                     CTabbedPane

Requirements

Header: afxTabbedPane.h

See Also

Reference

Hierarchy Chart

CDockablePane Class

CBaseTabbedPane Class

CMFCOutlookBar Class

Other Resources

MFC Classes