AutoHideBar.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /////////////////////////////////////////////////////////////////////////
  2. //
  3. // CAutoHideBar Version 1.2
  4. //
  5. // Created: Mar 30, 2004
  6. //
  7. /////////////////////////////////////////////////////////////////////////
  8. // Copyright (C) 2004 by Cuick. All rights reserved.
  9. //
  10. // This code is free for personal and commercial use, providing this
  11. // notice remains intact in the source files and all eventual changes are
  12. // clearly marked with comments.
  13. //
  14. // Send bug reports, bug fixes, enhancements, requests, flames, etc. to
  15. // Cuick@163.net
  16. /////////////////////////////////////////////////////////////////////////
  17. #if !defined(AFX_AUTOHIDEBAR_H__FD8E1698_F985_4904_8249_4D92F37ECF80__INCLUDED_)
  18. #define AFX_AUTOHIDEBAR_H__FD8E1698_F985_4904_8249_4D92F37ECF80__INCLUDED_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif // _MSC_VER > 1000
  22. // AutoHideBar.h : header file
  23. //
  24. #include "DockPageBar.h"
  25. #define TID_AUTO_HIDE_DELAY 100
  26. #define TID_SLIDE_IN 0x01
  27. #define TID_SLIDE_OUT 0x02
  28. #define AUTO_HIDE_DELAY_TIMES 400
  29. #define SLIDE_HIDE 0x0100
  30. #define SLIDE_SHOW 0x0000
  31. #define GET_SLIDE_SHOW_HIDE(a) (a&0xFF00)
  32. #define GET_SLIDE_IN_OUT(a) (a&0x00FF)
  33. #define ANIMATE_DISP_STEP 50
  34. #define AUTO_HIDE_BAR_WIDTH 24
  35. #define AHBRS_TOP 0xE82B
  36. #define AHBRS_BOTTOM 0xE82C
  37. #define AHBRS_LEFT 0xE82D
  38. #define AHBRS_RIGHT 0xE82E
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CAHFloatWnd window
  41. class CHideItem;
  42. class CHidePageItem;
  43. class CAHFloatWnd : public CWnd
  44. {
  45. // Construction
  46. public:
  47. CAHFloatWnd();
  48. // Attributes
  49. public:
  50. typedef struct ANIMATE_DISPLAY_PARAM{
  51. CRect rect;
  52. int slideStep;
  53. int slideStepCount;
  54. BOOL bInAnimateDisplay;
  55. DWORD timerId;
  56. }ANIMATE_DISPLAY_PARAM;
  57. DWORD m_dwStyle;
  58. CCloseButton m_biHide;
  59. CStudButton m_stud;
  60. CRect m_captionRect;
  61. BOOL m_bCursorInAutoHideBarItem;
  62. ANIMATE_DISPLAY_PARAM m_animDispParam;
  63. // Operations
  64. public:
  65. // Overrides
  66. // ClassWizard generated virtual function overrides
  67. //{{AFX_VIRTUAL(CAHFloatWnd)
  68. virtual ~CAHFloatWnd();
  69. //}}AFX_VIRTUAL
  70. // Implementation
  71. public:
  72. CHideItem* m_HideItem;
  73. CHidePageItem* m_activePageItem;
  74. void OnStudClick();
  75. CFont m_font;
  76. CString m_Title;
  77. BOOL m_isActive;
  78. BOOL IsHorzDocked(){ return m_dwStyle&CBRS_ORIENT_HORZ ? TRUE:FALSE;}
  79. void StartAnimateDisplay(DWORD dwFlag, DWORD dwTime=300);
  80. void DoSlideStep();
  81. // Generated message map functions
  82. protected:
  83. typedef struct BORDER_WIDTH{
  84. int cx_left;
  85. int cx_right;
  86. int cy_top;
  87. int cy_bottom;
  88. }BORDER_WIDTH;
  89. void GetBorderWidths(DWORD dwStyle,BORDER_WIDTH & borderWidth);
  90. //{{AFX_MSG(CAHFloatWnd)
  91. afx_msg void OnTimer(UINT nIDEvent);
  92. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  93. afx_msg void OnSize(UINT nType, int cx, int cy);
  94. afx_msg void OnNcPaint();
  95. afx_msg LRESULT OnNcHitTest(CPoint point);
  96. afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  97. afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point);
  98. afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  99. afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
  100. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  101. afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
  102. //}}AFX_MSG
  103. DECLARE_MESSAGE_MAP()
  104. };
  105. /////////////////////////////////////////////////////////////////////////////////////
  106. // CHidePageItem
  107. class CHidePageItem : public CPageItem
  108. {
  109. public:
  110. BOOL m_isActive;
  111. CRect m_lastAHFloatWndRect;
  112. public:
  113. CHidePageItem();
  114. virtual ~CHidePageItem();
  115. void Draw(CDC *pDC, BOOL bHorz);
  116. };
  117. /////////////////////////////////////////////////////////////////////////////////////
  118. // CHideItem
  119. class CHideItem
  120. {
  121. public:
  122. CRect m_rect;
  123. CDockPageBar* m_pDockPageBar;
  124. CAHFloatWnd m_wndFloat;
  125. CPtrArray m_arrPags;
  126. CRect m_oldWndRect;
  127. DWORD m_dwStyle;
  128. int m_nActivePage;
  129. CWnd* m_pAutoHideBar;
  130. public:
  131. void RemoveAll();
  132. void Dock();
  133. void Show(int nShow);
  134. BOOL OnMouseMove(CPoint pt);
  135. void UpDateSize(CDC* pDC, CRect* rect);
  136. void AddPageItem(CDockPageBar* pPageBar, CWnd* pWnd, DWORD dwStyle);
  137. CHidePageItem * GetActiveItem();
  138. CHideItem();
  139. virtual ~CHideItem();
  140. void Draw(CDC *pDC);
  141. };
  142. /////////////////////////////////////////////////////////////////////////////
  143. // CAutoHideBar window
  144. class CAutoHideBar : public CControlBar
  145. {
  146. // Construction
  147. public:
  148. CAutoHideBar();
  149. // Attributes
  150. public:
  151. CPtrList m_listBars;
  152. CSize m_size;
  153. CFont m_Font;
  154. CHideItem * m_pCurSelItem;
  155. // Operations
  156. public:
  157. // Overrides
  158. // ClassWizard generated virtual function overrides
  159. //{{AFX_VIRTUAL(CAutoHideBar)
  160. //}}AFX_VIRTUAL
  161. // Implementation
  162. public:
  163. void UpdateBar();
  164. void GetClientRect(CRect* rect);
  165. void UpDateSize();
  166. void HidePageBar(CDockPageBar* pDockPageBar);
  167. void DrawItem(CDC* pDC);
  168. DWORD m_dwStyle;
  169. BOOL Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID);
  170. virtual ~CAutoHideBar();
  171. virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  172. // Generated message map functions
  173. protected:
  174. //{{AFX_MSG(CAutoHideBar)
  175. afx_msg LRESULT OnSizeParent(WPARAM, LPARAM);
  176. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  177. afx_msg void OnPaint();
  178. //}}AFX_MSG
  179. DECLARE_MESSAGE_MAP()
  180. public:
  181. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  182. protected:
  183. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  184. };
  185. /////////////////////////////////////////////////////////////////////////////
  186. // CAutoHideFrame frame
  187. class CAutoHideFrame : public CFrameWnd
  188. {
  189. DECLARE_DYNCREATE(CAutoHideFrame)
  190. protected:
  191. CAutoHideFrame(); // protected constructor used by dynamic creation
  192. // Attributes
  193. public:
  194. // Operations
  195. public:
  196. void EnableDocking(DWORD dwDockStyle);
  197. void GetPureClientRect(LPRECT lpRect);
  198. void BringClientWindowToBottom();
  199. protected:
  200. // Overrides
  201. // ClassWizard generated virtual function overrides
  202. //{{AFX_VIRTUAL(CAutoHideFrame)
  203. //}}AFX_VIRTUAL
  204. // Implementation
  205. protected:
  206. virtual ~CAutoHideFrame();
  207. // Generated message map functions
  208. //{{AFX_MSG(CAutoHideFrame)
  209. //afx_msg LRESULT OnAutoHideOn(WPARAM, LPARAM);
  210. afx_msg void OnDestroy();
  211. //}}AFX_MSG
  212. DECLARE_MESSAGE_MAP()
  213. };
  214. /////////////////////////////////////////////////////////////////////////////
  215. // CMDIAutoHideFrame frame
  216. class CMDIAutoHideFrame : public CMDIFrameWnd
  217. {
  218. DECLARE_DYNCREATE(CMDIAutoHideFrame)
  219. protected:
  220. CMDIAutoHideFrame(); // protected constructor used by dynamic creation
  221. // Attributes
  222. public:
  223. // Operations
  224. public:
  225. void EnableDocking(DWORD dwDockStyle);
  226. void GetPureClientRect(LPRECT lpRect);
  227. void BringClientWindowToBottom();
  228. protected:
  229. // Overrides
  230. // ClassWizard generated virtual function overrides
  231. //{{AFX_VIRTUAL(CAutoHideFrame)
  232. //}}AFX_VIRTUAL
  233. // Implementation
  234. protected:
  235. virtual ~CMDIAutoHideFrame();
  236. // Generated message map functions
  237. //{{AFX_MSG(CAutoHideFrame)
  238. //afx_msg LRESULT OnAutoHideOn(WPARAM, LPARAM);
  239. afx_msg void OnDestroy();
  240. //}}AFX_MSG
  241. DECLARE_MESSAGE_MAP()
  242. };
  243. /////////////////////////////////////////////////////////////////////////////
  244. //{{AFX_INSERT_LOCATION}}
  245. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  246. #endif // !defined(AFX_AUTOHIDEBAR_H__FD8E1698_F985_4904_8249_4D92F37ECF80__INCLUDED_)