CMFCOutlookBarPane Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

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.

class CMFCOutlookBarPane : public CMFCToolBar  

Public Constructors

NameDescription
CMFCOutlookBarPane::CMFCOutlookBarPaneDefault constructor.
CMFCOutlookBarPane::~CMFCOutlookBarPaneDestructor.

Public Methods

NameDescription
CMFCOutlookBarPane::AddButtonAdds a button to the Outlook bar pane.
CMFCOutlookBarPane::CanBeAttachedDetermines whether the pane can be docked to another pane or frame window. (Overrides CBasePane::CanBeAttached.)
CMFCOutlookBarPane::CanBeRestoredDetermines whether the system can restore a toolbar to its original state after customization. (Overrides CMFCToolBar::CanBeRestored.)
CMFCOutlookBarPane::ClearAllFrees the resources used by the images in the Outlook bar pane.
CMFCOutlookBarPane::CreateCreates the Outlook bar pane.
CMFCOutlookBarPane::CreateObjectUsed by the framework to create a dynamic instance of this class type.
CMFCOutlookBarPane::DockCalled by the framework to dock the Outlook bar pane. (Overrides CPane::Dock.)
CMFCOutlookBarPane::EnablePageScrollModeSpecifies whether the scroll arrows on the Outlook bar pane advance the list of buttons by page, or by button.
CMFCOutlookBarPane::GetRegularColorReturns the regular (non-selected) text color of the Outlook bar pane.
CMFCOutlookBarPane::GetThisClassUsed by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCOutlookBarPane::IsBackgroundTextureDetermines whether there is a background image loaded for the Outlook bar pane.
CMFCOutlookBarPane::IsChangeStateDetermines whether a floating pane may be docked. (Overrides CPane::IsChangeState.)
CMFCOutlookBarPane::IsDrawShadedHighlightDetermines whether the button border is shaded when a button is highlighted and a background image is displayed.
CMFCOutlookBarPane::OnBeforeFloatCalled by the framework when a pane is about to float. (Overrides CPane::OnBeforeFloat.)
CMFCOutlookBarPane::RemoveButtonRemoves the button that has a specified command ID.
CMFCOutlookBarPane::RestoreOriginalstateRestores the original state of a toolbar. (Overrides CMFCToolBar::RestoreOriginalState.)
CMFCOutlookBarPane::SetBackColorSets the background color.
CMFCOutlookBarPane::SetBackImageSets the background image.
CMFCOutlookBarPane::SetDefaultStateResets the Outlook bar pane to the original set of buttons.
CMFCOutlookBarPane::SetExtraSpaceSets the number of pixels of padding used around buttons in the Outlook bar pane.
CMFCOutlookBarPane::SetTextColorSets the colors of regular and highlighted text in the Outlook bar pane.
CMFCOutlookBarPane::SetTransparentColorSets the transparent color for the Outlook bar pane.
CMFCOutlookBarPane::SmartUpdateUsed internally to update the Outlook bar. (Overrides CMFCToolBar::SmartUpdate.)

Protected Methods

NameDescription
CMFCOutlookBarPane::EnableContextMenuItemsSpecifies which shortcut menu items are displayed in customization mode.
CMFCOutlookBarPane::RemoveAllButtonsRemoves all the buttons from the Outlook bar pane. (Overrides CMFCToolBar::RemoveAllButtons.)

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

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

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);

CObject

CCmdTarget

CWnd

CBasePane

CPane

CMFCBaseToolBar

CMFCToolBar

CMFCOutlookBarPane

Header: afxoutlookbarpane.h

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.

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

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.

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.

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.

System_CAPS_ICON_note.jpg Note

Context menu is a synonym for shortcut menu.

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.

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.

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.

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.

Removes all the buttons from the Outlook bar pane.

virtual void RemoveAllButtons();

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.

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.

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.

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.

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

void SetExtraSpace()  

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.

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.

Hierarchy Chart
Classes
CMFCToolBar Class
CMFCOutlookBar Class
CMFCOutlookBarTabCtrl Class

Show: