Skip to content

Latest commit

 

History

History
408 lines (291 loc) · 13.8 KB

File metadata and controls

408 lines (291 loc) · 13.8 KB
title CMFCAutoHideButton Class | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-windows
ms.tgt_pltfrm
ms.topic reference
f1_keywords
CMFCAutoHideButton
AFXAUTOHIDEBUTTON/CMFCAutoHideButton
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::BringToTop
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::Create
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::GetAlignment
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::GetAutoHideWindow
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::GetParentToolBar
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::GetRect
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::GetSize
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::GetTextSize
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::HighlightButton
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::IsActive
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::IsHighlighted
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::IsHorizontal
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::IsTop
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::IsVisible
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::Move
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::OnDraw
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::OnDrawBorder
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::OnFillBackground
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::ReplacePane
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::ShowAttachedWindow
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::ShowButton
AFXAUTOHIDEBUTTON/CMFCAutoHideButton::UnSetAutoHideMode
dev_langs
C++
helpviewer_keywords
CMFCAutoHideButton class
ms.assetid c80e6b8b-25ca-4d12-9d27-457731028ab0
caps.latest.revision 33
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

CMFCAutoHideButton Class

A button that displays or hides a CDockablePane Class that is configured to hide.

[!INCLUDEcpp_fp_under_construction]

Syntax

class CMFCAutoHideButton : public CObject  

Members

Public Methods

Name Description
CMFCAutoHideButton::BringToTop
CMFCAutoHideButton::Create Creates and initializes the auto-hide button.
CMFCAutoHideButton::GetAlignment Retrieves the alignment of the auto-hide button.
CMFCAutoHideButton::GetAutoHideWindow Returns the CDockablePane object associated with the auto-hide button.
CMFCAutoHideButton::GetParentToolBar
CMFCAutoHideButton::GetRect
CMFCAutoHideButton::GetSize Determines the size of the auto-hide button.
CMFCAutoHideButton::GetTextSize Returns the size of the text label for the auto-hide button.
CMFCAutoHideButton::HighlightButton Highlights auto hide button.
CMFCAutoHideButton::IsActive Indicates whether the auto-hide button is active.
CMFCAutoHideButton::IsHighlighted Returns highlight state of auto hide button.
CMFCAutoHideButton::IsHorizontal Determines whether the auto-hide button is horizontal or vertical.
CMFCAutoHideButton::IsTop
CMFCAutoHideButton::IsVisible Indicates whether the button is visible.
CMFCAutoHideButton::Move
CMFCAutoHideButton::OnDraw The framework calls this method when it draws the auto-hide button.
CMFCAutoHideButton::OnDrawBorder The framework calls this method when it draws the border of an auto-hide button.
CMFCAutoHideButton::OnFillBackground The framework calls this method when it fills the background of an auto-hide button.
CMFCAutoHideButton::ReplacePane
CMFCAutoHideButton::ShowAttachedWindow Shows or hides the associated CDockablePane Class.
CMFCAutoHideButton::ShowButton Shows or hides the auto-hide button.
CMFCAutoHideButton::UnSetAutoHideMode

Remarks

On creation, the CMFCAutoHideButton object is attached to a CDockablePane Class. The CDockablePane object is hidden or displayed as the user interacts with the CMFCAutoHideButton object.

By default, the framework automatically creates a CMFCAutoHideButton when the user turns on auto-hide. The framework can create an element of a custom UI class instead of the CMFCAutoHideButton class. To specify which custom UI class the framework should use, set the static member variable CMFCAutoHideBar::m_pAutoHideButtonRTS equal to the custom UI class. By default, this variable is set to CMFCAutoHideButton.

Example

The following example demonstrates how to construct a CMFCAutoHideButton object and use various methods in the CMFCAutoHideButton class. The example shows how to initialize a CMFCAutoHideButton object by using its Create method, show the associated CDockablePane class, and show the auto-hide button.

