description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CMFCAutoHideBar Class |
CMFCAutoHideBar Class |
10/18/2018 |
|
|
54c8d84f-de64-4efd-8a47-3ea0ade40a70 |
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.
class CMFCAutoHideBar : public CPane
Name | Description |
---|---|
CMFCAutoHideBar::CMFCAutoHideBar |
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 |
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. |
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.
The following example demonstrates how to construct a CMFCAutoHideBar
object and use its GetDockSiteRow
method.
[!code-cppNVC_MFC_RibbonApp#26]
Header: afxautohidebar.h
Adds functionality to a CDockablePane
window that enables it to auto-hide.
CMFCAutoHideButton* AddAutoHideWindow(
CDockablePane* pAutoHideWnd,
DWORD dwAlignment);
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.
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
virtual BOOL AllowShowOnPaneMenu() const;
virtual CSize CalcFixedLayout(
BOOL bStretch,
BOOL bHorz);
[in] bStretch
[in] bHorz
Constructs a CMFCAutoHideBar object.
CMFCAutoHideBar();
virtual BOOL Create(
LPCTSTR lpszClassName,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
UINT nID,
DWORD dwControlBarStyle = AFX_DEFAULT_PANE_STYLE,
CCreateContext* pContext = NULL);
lpszClassName
dwStyle
rect
pParentWnd
nID
dwControlBarStyle
pContext
Returns a pointer to the first auto-hide window in the application.
CDockablePane* GetFirstAHWindow();
The first auto-hide window in the application, or NULL if there isn't one.
Gets the number of visible auto-hide buttons.
int GetVisibleCount();
Returns the number of visible auto-hide buttons.
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;
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.
virtual BOOL OnShowControlBarMenu(CPoint);
[in] CPoint
Removes and destroys the auto-hide window.
BOOL RemoveAutoHideWindow(CDockablePane* pAutoHideWnd);
CDockablePane* pAutoHideWnd The auto-hide window to remove.
TRUE if successful; otherwise FALSE.
Flags an auto-hide bar as active.
virtual void SetActiveInGroup(BOOL bActive);
[in] BOOL bActive TRUE to set to active; otherwise FALSE.
void SetRecentVisibleState(BOOL bState);
bState
[in] State to set.
Shows the auto-hide window.
BOOL ShowAutoHideWindow(
CDockablePane* pAutoHideWnd,
BOOL bShow,
BOOL bDelay);
pAutoHideWnd
[in] Window to show.
bShow
[in] TRUE to show the window.
bDelay
[in] This parameter is ignored.
TRUE if successful; otherwise FALSE.
Resizes the auto-hide bar in its collapsed state to fit the CMFCAutoHideButton
object.
virtual CSize StretchPane(
int nLength,
BOOL bVert);
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.
The resulting size of the resized pane.
Derived classes can override this method to customize the behavior.
Disables auto-hide mode for a group of auto-hide bars.
void UnSetAutoHideMode(CDockablePane* pFirstBarInGroup)
[in] pFirstBarInGroup A pointer to the first auto-hide bar in the group.
Called by the framework when the auto-hide bar needs to be redrawn.
void UpdateVisibleState();
Hierarchy Chart
Classes
CPane Class
CAutoHideDockSite Class
CMFCAutoHideButton Class