CMFCOutlookBarPane Class

 

The latest version of this topic can be found at CMFCOutlookBarPane Class.

INCLUDEcpp_fp_under_construction]

A control derived from CMFCToolBar Class that can be inserted into an Outlook bar ( CMFCOutlookBar Class). The Outlook bar pane contains a column of large buttons. The user can scroll up and down the list of buttons if it is larger than the pane. When the user detaches an Outlook bar pane from the Outlook bar, it can float or dock in the main frame window.

Syntax

class CMFCOutlookBarPane : public CMFCToolBar  

Members

Public Constructors

Name Description
CMFCOutlookBarPane::CMFCOutlookBarPane Default constructor.
CMFCOutlookBarPane::~CMFCOutlookBarPane Destructor.

Public Methods

Name Description
CMFCOutlookBarPane::AddButton Adds a button to the Outlook bar pane.
CMFCOutlookBarPane::CanBeAttached Determines whether the pane can be docked to another pane or frame window. (Overrides CBasePane::CanBeAttached.)
CMFCOutlookBarPane::CanBeRestored Determines whether the system can restore a toolbar to its original state after customization. (Overrides CMFCToolBar::CanBeRestored.)
CMFCOutlookBarPane::ClearAll Frees the resources used by the images in the Outlook bar pane.
CMFCOutlookBarPane::Create Creates the Outlook bar pane.
CMFCOutlookBarPane::CreateObject Used by the framework to create a dynamic instance of this class type.
CMFCOutlookBarPane::Dock Called by the framework to dock the Outlook bar pane. (Overrides CPane::Dock.)
CMFCOutlookBarPane::EnablePageScrollMode Specifies whether the scroll arrows on the Outlook bar pane advance the list of buttons by page, or by button.
CMFCOutlookBarPane::GetRegularColor Returns the regular (non-selected) text color of the Outlook bar pane.
CMFCOutlookBarPane::GetThisClass Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCOutlookBarPane::IsBackgroundTexture Determines whether there is a background image loaded for the Outlook bar pane.
CMFCOutlookBarPane::IsChangeState Determines whether a floating pane may be docked. (Overrides CPane::IsChangeState.)
CMFCOutlookBarPane::IsDrawShadedHighlight Determines whether the button border is shaded when a button is highlighted and a background image is displayed.
CMFCOutlookBarPane::OnBeforeFloat Called by the framework when a pane is about to float. (Overrides CPane::OnBeforeFloat.)
CMFCOutlookBarPane::RemoveButton Removes the button that has a specified command ID.
CMFCOutlookBarPane::RestoreOriginalstate Restores the original state of a toolbar. (Overrides CMFCToolBar::RestoreOriginalState.)
CMFCOutlookBarPane::SetBackColor Sets the background color.
CMFCOutlookBarPane::SetBackImage Sets the background image.
CMFCOutlookBarPane::SetDefaultState Resets the Outlook bar pane to the original set of buttons.
CMFCOutlookBarPane::SetExtraSpace Sets the number of pixels of padding used around buttons in the Outlook bar pane.
CMFCOutlookBarPane::SetTextColor Sets the colors of regular and highlighted text in the Outlook bar pane.
CMFCOutlookBarPane::SetTransparentColor Sets the transparent color for the Outlook bar pane.
CMFCOutlookBarPane::SmartUpdate Used internally to update the Outlook bar. (Overrides CMFCToolBar::SmartUpdate.)

Protected Methods

Name Description
CMFCOutlookBarPane::EnableContextMenuItems Specifies which shortcut menu items are displayed in customization mode.
CMFCOutlookBarPane::RemoveAllButtons Removes all the buttons from the Outlook bar pane. (Overrides CMFCToolBar::RemoveAllButtons.)

Remarks

For information about how to implement an Outlook bar, see CMFCOutlookBar Class.

For an example of an Outlook bar, see the OutlookDemo sample project.

Example

