แก้ไข

แชร์ผ่าน


CDockSite Class

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

Provides functionality for arranging panes that are derived from the CPane Class into sets of rows.

Syntax

class CDockSite: public CBasePane

Members

Public Methods

Name Description
CDockSite::AddRow
CDockSite::AdjustDockingLayout (Overrides CBasePane::AdjustDockingLayout.)
CDockSite::AdjustLayout (Overrides CBasePane::AdjustLayout.)
CDockSite::AlignDockSite
CDockSite::CalcFixedLayout (Overrides CBasePane::CalcFixedLayout.)
CDockSite::CanAcceptPane (Overrides CBasePane::CanAcceptPane.)
CDockSite::CreateEx (Overrides CBasePane::CreateEx.)
CDockSite::CreateRow
CDockSite::DockPane (Overrides CBasePane::DockPane.)
CDockSite::DoesAllowDynInsertBefore (Overrides CBasePane::DoesAllowDynInsertBefore.)
CDockSite::FindRowIndex
CDockSite::FixupVirtualRects
CDockSite::GetDockSiteID
CDockSite::GetDockSiteRowsList
CDockSite::IsAccessibilityCompatible (Overrides CBasePane::IsAccessibilityCompatible.)
CDockSite::IsDragMode
CDockSite::IsLastRow
CDockSite::IsRectWithinDockSite
CDockSite::IsResizable (Overrides CBasePane::IsResizable.)
CDockSite::MovePane
CDockSite::OnInsertRow
CDockSite::OnRemoveRow
CDockSite::OnResizeRow
CDockSite::OnSetWindowPos
CDockSite::OnShowRow
CDockSite::OnSizeParent
CDockSite::PaneFromPoint Returns a pane that is docked in the dock site at the point specified by the given parameter.
CDockSite::DockPaneLeftOf Docks a pane to the left of another pane.
CDockSite::FindPaneByID Returns the pane that is identified by the given ID.
CDockSite::GetPaneList Returns a list of panes that are docked at the dock site.
CDockSite::RectSideFromPoint
CDockSite::RemovePane
CDockSite::RemoveRow
CDockSite::ReplacePane
CDockSite::RepositionPanes
CDockSite::ResizeDockSite
CDockSite::ResizeRow
CDockSite::ShowPane Shows the pane.
CDockSite::ShowRow
CDockSite::SwapRows

Remarks

The framework creates CDockSite objects automatically when you call CFrameWndEx::EnableDocking. Dock site windows are positioned at the edge of the client area on the main frame window.

You usually do not have to call the services provided by the dock site because CFrameWndEx Class handles these services.

Example

The following example demonstrates how to create an object of the CDockSite class.

AFX_DOCKSITE_INFO info;
CDockSite *pDockBar = (CDockSite*)info.pDockBarRTC->CreateObject();

Inheritance Hierarchy

CObject
└ CCmdTarget
 └ CWnd
  └ CBasePane
   └ CDockSite

Requirements

Header: afxDockSite.h

CDockSite::AddRow

CDockingPanesRow* AddRow(
    POSITION pos,
    int nHeight);

Parameters

[in] pos

[in] nHeight

Return Value

Remarks

CDockSite::AdjustDockingLayout

virtual void AdjustDockingLayout();

Remarks

CDockSite::AdjustLayout

virtual void AdjustLayout();

Remarks

CDockSite::AlignDockSite

void AlignDockSite(
    const CRect& rectToAlignBy,
    CRect& rectResult,
    BOOL bMoveImmediately);

Parameters

[in] rectToAlignBy

[in] rectResult

[in] bMoveImmediately

Remarks

CDockSite::CalcFixedLayout

virtual CSize CalcFixedLayout(
    BOOL bStretch,
    BOOL bHorz);

Parameters

[in] bStretch

[in] bHorz

Return Value

Remarks

CDockSite::CanAcceptPane

virtual BOOL CanAcceptPane(const CBasePane* pBar) const;

Parameters

[in] pBar

Return Value

Remarks

CDockSite::CreateEx

virtual BOOL CreateEx(
    DWORD dwStyleEx,
    DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd,
    DWORD dwControlBarStyle,
    CCreateContext* pContext = NULL);

Parameters

[in] dwStyleEx

[in] dwStyle

[in] rect

[in] pParentWnd

[in] dwControlBarStyle

[in] pContext

Return Value

Remarks

CDockSite::CreateRow

virtual CDockingPanesRow* CreateRow(
    CDockSite* pParentDockBar,
    int nOffset,
    int nRowHeight);

Parameters

[in] pParentDockBar

[in] nOffset

[in] nRowHeight

Return Value

Remarks

CDockSite::DockPane

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

Parameters

[in] pWnd

[in] dockMethod

[in] lpRect

Remarks

CDockSite::DockPaneLeftOf

Docks a pane to the left of another pane.

virtual BOOL DockPaneLeftOf(
    CPane* pBarToDock,
    CPane* pTargetBar);

Parameters

pBarToDock
[in, out] A pointer to the pane to be docked to the left of pTargetBar.

pTargetBar
[in, out] A pointer to the target pane.

Return Value

TRUE if the pane is docked successfully; otherwise, FALSE.

Remarks

CDockSite::DoesAllowDynInsertBefore

virtual BOOL DoesAllowDynInsertBefore() const;

Return Value

Remarks

CDockSite::FindPaneByID

Returns the pane with the given ID.

CPane* FindPaneByID(UINT nID);

Parameters

nID
[in] The command ID of the pane to be found.

Return Value

A pointer to the pane with the specified command ID, or NULL if the pane is not found.

Remarks

CDockSite::FindRowIndex

int FindRowIndex(CDockingPanesRow* pRow);

Parameters

[in] pRow

Return Value

Remarks

