Edit

Share via


CAutoHideDockSite Class

The CAutoHideDockSite extends the CDockSite Class to implement auto-hide dock panes.

Syntax

class CAutoHideDockSite : public CDockSite

Members

Public Constructors

Name Description
Name Description
CAutoHideDockSite::CAutoHideDockSite Constructs a CAutoHideDockSite object.
CAutoHideDockSite::~CAutoHideDockSite Destructor.

Public Methods

Name Description
Name Description
CAutoHideDockSite::AllowShowOnPaneMenu Indicates whether the CAutoHideDockSite is shown on the pane menu.
CAutoHideDockSite::CanAcceptPane Determines whether a base pane object is derived from the CMFCAutoHideBar Class.
CAutoHideDockSite::DockPane Docks a pane to this CAuotHideDockSite object.
CAutoHideDockSite::GetAlignRect Retrieves the size of the dock site in screen coordinates.
CAutoHideDockSite::RepositionPanes Redraws the pane on the CAutoHideDockSite with the global margins and button spacing.
CAutoHideDockSite::SetOffsetLeft Sets the margin on the left side of the docking bar.
CAutoHideDockSite::SetOffsetRight Sets the margin on the right side of the docking bar.
CAutoHideDockSite::UnSetAutoHideMode Calls CMFCAutoHideBar::UnSetAutoHideMode for objects on the CAutoHideDockSite.

Data Members

Name Description
Name Description
CAutoHideDockSite::m_nExtraSpace Defines the size of the space between the toolbars and the edge of the docking bar. This space is measured from either the left edge or the top edge, depending on the alignment for the dock space.

Remarks

When you call CFrameWndEx::EnableAutoHidePanes, the framework automatically creates a CAutoHideDockSite object. In most cases, you should not have to instantiate or use this class directly.

The docking bar is the gap between the left side of the dock pane and the left side of the CMFCAutoHideButton Class.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CBasePane

CDockSite

Example

The following example demonstrates how to retrieve a CAutoHideDockSite object from a CMFCAutoHideBar object, and how to set the left and right margins of the docking bar.

CAutoHideDockSite *pParentDockBar = DYNAMIC_DOWNCAST(CAutoHideDockSite, pParentBar->GetParentDockSite());
pParentDockBar->SetOffsetLeft(10);
pParentDockBar->SetOffsetRight(10);

Requirements

Header: afxautohidedocksite.h

CAutoHideDockSite::CanAcceptPane

Determines whether a base pane is a CMFCAutoHideBar object or derived from CMFCAutoHideBar.

virtual BOOL CanAcceptPane(const CBasePane* pBar) const;

Parameters

pBar
[in] The base pane that the framework tests.

Return Value

TRUE if pBar is derived from CMFCAutoHideBar; FALSE otherwise.

Remarks

If a base pane object is derived from CMFCAutoHideBar, it can contain a CAutoHideDockSite.

CAutoHideDockSite::DockPane

Docks a pane to this CAutoHideDockSite object.

virtual void DockPane(
    CPane* pWnd,
    AFX_DOCK_METHOD dockMethod,
    LPRECT lpRect = NULL);

Parameters

pWnd
[in] The pane that the framework docks.

dockMethod
[in] Docking options for the pane.

lpRect
[in] A rectangle that specifies the boundaries for the docked pane.

Remarks

The default implementation does not use the parameter dockMethod, which is provided for future use.

If lpRect is NULL, the framework puts the pane in the default location on the dock site. If the dock site is horizontal, the default location is at the far left of the dock site. Otherwise, the default location is at the top of the dock site.

CAutoHideDockSite::GetAlignRect

Retrieves the size of the dock site in screen coordinates.

void GetAlignRect(CRect& rect) const;

Parameters

rect
[in] A reference to a rectangle. The method stores the size of the dock site in this rectangle.

Remarks

The rectangle is adjusted for the offset margins so that they are not included.

CAutoHideDockSite::m_nExtraSpace

The size of the space between the edges of the CAutoHideDockSite Class and the CMFCAutoHideBar Class objects.

static int m_nExtraSpace;

Remarks

When a CMFCAutoHideBar is docked at a CAutoHideDockSite, it should not occupy the whole dock site. This global variable controls the extra space between the left or top border of the CMFCAutoHideBar and the corresponding CAutoHideDockSite edge. Whether the top or left edge is used depends on the current alignment.

CAutoHideDockSite::SetOffsetLeft

Sets the margin on the left side of the docking bar.

void SetOffsetLeft(int nOffset);

Parameters

nOffset
[in] The new offset.

Remarks

CMFCAutoHideBar objects are positioned statically on the CAutoHideDockSite object. This means that the user cannot manually change the location of CMFCAutoHideBar objects. The SetOffsetLeft method controls the spacing between the left side of the left-most CMFCAutoHideBar and the left side of the CAutoHideDockSite.

CAutoHideDockSite::SetOffsetRight

Sets the margin on the right side of the docking bar.

void SetOffsetRight(int nOffset);

Parameters

nOffset
[in] The new offset.

Remarks

CMFCAutoHideBar objects are positioned statically on the CAutoHideDockSite object. This means that the user cannot manually change the location of the CMFCAutoHideBar objects. The SetOffsetRight method controls the spacing between the right side of the right-most CMFCAutoHideBar and the right side of the CAutoHideDockSite.

CAutoHideDockSite::RepositionPanes

Redraws the panes on the CAutoHideDockSite.

virtual void RepositionPanes(CRect& rectNewClientArea);

Parameters

rectNewClientArea
[in] A reserved value.

Remarks

The default implementation does not use rectNewClientArea. It redraws the panes with the global toolbar margins and button spacing.

CAutoHideDockSite::UnSetAutoHideMode

Calls CMFCAutoHideBar::UnSetAutoHideMode for objects on the dock site.

void UnSetAutoHideMode(CMFCAutoHideBar* pAutoHideToolbar);

Parameters

pAutoHideToolbar
[in] A pointer to a CMFCAutoHideBar object pane located on the CAutoHideDockSite.

Remarks

This method searches for the row that contains pAutoHideToolbar. It calls CMFCAutoHideBar.UnSetAutoHideMode for all the CMFCAutoHideBar objects on that row. If pAutoHideToolbar is not found or it is NULL, this method calls CMFCAutoHideBar.UnSetAutoHideMode for all the CMFCAutoHideBar objects on the CAutoHideDockSite.

See also

Hierarchy Chart
Classes
CDockSite Class