CoolControlBar.h
上传用户:sunh8215
上传日期:2010-02-13
资源大小:1616k
文件大小:4k
源码类别:

酒店行业

开发平台:

Visual C++

  1. /*########################################################################
  2. Filename:  CoolControlbar.h
  3. ----------------------------------------------------
  4. Remarks: ...
  5. ----------------------------------------------------
  6.   ########################################################################*/
  7. #if !defined(_ANYOU_COOLCONTROLBAR_H)
  8. #define _ANYOU_COOLCONTROLBAR_H
  9. #if _MSC_VER > 1000
  10. #pragma once
  11. #endif 
  12. #include <afxpriv.h>    // for CDockContext
  13. #include <afxtempl.h>   // for CArray
  14. #define TITLE_HEIGHT 23
  15. #define SIZING_WIDTH 5
  16. #if !defined CBRS_TITLEBAR
  17. #define CBRS_TITLEBAR  CBRS_GRIPPER
  18. #endif 
  19. /*########################################################################
  20.   -------------------------------------------------------------
  21.     CFriendDockBar dummy class for access to protected members
  22.   -------------------------------------------------------------
  23.   ########################################################################*/
  24. class CFriendDockBar : public CDockBar
  25. {
  26.     friend class CCoolControlBar;
  27. };
  28. class CCoolControlBar;
  29. typedef CTypedPtrArray <CPtrArray, CCoolControlBar*> CCoolBarArray;
  30. /*########################################################################
  31.   ------------------------------------------------
  32. class CCoolControlBar
  33.   ------------------------------------------------
  34.   ########################################################################*/
  35. class CCoolControlBar : public CControlBar
  36. {
  37.     DECLARE_DYNAMIC(CCoolControlBar);
  38. // Construction--------------------------------------------------
  39. public:
  40. CCoolControlBar();
  41. virtual ~CCoolControlBar();
  42. BOOL Create(CWnd* pParentWnd, CSize size, UINT dwStyle, UINT uID);
  43. // Attributes----------------------------------------------------
  44. protected:
  45. CSize m_szHorz;
  46.     CSize m_szVert;
  47. CSize m_szFloat;
  48. CSize m_szDefault;
  49. int m_bTrackType;
  50. BOOL m_bParentSizing;
  51. BOOL m_bTracking;
  52. CPoint m_oldPoint;
  53. CRect m_rcCloseButton;
  54. DWORD m_dwButtonState;
  55. static CCoolBarArray m_arrBars; 
  56. // Operations----------------------------------------------------
  57. public:
  58. BOOL IsHorizontal();
  59. int  FindCoolBar(CControlBar* pBar);
  60.     static void LoadStates(LPCTSTR lpszProfileName);
  61.     static void SaveStates(LPCTSTR lpszProfileName);
  62. // Overrides-----------------------------------------------------
  63. //{{AFX_VIRTUAL(CCoolControlBar)
  64. public:
  65. virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  66. virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
  67. virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  68. virtual BOOL DestroyWindow();
  69. //}}AFX_VIRTUAL
  70. // Implementation------------------------------------------------
  71. protected:
  72. int GetLastBar();
  73. int GetFirstBar();
  74. void GetCoolBars(CCoolBarArray &arrCoolBars);
  75. BOOL GetTrackRect(CRect& rcTrack, int nEdge);
  76. void UpdateWndSize(CPoint point);
  77. BOOL AutoSize(int nLengthAvail, BOOL bHorz);
  78. void AutoAlign();
  79. virtual void LoadState(LPCTSTR lpszProfileName);
  80.     virtual void SaveState(LPCTSTR lpszProfileName);
  81. virtual void DrawCloseButton(CDC* pDC, DWORD dwState);
  82. virtual void DrawTitleBar(CDC* pDC, const CRect& rect, BOOL bHorz);
  83. // Generated message map functions-------------------------------
  84. protected:
  85. //{{AFX_MSG(CCoolControlBar)
  86. afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
  87. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  88. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  89. afx_msg void OnNcPaint();
  90. afx_msg void OnPaint();
  91. afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
  92. afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  93. afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
  94. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  95. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  96. afx_msg UINT OnNcHitTest(CPoint point);
  97. //}}AFX_MSG
  98. DECLARE_MESSAGE_MAP()
  99. };
  100. //{{AFX_INSERT_LOCATION}}
  101. #endif // !defined(_ANYOU_COOLCONTROLBAR_H)