CDockSite::FixupVirtualRects

virtual void FixupVirtualRects();

Remarks

CDockSite::GetDockSiteID

virtual UINT GetDockSiteID() const;

Return Value

Remarks

CDockSite::GetDockSiteRowsList

const CObList& GetDockSiteRowsList() const;

Return Value

Remarks

CDockSite::GetPaneList

Returns a list of panes that are docked in the dock site.

const CObList& GetPaneList() const;

Return Value

A read-only reference to the list of panes currently docked in the docking bar.

CDockSite::IsAccessibilityCompatible

virtual BOOL IsAccessibilityCompatible();

Return Value

Remarks

CDockSite::IsDragMode

virtual BOOL IsDragMode() const;

Return Value

Remarks

CDockSite::IsLastRow

bool IsLastRow(CDockingPanesRow* pRow) const;

Parameters

[in] pRow

Return Value

Remarks

CDockSite::IsRectWithinDockSite

BOOL IsRectWithinDockSite(
    CRect rect,
    CPoint& ptDelta);

Parameters

[in] rect

[in] ptDelta

Return Value

Remarks

CDockSite::IsResizable

virtual BOOL IsResizable() const;

Return Value

Remarks

CDockSite::MovePane

virtual BOOL MovePane(
    CPane* pWnd,
    UINT nFlags,
    CPoint ptOffset);

Parameters

[in] pWnd

[in] nFlags

[in] ptOffset

Return Value

Remarks

CDockSite::OnInsertRow

virtual void OnInsertRow(POSITION pos);

Parameters

[in] pos

Remarks

CDockSite::OnRemoveRow

virtual void OnRemoveRow(
    POSITION pos,
    BOOL bByShow = FALSE);

Parameters

[in] pos

[in] bByShow

Remarks

CDockSite::OnResizeRow

virtual int OnResizeRow(
    CDockingPanesRow* pRowToResize,
    int nOffset);

Parameters

[in] pRowToResize

[in] nOffset

Return Value

Remarks

CDockSite::OnSizeParent

virtual void OnSizeParent(
    CRect& rectAvailable,
    UINT nSide,
    BOOL bExpand,
    int nOffset);

Parameters

[in] rectAvailable

[in] nSide

[in] bExpand

[in] nOffset

Remarks

CDockSite::OnSetWindowPos

virtual BOOL OnSetWindowPos(
    const CWnd* pWndInsertAfter,
    const CRect& rectWnd,
    UINT nFlags);

Parameters

[in] pWndInsertAfter

[in] rectWnd

[in] nFlags

Return Value

Remarks

CDockSite::OnShowRow

virtual void OnShowRow(
    POSITION pos,
    BOOL bShow);

Parameters

[in] pos

[in] bShow

Remarks

CDockSite::PaneFromPoint

Returns a pane that is docked in the dock site at the point specified by the given parameter.

virtual CPane* PaneFromPoint(CPoint pt);

Parameters

pt
[in] A point, in screen coordinates, for the pane to retrieve.

Return Value

A pointer to the pane located at the specified point or NULL if no pane was present at the specified point.

Remarks

CDockSite::RectSideFromPoint

static int __stdcall RectSideFromPoint(
    const CRect& rect,
    const CPoint& point);

Parameters

[in] rect

[in] point

Return Value

Remarks

CDockSite::RemovePane

virtual void RemovePane(
    CPane* pWnd,
    AFX_DOCK_METHOD dockMethod);

Parameters

[in] pWnd

[in] dockMethod

Remarks

CDockSite::RemoveRow

void RemoveRow(CDockingPanesRow* pRow);

Parameters

[in] pRow

Remarks

CDockSite::ReplacePane

BOOL ReplacePane(
    CPane* pOldBar,
    CPane* pNewBar);

Parameters

[in] pOldBar

[in] pNewBar

Return Value

Remarks

CDockSite::RepositionPanes

virtual void RepositionPanes(CRect& rectNewClientArea);

Parameters

[in] rectNewClientArea

Remarks

CDockSite::ResizeDockSite

void ResizeDockSite(
    int nNewWidth,
    int nNewHeight);

Parameters

[in] nNewWidth

[in] nNewHeight

Remarks

CDockSite::ResizeRow

int ResizeRow(
    CDockingPanesRow* pRow,
    int nNewSize,
    BOOL bAdjustLayout = TRUE);

Parameters

[in] pRow

[in] nNewSize

[in] bAdjustLayout

Return Value

Remarks

CDockSite::ShowPane

Shows the pane.

virtual BOOL ShowPane(
    CBasePane* pBar,
    BOOL bShow,
    BOOL bDelay,
    BOOL bActivate);

Parameters

pBar
[in, out] A pointer to the pane to be shown or hidden.

bShow
[in] TRUE to specify that the pane is to be shown; FALSE to specify that the pane is to be hidden.

bDelay
[in] TRUE to specify that the layout of the pane should be delayed until after the pane is shown; otherwise, FALSE.

bActivate
[in] This parameter is not used.

Return Value

TRUE if the pane was shown or hidden successfully. FALSE if the specified pane does not belong to this dock site.

Remarks

Call this method to show or hide docked panes. Normally, you do not have to call CDockSite::ShowPane directly, because it is called by the parent frame window or by the base pane.

CDockSite::ShowRow

void ShowRow(
    CDockingPanesRow* pRow,
    BOOL bShow,
    BOOL bAdjustLayout);

Parameters

[in] pRow

[in] bShow

[in] bAdjustLayout

Remarks

CDockSite::SwapRows

void SwapRows(
    CDockingPanesRow* pFirstRow,
    CDockingPanesRow* pSecondRow);

Parameters

[in] pFirstRow

[in] pSecondRow

Remarks

See also

Hierarchy Chart
Classes
CBasePane Class