CMFCAutoHideBar Class

The CMFCAutoHideBar class is a special toolbar class that implements the auto-hide feature.

For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

Syntax

class CMFCAutoHideBar : public CPane

Members

Public Constructors

Name Description
CMFCAutoHideBar::CMFCAutoHideBar

Public Methods

Name Description
CMFCAutoHideBar::AddAutoHideWindow
CMFCAutoHideBar::AllowShowOnPaneMenu (Overrides CPane::AllowShowOnPaneMenu.)
CMFCAutoHideBar::CalcFixedLayout (Overrides CBasePane::CalcFixedLayout.)
CMFCAutoHideBar::Create Creates a control bar and attaches it to the CPane object. (Overrides CPane::Create.)
CMFCAutoHideBar::GetFirstAHWindow
CMFCAutoHideBar::GetVisibleCount
CMFCAutoHideBar::OnShowControlBarMenu Called by the framework when a special pane menu is about to be displayed. (Overrides CPane::OnShowControlBarMenu.)
CMFCAutoHideBar::RemoveAutoHideWindow
CMFCAutoHideBar::SetActiveInGroup (Overrides CPane::SetActiveInGroup.)
CMFCAutoHideBar::SetRecentVisibleState
CMFCAutoHideBar::ShowAutoHideWindow
CMFCAutoHideBar::StretchPane Stretches a pane vertically or horizontally. (Overrides CBasePane::StretchPane.)
CMFCAutoHideBar::UnSetAutoHideMode
CMFCAutoHideBar::UpdateVisibleState

Data Members

Name Description
CMFCAutoHideBar::m_nShowAHWndDelay The time delay between the moment when the user places the mouse cursor over a CMFCAutoHideButton Class and the moment when the framework shows the associated window.

Remarks

When the user switches a dock pane to auto-hide mode, the framework automatically creates a CMFCAutoHideBar object. It also creates the necessary CAutoHideDockSite and CMFCAutoHideButton objects. Each CAutoHideDockSite object is associated with an individual CMFCAutoHideButton.

The CMFCAutoHideBar class implements the display of a CAutoHideDockSite when a user's mouse hovers over a CMFCAutoHideButton. When the toolbar receives a WM_MOUSEMOVE message, CMFCAutoHideBar starts a timer. When the timer finishes, it sends the toolbar a WM_TIMER event notification. The toolbar handles this event by checking whether the mouse pointer is positioned over the same auto-hide button that it was positioned over when the timer started. If it is, the attached CAutoHideDockSite is displayed.

You can control the length of the timer's delay by setting m_nShowAHWndDelay. The default value is 400 ms.

Example

The following example demonstrates how to construct a CMFCAutoHideBar object and use its GetDockSiteRow method.

CMFCAutoHideBar *pParentBar = new CMFCAutoHideBar();
CDockingPanesRow *pParentRow = pParentBar->GetDockSiteRow();

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CBasePane

CPane

CMFCAutoHideBar

Requirements

Header: afxautohidebar.h

CMFCAutoHideBar::AddAutoHideWindow

Adds functionality to a CDockablePane window that enables it to auto-hide.

CMFCAutoHideButton* AddAutoHideWindow(
    CDockablePane* pAutoHideWnd,
    DWORD dwAlignment);

Parameters

pAutoHideWnd
[in] The window that you want to hide.

dwAlignment
[in] A value that specifies the alignment of the auto-hide button with the application window.

Return Value

Remarks

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

CMFCAutoHideBar::AllowShowOnPaneMenu

virtual BOOL AllowShowOnPaneMenu() const;

Return Value

Remarks

CMFCAutoHideBar::CalcFixedLayout

virtual CSize CalcFixedLayout(
    BOOL bStretch,
    BOOL bHorz);

Parameters

[in] bStretch

[in] bHorz

Return Value

Remarks

CMFCAutoHideBar::CMFCAutoHideBar

Constructs a CMFCAutoHideBar object.