The following example demonstrates how to use various methods of the CMFCOutlookBarPane class. The example shows how to create an Outlook bar pane, enable the page scroll mode, enable docking, and set the background color of the Outlook bar. This code snippet is part of the Outlook Multi Views sample.

 CMFCOutlookBarPane      m_wndShortcutsPane1;
  CImageList images;
    images.Create (IDB_SHORTCUTS, 32, 0, RGB (255, 0, 255));

    // Create first page:
    m_wndShortcutsPane1.Create (&m_wndShortcutsBar, AFX_DEFAULT_TOOLBAR_STYLE, ID_SHORTCUTS_PANE_1);
    // The this pointer points to a CMainFrame class which extends the CFrameWnd class
    m_wndShortcutsPane1.SetOwner (this);
    m_wndShortcutsPane1.EnableTextLabels ();
    m_wndShortcutsPane1.EnableDocking (CBRS_ALIGN_ANY);
    m_wndShortcutsPane1.EnablePageScrollMode();
    m_wndShortcutsPane1.SetBackColor(RGB(0,255,0));
    
    m_wndShortcutsPane1.AddButton (images.ExtractIcon (0), _T("View 1"), ID_SHORTCUT_1);
    m_wndShortcutsPane1.AddButton (images.ExtractIcon (1), _T("View 2"), ID_SHORTCUT_2);
    m_wndShortcutsPane1.AddButton (images.ExtractIcon (2), _T("View 3"), ID_SHORTCUT_3);
    m_wndShortcutsPane1.AddButton (images.ExtractIcon (3), _T("View 4"), ID_SHORTCUT_4);

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CBasePane

CPane

CMFCBaseToolBar

CMFCToolBar

CMFCOutlookBarPane

Requirements

Header: afxoutlookbarpane.h

CMFCOutlookBarPane::AddButton

Adds a button to the Outlook bar pane.

BOOL AddButton(
    UINT uiImage,  
    LPCTSTR lpszLabel,  
    UINT iIdCommand,  
    int iInsertAt=-1);

 
BOOL AddButton(
    UINT uiImage,  
    UINT uiLabel,  
    UINT iIdCommand,  
    int iInsertAt=-1);

 
BOOL AddButton(
    LPCTSTR szBmpFileName,  
    LPCTSTR szLabel,  
    UINT iIdCommand,  
    int iInsertAt=-1);

 
BOOL AddButton(
    HBITMAP hBmp,  
    LPCTSTR lpszLabel,  
    UINT iIdCommand,  
    int iInsertAt=-1);

 
BOOL AddButton(
    HICON hIcon,  
    LPCTSTR lpszLabel,  
    UINT iIdCommand,  
    int iInsertAt=-1,  
    BOOL bAlphaBlend=FALSE);

Parameters

[in] uiImage
Specifies the resource identifier of a bitmap.

[in] lpszLabel
Specifies the button's text.

[in] iIdCommand
Specifies the button control's ID.

[in] iInsertAt
Specifies the zero-based index on the outlook bar's page at which to insert the button.

[in] uiLabel
A string resource ID.

[in] szBmpFileName
Specifies the name of the disk image file to load.

[in] szLabel
Specifies the button's text.

[in] hBmp
A handle to a button's bitmap.

[in] hIcon
A handle to a buttons' icon.

Return Value

TRUE if a button was added successfully; otherwise FALSE.

Remarks

Use this method to insert a new button into an Outlook bar's page. The button's image can be loaded either from the application resources or from a disk file.

If the page ID specified by uiPageID is -1, the button is inserted into the first page.

If the index specified by iInsertAt is -1, the button is added at the end of the page.

CMFCOutlookBarPane::CanBeAttached

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.

virtual BOOL CanBeAttached() const;  

Return Value

Remarks

CMFCOutlookBarPane::ClearAll

Frees the resources used by the images on the Outlook bar pane.

void ClearAll();

Remarks

This method directly calls CMFCToolBarImages::Clear, which is called on the images that are used by the Outlook bar pane.

CMFCOutlookBarPane::Create

Creates the Outlook bar pane.

virtual BOOL Create(
    CWnd* pParentWnd,  
    DWORD dwStyle=AFX_DEFAULT_TOOLBAR_STYLE,  
    UINT uiID=(UINT)-1,  
    DWORD dwControlBarStyle=0);

Parameters

[in] pParentWnd
Specifies the parent window of the Outlook bar pane control. Must not be NULL.

[in] dwStyle
The window style. For a list of window styles, see Window Styles.

[in] uiID
The control ID. Must be unique to enable saving of the control's state.

[in] dwControlBarStyle
Specifies special styles that define the behavior of the Outlook bar pane control when it is detached from the Outlook bar.

Return Value

TRUE if the method was successful; otherwise FALSE.

Remarks

To construct a CMFCOutlookBarPane object, first call the constructor, and then call Create, which creates the Outlook bar pane control and attaches it to the CMFCOutlookBarPane object.

For more information about dwControlBarStyle see CBasePane::CreateEx.

CMFCOutlookBarPane::EnableContextMenuItems

Specifies which shortcut menu items are displayed in customization mode.

