#if !defined(AFX_HYSIZINGCONTROLBAR_H__8FCCE5FF_62BB_477A_B6A8_DC016F9D6670__INCLUDED_) #define AFX_HYSIZINGCONTROLBAR_H__8FCCE5FF_62BB_477A_B6A8_DC016F9D6670__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #if defined(_SCB_MINIFRAME_CAPTION) && !defined(_SCB_REPLACE_MINIFRAME) #error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME" #endif #include "shsSCBDockContext.h" // for CHYSCBDockContext class #include "afxtempl.h" // for CTypedPtrArray class // CHYSizeingControlBar 的样式 #define SCBS_EDGELEFT 0x00000001 #define SCBS_EDGERIGHT 0x00000002 #define SCBS_EDGETOP 0x00000004 #define SCBS_EDGEBOTTOM 0x00000008 #define SCBS_EDGEALL 0x0000000F #define SCBS_SHOWEDGES 0x00000010 #define SCBS_SIZECHILD 0x00000020 int CALLBACK EnumFontFamProc(ENUMLOGFONT FAR *lpelf, NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam); class CHYSizingControlBar; typedef CTypedPtrArray CHYSCBArray; class CHYSizingControlBar : public CControlBar { DECLARE_DYNAMIC(CHYSizingControlBar); ////////////////////////////////////////////////////////////////////////// // 成员函数 ////////////////////////////////////////////////////////////////////////// public: CHYSizingControlBar(); virtual ~CHYSizingControlBar(); // 老式的创建函数,这里仍保留是因为保持向前继承 virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd, CSize sizeDefault, BOOL bHasGripper, UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP); // 常用的创建函数 virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd, UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP); // 属性 const BOOL IsFloating() const; // 是否浮动 const BOOL IsHorzDocked() const; // 是否水平停靠 const BOOL IsVertDocked() const; // 是否垂直停靠 const BOOL IsSideTracking() const; // 是否正在拖动边(停靠状态下调整大小) const BOOL GetSCBStyle() const {return m_dwSCBStyle;} // 得到SCB(SizeControlBar)的样式 // 方法 #if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION) virtual void EnableDocking(DWORD dwDockStyle); // 如何停靠 #endif virtual void LoadState(LPCTSTR lpszProfileName); // Create创建后必须调用该函数 virtual void SaveState(LPCTSTR lpszProfileName); // 在CMainFrame's Onclose或DestroyWindow()中调用 static void GlobalLoadState(CFrameWnd* pFrame, LPCTSTR lpszProfileName); static void GlobalSaveState(CFrameWnd* pFrame, LPCTSTR lpszProfileName); virtual void SetSCBStyle(DWORD dwSCBStyle); protected: UINT GetEdgeHTCode(int nEdge); BOOL GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge); virtual void StartTracking(UINT nHitTest, CPoint point); virtual void StopTracking(); virtual void OnTrackUpdateSize(CPoint& point); virtual void OnTrackInvertTracker(); virtual void NcPaintGripper(CDC* pDC, CRect rcClient); virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID); virtual void AlignControlBars(); void GetRowInfo(int& nFirst, int& nLast, int& nThis); void GetRowSizingBars(CHYSCBArray& arrSCBars); void GetRowSizingBars(CHYSCBArray& arrSCBars, int& nThis); BOOL NegotiateSpace(int nLengthTotal, BOOL bHorz); ////////////////////////////////////////////////////////////////////////// // 成员变量 ////////////////////////////////////////////////////////////////////////// public: protected: DWORD m_dwSCBStyle; // SCB(SizeControlBar)的样式 UINT m_htEdge; // 拖动的边(停靠状态下调整大小) HTLEFT | HTRIGHT CSize m_szHorz; // 水平方向放置时的尺寸 CSize m_szVert; // 垂直方向放置时的尺寸 CSize m_szFloat; // 浮动放置时的尺寸 CSize m_szMinHorz; // 水平方向放置时的最小尺寸 CSize m_szMinVert; // 垂直方向放置时的最小尺寸 CSize m_szMinFloat; // 浮动放置时的最小尺寸 int m_nTrackPosMin; int m_nTrackPosMax; int m_nTrackPosOld; int m_nTrackEdgeOfs; BOOL m_bTracking; // 正在拖动边(停靠状态下调整大小) BOOL m_bKeepSize; // 未知 BOOL m_bParentSizing; // 未知 BOOL m_bDragShowContent; UINT m_nDockBarID; // 保持的值 AFX_IDW_DOCKBAR_TOP | AFX_IDW_DOCKBAR_BOTTOM.. int m_cxEdge; ////////////////////////////////////////////////////////////////////////// // 消息或虚函数 ////////////////////////////////////////////////////////////////////////// public: virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler); //{{AFX_VIRTUAL(CSizingControlBar) public: virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz); // 固定布置 virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);// 动态布置 //}}AFX_VIRTUAL protected: //{{AFX_MSG(CSizingControlBar) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnNcPaint(); afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp); afx_msg void OnPaint(); afx_msg LRESULT OnNcHitTest(CPoint point); afx_msg void OnCaptureChanged(CWnd *pWnd); afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point); afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos); afx_msg void OnClose(); afx_msg void OnSize(UINT nType, int cx, int cy); //}}AFX_MSG afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() #ifdef _SCB_REPLACE_MINIFRAME friend class CHYSCBMiniDockFrameWnd; #endif //_SCB_REPLACE_MINIFRAME }; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // 这里定义一个CHYSCBDockBar类是为了访问CDockBar的保护函数和变量 class CHYSCBDockBar : public CDockBar { friend class CHYSizingControlBar; }; #endif