[!code-cppNVC_MFC_RibbonApp#32]

Inheritance Hierarchy

CObject

CMFCAutoHideButton

Requirements

Header: afxautohidebutton.h

CMFCAutoHideButton::BringToTop

void BringToTop();

Remarks

CMFCAutoHideButton::Create

Creates and initializes an auto-hide button.

virtual BOOL Create(
    CMFCAutoHideBar* pParentBar,  
    CDockablePane* pAutoHideWnd,  
    DWORD dwAlignment);

Parameters

[in] pParentBar
A pointer to the parent toolbar.

[in] pAutoHideWnd
A pointer to a CDockablePane object. This auto-hide button hides and shows that CDockablePane.

[in] dwAlignment
A value that specifies the alignment of the button with the main frame window.

Return Value

Nonzero if successful; otherwise 0.

Remarks

When you create a CMFCAutoHideButton object, you must associate the auto-hide button with a specific CDockablePane. The user can use the auto-hide button to hide and show the associated CDockablePane.

The dwAlignment parameter indicates where the auto-hide button resides in the application. The parameter can be any one of the following values:

  • CBRS_ALIGN_LEFT

  • CBRS_ALIGN_RIGHT

  • CBRS_ALIGN_TOP

  • CBRS_ALIGN_BOTTOM

CMFCAutoHideButton::GetAlignment

Retrieves the alignment of the auto-hide button.

DWORD GetAlignment() const;  

Return Value

A DWORD value that contains the current alignment of the auto-hide button.

Remarks

The alignment of the auto-hide button indicates where the button resides on the application. It can be any one of the following values:

  • CBRS_ALIGN_LEFT

  • CBRS_ALIGN_RIGHT

  • CRBS_ALIGN_TOP

  • CBRS_ALIGN_BOTTOM

CMFCAutoHideButton::GetAutoHideWindow

Returns the CDockablePane object associated with the auto-hide button.

CDockablePane* GetAutoHideWindow() const;  

Return Value

A pointer to the associated CDockablePane object.

Remarks

To associate an auto-hide button with a CDockablePane, pass the CDockablePane as a parameter to the CMFCAutoHideButton::Create method.

CMFCAutoHideButton::GetParentToolBar

CMFCAutoHideBar* GetParentToolBar();

Return Value

Remarks

CMFCAutoHideButton::GetRect

CRect GetRect() const;  

Return Value

Remarks

CMFCAutoHideButton::GetSize

Determines the size of the auto-hide button.

CSize GetSize() const;  

Return Value

A CSize object that contains the button size.

Remarks

The calculated size includes the size of the border of the auto-hide button.

CMFCAutoHideButton::GetTextSize

Returns the size of the text label for the auto-hide button.

virtual CSize GetTextSize() const;  

Return Value

A CSize object that contains the size of the text for the auto-hide button.

CMFCAutoHideButton::IsActive

Indicates whether the auto-hide button is active.

BOOL IsActive() const;  

Return Value

TRUE if the auto-hide button is active; FALSE otherwise.

Remarks

An auto-hide button is active when the associated CDockablePane Class window is shown.

CMFCAutoHideButton::IsHorizontal

Determines whether the auto-hide button is horizontal or vertical.

BOOL IsHorizontal() const;  

Return Value

Nonzero if the button is horizontal; 0 otherwise.

Remarks

The framework sets the orientation of a CMFCAutoHideButton object when you create it. You can control the orientation by using the dwAlignment parameter in the CMFCAutoHideButton::Create method.

CMFCAutoHideButton::IsTop

BOOL IsTop() const;  

Return Value

Remarks

CMFCAutoHideButton::IsVisible

Indicates whether the auto-hide button is visible.

virtual BOOL IsVisible() const;  

Return Value

TRUE if the button is visible; FALSE otherwise.

CMFCAutoHideButton::OnDraw

The framework calls this method when it draws the auto-hide button.

virtual void OnDraw(CDC* pDC);

Parameters

[in] pDC
A pointer to a device context.

Remarks

If you want to customize the appearance of auto-hide buttons in your application, create a new class derived from CMFCAutoHideButton. In your derived class, override this method.

CMFCAutoHideButton::OnDrawBorder

The framework calls this method when it draws the border of an auto-hide button.

virtual void OnDrawBorder(
    CDC* pDC,  
    CRect rectBounds,  
    CRect rectBorderSize);

Parameters

[in] pDC
A pointer to a device context.

[in] rectBounds
The bounding rectangle of the auto-hide button.

[in] rectBorderSize
The border thickness for each side of the auto-hide button.

Remarks

If you want to customize the border of each auto-hide button in your application, create a new class derived from the CMFCAutoHideButton. In your derived class, override this method.

CMFCAutoHideButton::OnFillBackground

The framework calls this method when it fills the background of an auto-hide button.

virtual void OnFillBackground(
    CDC* pDC,  
    CRect rect);

Parameters

[in] pDC
A pointer to a device context.

[in] rect
The bounding rectangle of the auto-hide button.

Remarks

If you want to customize the background for auto-hide buttons in your application, create a new class derived from the CMFCAutoHideButton. In your derived class, override this method.

CMFCAutoHideButton::ShowAttachedWindow

Shows or hides the associated CDockablePane Class.

void ShowAttachedWindow(BOOL bShow);

Parameters

[in] bShow
A Boolean that specifies whether this method shows the attached CDockablePane.

CMFCAutoHideButton::ShowButton

Shows or hides the auto-hide button.

virtual void ShowButton(BOOL bShow);

Parameters

[in] bShow
A Boolean that specifies whether to show the auto-hide button.

CMFCAutoHideButton::Move

void Move(int nOffset);

Parameters

[in] nOffset

Remarks

CMFCAutoHideButton::ReplacePane

void ReplacePane(CDockablePane* pNewBar);

Parameters

[in] pNewBar

Remarks

CMFCAutoHideButton::UnSetAutoHideMode

Disable auto-hide mode.

virtual void UnSetAutoHideMode(CDockablePane* pFirstBarInGroup);

Parameters

[in] pFirstBarInGroup
A pointer to the first bar in the group.

Remarks

CMFCAutoHideButton::HighlightButton

Highlights the auto hide button.

virtual void HighlightButton(BOOL bHighlight);

Parameters

bHighlight
Specifies the new auto hide button state. TRUE indicates the button is highlighted, FALSE indicates the button is not highlighted.

Remarks

CMFCAutoHideButton::IsHighlighted

Returns the highlight state of the auto hide button.

virtual BOOL IsHighlighted() const;  

Return Value

Returns TRUE if the auto hide button is highlighted; otherwise FALSE.

Remarks

See Also

Hierarchy Chart
Classes
CMFCAutoHideBar Class
CAutoHideDockSite Class