Compartir a través de


CMFCOutlookBar Class

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

A tabbed pane with the visual appearance of the Navigation Pane in Microsoft Outlook 2000 or Outlook 2003. The CMFCOutlookBar object contains a CMFCOutlookBarTabCtrl Class object and a series of tabs. The tabs can be either CMFCOutlookBarPane Class objects or CWnd-derived objects. To the user, the Outlook bar appears as a series of buttons and a display area. When the user clicks a button, the corresponding control or button pane is displayed.

class CMFCOutlookBar : public CBaseTabbedPane

Members

Public Constructors

Name

Description

CMFCOutlookBar::CMFCOutlookBar

Default constructor.

CMFCOutlookBar::~CMFCOutlookBar

Destructor.

Public Methods

Name

Description

CMFCOutlookBar::AllowDestroyEmptyTabbedPane

  (Overrides CBaseTabbedPane::AllowDestroyEmptyTabbedPane.)

CMFCOutlookBar::CanAcceptPane

Determines whether another pane can be docked to the Outlook bar pane. (Overrides CDockablePane::CanAcceptPane.)

CMFCOutlookBar::CanSetCaptionTextToTabName

Determines whether the caption for the tabbed pane displays the same text as the active tab. (Overrides CBaseTabbedPane::CanSetCaptionTextToTabName.)

CMFCOutlookBar::Create

Creates the Outlook bar control.

CMFCOutlookBar::CreateCustomPage

Creates a custom Outlook bar tab.

CMFCOutlookBar::CreateObject

Used by the framework to create a dynamic instance of this class type.

CMFCOutlookBar::DoesAllowDynInsertBefore

Determines whether a user can dock a control bar at the outer edge of the Outlook bar.

CMFCOutlookBar::FloatTab

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

CMFCOutlookBar::GetButtonsFont

Returns the font of the text on the buttons of the Outlook bar.

CMFCOutlookBar::GetTabArea

Returns the size and position of the tab areas on the Outlook bar. (Overrides CBaseTabbedPane::GetTabArea.)

CMFCOutlookBar::GetThisClass

Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.

CMFCOutlookBar::IsMode2003

Determines whether the behavior of the Outlook bar mimics that of Microsoft Office Outlook 2003 (see Remarks).

CMFCOutlookBar::OnAfterAnimation

 

CMFCOutlookBar::OnBeforeAnimation

 

CMFCOutlookBar::OnScroll

 

CMFCOutlookBar::RemoveCustomPage

Removes a custom Outlook bar tab.

CMFCOutlookBar::SetButtonsFont

Sets the font of the text on the buttons of the Outlook bar.

CMFCOutlookBar::SetMode2003

Specifies whether the behavior of the Outlook bar mimics that of Outlook 2003 (see Remarks).

Remarks

For an example of an Outlook bar, see the OutlookDemo Sample: MFC OutlookDemo Application.

Implementing the Outlook Bar

To use the CMFCOutlookBar control in your application, follow these steps:

  1. Embed a CMFCOutlookBar object into the main frame window class.

    class CMainFrame : public CMDIFrameWnd
     { ...
         CMFCOutlookBar         m_wndOutlookBar;
         CMFCOutlookBarPane     m_wndOutlookPane;
    ... };
    
  2. When processing the WM_CREATE message in the main frame, call the CMFCOutlookBar::Create method to create the Outlook bar tab control.

    m_wndOutlookBar.Create (_T("Shortcuts"), this, CRect (0, 0, 100, 100), ID_VIEW_OUTLOOKBAR, WS_CHILD | WS_VISIBLE | CBRS_LEFT);
    
  3. Obtain a pointer to the underlying CMFCOutlookBarTabCtrl by using CBaseTabbedPane::GetUnderlyingWindow.

    CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*) m_wndOutlookBar.GetUnderlyingWindow ();
    
  4. Create a CMFCOutlookBarPane Class object for each tab that contains buttons.

    m_wndOutlookPane.Create (&m_wndOutlookBar, AFX_DEFAULT_TOOLBAR_STYLE, ID_OUTLOOK_PANE_GENERAL, AFX_CBRS_FLOAT | AFX_CBRS_RESIZE);
    // make the Outlook pane detachable (enable docking)
    m_wndOutlookPane.EnableDocking (CBRS_ALIGN_ANY);
    // add buttons
    m_wndOutlookPane.AddButton (theApp.LoadIcon (IDR_MAINFRAME), "About", ID_APP_ABOUT);
    m_wndOutlookPane.AddButton (theApp.LoadIcon (IDR_CUSTOM_OPEN_ICON), "Open", ID_FILE_OPEN);
    
  5. Call CMFCBaseTabCtrl::AddTab to add each new tab. Set the bDetachable parameter to FALSE to make a page non-detachable. Or, use CMFCOutlookBarTabCtrl::AddControl to add detachable pages.

    pOutlookBar->AddTab (&m_wndOutlookPane, "General", (UINT) -1, TRUE); 
    
  6. To add a CWnd-derived control (for example, CMFCShellTreeCtrl Class) as a tab, create the control and call CMFCBaseTabCtrl::AddTab to add it to the Outlook bar.

Nota

You should use unique control IDs for each CMFCOutlookBarPane Class object and for each CWnd-derived object.

To dynamically add or delete new pages at runtime, use CMFCOutlookBar::CreateCustomPage and CMFCOutlookBar::RemoveCustomPage.

Outlook 2003 Mode

In Outlook 2003 mode, the tab buttons are positioned at the bottom of the Outlook bar pane. When there is not sufficient room to display the buttons, they are displayed as icons in a toolbar-like area along the bottom of the pane.

Use CMFCOutlookBar::SetMode2003 to enable Outlook 2003 mode. Use CMFCOutlookBarTabCtrl::SetToolbarImageList to set the bitmap that contains the icons that are displayed on the bottom of the Outlook bar. The icons in the bitmap must be ordered by tab index.

Inheritance Hierarchy

CObject

   CCmdTarget

      CWnd

         CBasePane

            CPane

               CDockablePane

                  CBaseTabbedPane

                     CMFCOutlookBar

Requirements

Header: afxoutlookbar.h

See Also

Reference

Hierarchy Chart

CBaseTabbedPane Class

CMFCOutlookBarTabCtrl Class

CMFCOutlookBarPane Class

Other Resources

MFC Classes