★★★★★★★★★★★★★★★★★★★★★★★★★★★★
//////////////////////////////////////////////////////////////
// toolbar docking support
// 没有基类
class CDockContext
{
public:
// Construction
CDockContext(CControlBar* pBar);
// Attributes
CPoint m_ptLast; // last mouse position during drag
CRect m_rectLast;
CSize m_sizeLast;
BOOL m_bDitherLast;
// Rectangles used during dragging or resizing
CRect m_rectDragHorz;
CRect m_rectDragVert;
CRect m_rectFrameDragHorz;
CRect m_rectFrameDragVert;
CControlBar* m_pBar; // the toolbar that created this context
CFrameWnd* m_pDockSite; // the controlling frame of the CControlBar
DWORD m_dwDockStyle; // allowable dock styles for bar
DWORD m_dwOverDockStyle; // style of dock that rect is over
DWORD m_dwStyle; // style of control bar
BOOL m_bFlip; // if shift key is down
BOOL m_bForceFrame; // if ctrl key is down
CDC* m_pDC; // where to draw during drag
BOOL m_bDragging;
int m_nHitTest;
UINT m_uMRUDockID;
CRect m_rectMRUDockPos;
DWORD m_dwMRUFloatStyle;
CPoint m_ptMRUFloatPos;
// Drag Operations
virtual void StartDrag(CPoint pt);
void Move(CPoint pt); // called when mouse has moved
void EndDrag(); // drop
void OnKey(int nChar, BOOL bDown);
// CControlBarInfo - used for docking serialization
// 没有基类
class CControlBarInfo
{
public:
// Implementation
CControlBarInfo();
// Attributes
UINT m_nBarID; // ID of this bar
BOOL m_bVisible; // visibility of this bar
BOOL m_bFloating; // whether floating or not
BOOL m_bHorz; // orientation of floating dockbar
BOOL m_bDockBar; // TRUE if a dockbar
CPoint m_pointPos; // topleft point of window
UINT m_nMRUWidth; // MRUWidth for Dynamic Toolbars
BOOL m_bDocking; // TRUE if this bar has a DockContext
UINT m_uMRUDockID; // most recent docked dockbar
CRect m_rectMRUDockPos; // most recent docked position
DWORD m_dwMRUFloatStyle; // most recent floating orientation
CPoint m_ptMRUFloatPos; // most recent floating position
CPtrArray m_arrBarID; // bar IDs for bars contained within this one
CControlBar* m_pBar; // bar which this refers to (transient)
void Serialize(CArchive& ar, CDockState* pDockState);
BOOL LoadState(LPCTSTR lpszProfileName, int nIndex, CDockState* pDockState);
BOOL SaveState(LPCTSTR lpszProfileName, int nIndex);
};
★★★★★★★★★★★★★★★★★★★★★★★★★★★★
// CDockBar - used for docking
class CDockBar : public CControlBar
{
DECLARE_DYNAMIC(CDockBar)
// Construction
public:
CDockBar(BOOL bFloating = FALSE); // TRUE if attached to CMiniDockFrameWnd
BOOL Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID);
// Attributes
BOOL m_bFloating;
virtual BOOL IsDockBar() const;
int GetDockedCount() const;
virtual int GetDockedVisibleCount() const;