sizecbar.h
上传用户:asikq0571
上传日期:2014-07-12
资源大小:528k
文件大小:7k
源码类别:

Internet/IE编程

开发平台:

Visual C++

  1. #if !defined(__SIZECBAR_H__)
  2. #define __SIZECBAR_H__
  3. #include <afxpriv.h>    // for CDockContext
  4. #include <afxtempl.h>   // for CTypedPtrArray
  5. #if _MSC_VER >= 1000
  6. #pragma once
  7. #endif // _MSC_VER >= 1000
  8. #if defined(_SCB_MINIFRAME_CAPTION) && !defined(_SCB_REPLACE_MINIFRAME)
  9.     #error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME"
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////
  12. // CSCBDockBar dummy class for access to protected members
  13. class CSCBDockBar : public CDockBar
  14. {
  15.     friend class CSizingControlBar;
  16. };
  17. /////////////////////////////////////////////////////////////////////////
  18. // CSizingControlBar control bar styles
  19. #define SCBS_EDGELEFT       0x00000001
  20. #define SCBS_EDGERIGHT      0x00000002
  21. #define SCBS_EDGETOP        0x00000004
  22. #define SCBS_EDGEBOTTOM     0x00000008
  23. #define SCBS_EDGEALL        0x0000000F
  24. #define SCBS_SHOWEDGES      0x00000010
  25. #define SCBS_SIZECHILD      0x00000020
  26. /////////////////////////////////////////////////////////////////////////
  27. // CSizingControlBar control bar
  28. #ifndef baseCSizingControlBar
  29. #define baseCSizingControlBar CControlBar
  30. #endif
  31. class CSizingControlBar;
  32. typedef CTypedPtrArray <CPtrArray, CSizingControlBar*> CSCBArray;
  33. class CSizingControlBar : public baseCSizingControlBar
  34. {
  35.     DECLARE_DYNAMIC(CSizingControlBar);
  36. // Construction
  37. public:
  38.     CSizingControlBar();
  39.     virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
  40.         CSize sizeDefault, BOOL bHasGripper,
  41.         UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
  42.     virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
  43.         UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
  44. // Attributes
  45. public:
  46.     const BOOL IsFloating() const;
  47.     const BOOL IsHorzDocked() const;
  48.     const BOOL IsVertDocked() const;
  49.     const BOOL IsSideTracking() const;
  50.     const BOOL GetSCBStyle() const {return m_dwSCBStyle;}
  51. // Operations
  52. public:
  53. #if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
  54.     void EnableDocking(DWORD dwDockStyle);
  55. #endif
  56.     virtual void LoadState(LPCTSTR lpszProfileName);
  57.     virtual void SaveState(LPCTSTR lpszProfileName);
  58.     static void GlobalLoadState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
  59.     static void GlobalSaveState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
  60.     void SetSCBStyle(DWORD dwSCBStyle)
  61.         {m_dwSCBStyle = (dwSCBStyle & ~SCBS_EDGEALL);}
  62. // Overridables
  63.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  64. // Overrides
  65. public:
  66.     // ClassWizard generated virtual function overrides
  67.     //{{AFX_VIRTUAL(CSizingControlBar)
  68.     public:
  69.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  70.     virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
  71.     //}}AFX_VIRTUAL
  72. // Implementation
  73. public:
  74.     virtual ~CSizingControlBar();
  75.     
  76. protected:
  77.     // implementation helpers
  78.     UINT GetEdgeHTCode(int nEdge);
  79.     BOOL GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge);
  80.     virtual void StartTracking(UINT nHitTest, CPoint point);
  81.     virtual void StopTracking();
  82.     virtual void OnTrackUpdateSize(CPoint& point);
  83.     virtual void OnTrackInvertTracker();
  84.     virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
  85.     virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID);
  86.     virtual void AlignControlBars();
  87.     void GetRowInfo(int& nFirst, int& nLast, int& nThis);
  88.     void GetRowSizingBars(CSCBArray& arrSCBars);
  89.     void GetRowSizingBars(CSCBArray& arrSCBars, int& nThis);
  90.     BOOL NegotiateSpace(int nLengthTotal, BOOL bHorz);
  91. protected:
  92.     DWORD   m_dwSCBStyle;
  93.     UINT    m_htEdge;
  94.     CSize   m_szHorz;
  95.     CSize   m_szVert;
  96.     CSize   m_szFloat;
  97.     CSize   m_szMinHorz;
  98.     CSize   m_szMinVert;
  99.     CSize   m_szMinFloat;
  100.     int     m_nTrackPosMin;
  101.     int     m_nTrackPosMax;
  102.     int     m_nTrackPosOld;
  103.     int     m_nTrackEdgeOfs;
  104.     BOOL    m_bTracking;
  105.     BOOL    m_bKeepSize;
  106.     BOOL    m_bParentSizing;
  107.     BOOL    m_bDragShowContent;
  108.     UINT    m_nDockBarID;
  109.     int     m_cxEdge;
  110. // Generated message map functions
  111. protected:
  112.     //{{AFX_MSG(CSizingControlBar)
  113.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  114.     afx_msg void OnNcPaint();
  115.     afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  116.     afx_msg UINT OnNcHitTest(CPoint point);
  117.     afx_msg void OnCaptureChanged(CWnd *pWnd);
  118.     afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
  119.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  120.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  121.     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  122.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  123.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  124.     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  125.     afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
  126.     afx_msg void OnPaint();
  127.     afx_msg void OnClose();
  128.     afx_msg void OnSize(UINT nType, int cx, int cy);
  129.     //}}AFX_MSG
  130.     afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
  131.     DECLARE_MESSAGE_MAP()
  132. #ifdef _SCB_REPLACE_MINIFRAME
  133.     friend class CSCBMiniDockFrameWnd;
  134. #endif //_SCB_REPLACE_MINIFRAME
  135. };
  136. #ifdef _SCB_REPLACE_MINIFRAME
  137. #ifndef _SCB_MINIFRAME_CAPTION
  138. /////////////////////////////////////////////////////////////////////////
  139. // CSCBDockContext dockcontext
  140. class CSCBDockContext : public CDockContext
  141. {
  142. public:
  143. // Construction
  144.     CSCBDockContext(CControlBar* pBar) : CDockContext(pBar) {}
  145. // Drag Operations
  146.     virtual void StartDrag(CPoint pt);
  147. };
  148. #endif //_SCB_MINIFRAME_CAPTION
  149. /////////////////////////////////////////////////////////////////////////
  150. // CSCBMiniDockFrameWnd miniframe
  151. #ifndef baseCSCBMiniDockFrameWnd
  152. #define baseCSCBMiniDockFrameWnd CMiniDockFrameWnd
  153. #endif
  154. class CSCBMiniDockFrameWnd : public baseCSCBMiniDockFrameWnd
  155. {
  156.     DECLARE_DYNCREATE(CSCBMiniDockFrameWnd)
  157. // Overrides
  158.     // ClassWizard generated virtual function overrides
  159.     //{{AFX_VIRTUAL(CSCBMiniDockFrameWnd)
  160.     public:
  161.     virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
  162.     //}}AFX_VIRTUAL
  163. // Implementation
  164. public:
  165.     CSizingControlBar* GetSizingControlBar();
  166.     //{{AFX_MSG(CSCBMiniDockFrameWnd)
  167.     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  168.     afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  169.     afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
  170.     afx_msg void OnSize(UINT nType, int cx, int cy);
  171.     //}}AFX_MSG
  172.     DECLARE_MESSAGE_MAP()
  173. };
  174. #endif //_SCB_REPLACE_MINIFRAME
  175. #endif // !defined(__SIZECBAR_H__)