CMFCAutoHideBar();

Remarks

CMFCAutoHideBar::Create

virtual BOOL Create(
    LPCTSTR lpszClassName,
    DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd,
    UINT nID,
    DWORD dwControlBarStyle = AFX_DEFAULT_PANE_STYLE,
    CCreateContext* pContext = NULL);

Parameters

lpszClassName

dwStyle

rect

pParentWnd

nID

dwControlBarStyle

pContext

Return Value

Remarks

CMFCAutoHideBar::GetFirstAHWindow

Returns a pointer to the first auto-hide window in the application.

CDockablePane* GetFirstAHWindow();

Return Value

The first auto-hide window in the application, or NULL if there isn't one.

Remarks

CMFCAutoHideBar::GetVisibleCount

Gets the number of visible auto-hide buttons.

int GetVisibleCount();

Return Value

Returns the number of visible auto-hide buttons.

Remarks

CMFCAutoHideBar::m_nShowAHWndDelay

The time delay between the moment when the user places the mouse cursor over a CMFCAutoHideButton Class and the moment when the framework shows the associated window.

int CMFCAutoHideBar::m_nShowAHWndDelay = 400;

Remarks

When the user places the mouse cursor over a CMFCAutoHideButton, there is a slight delay before the framework displays the associated window. This parameter determines the length of that delay in milliseconds.

CMFCAutoHideBar::OnShowControlBarMenu

virtual BOOL OnShowControlBarMenu(CPoint);

Parameters

[in] CPoint

Return Value

Remarks

CMFCAutoHideBar::RemoveAutoHideWindow

Removes and destroys the auto-hide window.

    BOOL RemoveAutoHideWindow(CDockablePane* pAutoHideWnd);

Parameters

CDockablePane* pAutoHideWnd The auto-hide window to remove.

Return Value

TRUE if successful; otherwise FALSE.

Remarks

CMFCAutoHideBar::SetActiveInGroup

Flags an auto-hide bar as active.

virtual void SetActiveInGroup(BOOL bActive);

Parameters

[in] BOOL bActive TRUE to set to active; otherwise FALSE.

Remarks

See CPane::SetActiveInGroup.

CMFCAutoHideBar::SetRecentVisibleState

void SetRecentVisibleState(BOOL bState);

Parameters

bState
[in] State to set.

Remarks

CMFCAutoHideBar::ShowAutoHideWindow

Shows the auto-hide window.

BOOL ShowAutoHideWindow(
    CDockablePane* pAutoHideWnd,
    BOOL bShow,
    BOOL bDelay);

Parameters

pAutoHideWnd
[in] Window to show.

bShow
[in] TRUE to show the window.

bDelay
[in] This parameter is ignored.

Return Value

TRUE if successful; otherwise FALSE.

Remarks

CMFCAutoHideBar::StretchPane

Resizes the auto-hide bar in its collapsed state to fit the CMFCAutoHideButton object.

virtual CSize StretchPane(
    int nLength,
    BOOL bVert);

Parameters

nLength
[in] The value is unused in the base implementation. In derived implementations, use this value to indicate the length of the resized pane.

bVert
[in] The value is unused in the base implementation. In derived implementations, use TRUE to handle the case where the auto-hide bar is collapsed vertically, and FALSE for the case where the auto-hide bar is collapsed horizontally.

Return Value

The resulting size of the resized pane.

Remarks

Derived classes can override this method to customize the behavior.

CMFCAutoHideBar::UnSetAutoHideMode

Disables auto-hide mode for a group of auto-hide bars.

void UnSetAutoHideMode(CDockablePane* pFirstBarInGroup)

Parameters

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

Remarks

CMFCAutoHideBar::UpdateVisibleState

Called by the framework when the auto-hide bar needs to be redrawn.

void UpdateVisibleState();

Remarks

See also

Hierarchy Chart
Classes
CPane Class
CAutoHideDockSite Class
CMFCAutoHideButton Class