virtual BOOL EnableContextMenuItems(
    CMFCToolBarButton* pButton,  
    CMenu* pPopup);

Parameters

[in] pButton
A pointer to a toolbar button that a user clicked.

[in] pPopup
A pointer to the shortcut menu.

Return Value

Returns TRUE if the shortcut menu should be displayed; otherwise FALSE.

Remarks

Override this method to modify the framework standard shortcut menu that the framework displays in customization mode.

The default implementation checks the customization mode ( CMFCToolBar::IsCustomizeMode) and if it is set to TRUE, disables all the shortcut menu items except Delete. Then, it just passes the input parameters to CMFCToolBar::EnableContextMenuItems.

Note

Context menu is a synonym for shortcut menu.

CMFCOutlookBarPane::EnablePageScrollMode

Specifies whether the scroll arrows on the Outlook bar pane advance the list of buttons page by page, or button by button.

void EnablePageScrollMode(BOOL bPageScroll=TRUE);

Parameters

[in] bPageScroll
If TRUE, enable the page scroll mode. If FALSE, disable the page scroll mode.

CMFCOutlookBarPane::GetRegularColor

Returns the regular (that is, non-selected) text color of the Outlook bar pane.

DECLARE_MESSAGE_MAPCOLORREF GetRegularColor() const;  

Return Value

The current text color as an RGB color value.

Remarks

Use CMFCOutlookBarPane::SetTextColor to set the current (regular and selected) text color of the Outlook bar. You can obtain the default text color by calling the GetSysColor function with the COLOR_WINDOW index.

CMFCOutlookBarPane::IsBackgroundTexture

Determines whether there is a background image loaded for the Outlook bar pane.

BOOL IsBackgroundTexture() const;  

Return Value

TRUE if there is background image to display; otherwise FALSE.

Remarks

You can add a background image by calling CMFCOutlookBarPane::SetBackImage function.

If there is no background image, the background is painted with a color specified by using CMFCOutlookBarPane::SetBackColor.

CMFCOutlookBarPane::IsDrawShadedHighlight

Determines whether the button border is shaded when a button is highlighted and a background image is displayed.

BOOL IsDrawShadedHighlight() const;  

Return Value

TRUE if button's borders are shaded; otherwise FALSE.

CMFCOutlookBarPane::RemoveAllButtons

Removes all the buttons from the Outlook bar pane.

virtual void RemoveAllButtons();

CMFCOutlookBarPane::RemoveButton

Removes the button that has a specified command ID.

BOOL RemoveButton(UINT iIdCommand);

Parameters

[in] iIdCommand
Specifies the command ID of a button to remove.

Return Value

TRUE if the button was successfully removed; FALSE if the specified command ID is not valid.

CMFCOutlookBarPane::SetBackColor

Sets the background color of the Outlook bar.

void SetBackColor(COLORREF color);

Parameters

[in] color
Specifies the new background color.

Remarks

Call this function to set the current background color for the Outlook bar. The background color is used only if there is no background image.

CMFCOutlookBarPane::SetBackImage

Sets the background image.

void SetBackImage(UINT uiImageID);

Parameters

[in] uiImageID
Specifies the image resource ID.

Remarks

Call this method to set the Outlook bar's background image. The list of background images is managed by the embedded CMFCToolBarImages Class object.

CMFCOutlookBarPane::SetDefaultState

Resets the Outlook bar pane to the original set of buttons.

void SetDefaultState();

Remarks

This method restores the Outlook bar buttons to the original set. This method is like CMFCOutlookBarPane::RestoreOriginalstate, except that it does not trigger a redraw of the Outlook bar pane.

CMFCOutlookBarPane::SetExtraSpace

Sets the number of pixels of padding used around buttons in the Outlook bar pane.

void SetExtraSpace
()  

CMFCOutlookBarPane::SetTextColor

Sets the colors of regular and highlighted text in the Outlook bar pane.

void SetTextColor(
    COLORREF clrRegText,  
    COLORREF clrSelText=0);

Parameters

[in] clrRegText
Specifies the new color for non-selected text.

[in] clrSelText
Specifies the new color for selected text.

CMFCOutlookBarPane::SetTransparentColor

Sets the transparent color for the Outlook bar pane.

void SetTransparentColor(COLORREF color);

Parameters

color
Specifies the new transparent color.

Remarks

The transparent color is required to display transparent images. Any occurrence of this color in an image is painted with the background color instead. There is no blending of background and foreground images.

See Also

Hierarchy Chart
Classes
CMFCToolBar Class
CMFCOutlookBar Class
CMFCOutlookBarTabCtrl Class