GripDialogBar.h
上传用户:libwxy
上传日期:2007-01-02
资源大小:200k
文件大小:7k
源码类别:

工具条

开发平台:

Visual C++

  1. /////////////////////////////////////////////////////////////////////////////
  2. // This is an extension to the MFC C++ library.
  3. // Copyright (C) 1997-1998 ACPSoft
  4. // All rights reserved.
  5. //
  6. // This source code is only intended as a building
  7. // tool to aid your own development.  This code is
  8. // under the license agreement provided with the
  9. // software. By using this code in your own project(s)
  10. // you agree to the terms in that license.
  11. /////////////////////////////////////////////////////////////////////////////
  12. #if !defined(AFX_GRIPDIALOGBAR_H__E3F8F9A2_CBC9_11D1_9783_726AA5000000__INCLUDED_)
  13. #define AFX_GRIPDIALOGBAR_H__E3F8F9A2_CBC9_11D1_9783_726AA5000000__INCLUDED_
  14. #ifndef NGTB_PROJECT
  15. #define NGTB_EXPORT __declspec(dllimport)
  16. #else
  17. #define NGTB_EXPORT __declspec(dllexport)
  18. #endif
  19. #if _MSC_VER >= 1000
  20. #pragma once
  21. #endif // _MSC_VER >= 1000
  22. #include <afxpriv.h>
  23. /////////////////////////////////////////////////////////////////////////////
  24. // Classes declared in this file
  25. //CObject
  26. //CmdTarget
  27. //CWnd
  28. //CControlbar
  29. //CDialogBar
  30. class CInitDialogBar;
  31. class CGripDialogBar;
  32. //CEdit
  33. class CGripControl;
  34. //CDockContext
  35. class CExDockContext;
  36. /////////////////////////////////////////////////////////////////////////////
  37. /////////////////////////////////////////////////////////////////////////////
  38. // InitDialogBar.h: interface for the CInitDialogBar class.
  39. /////////////////////////////////////////////////////////////////////////////
  40. class NGTB_EXPORT CInitDialogBar : public CDialogBar
  41. {
  42. DECLARE_DYNAMIC(CInitDialogBar)
  43. // Construction / Destruction
  44. public:
  45. CInitDialogBar();
  46. virtual ~CInitDialogBar();
  47. // Attributes
  48. public:
  49. // Operations
  50. public:
  51. BOOL Create(CWnd * pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID);
  52. BOOL Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID);
  53. // Overrides
  54. public:
  55. virtual BOOL OnInitDialogBar();
  56. // ClassWizard generated virtual function overrides
  57. //{{AFX_VIRTUAL(CInitDialogBar)
  58. protected:
  59. virtual void DoDataExchange(CDataExchange* pDX);
  60. //}}AFX_VIRTUAL
  61. // Implementation
  62. public:
  63. // Generated message map functions
  64. protected:
  65. //{{AFX_MSG(CInitDialogBar)
  66. //}}AFX_MSG
  67. DECLARE_MESSAGE_MAP()
  68. };
  69. /////////////////////////////////////////////////////////////////////////////
  70. // class CGripDialogBar: interface for the CGripDialogBar class.
  71. /////////////////////////////////////////////////////////////////////////////
  72. // GBS_STYLE Constants See constructor
  73. // for use of these styles
  74. #define GBS_DOCKAPPST 0x01
  75. #define GBS_DOCKBUTTON 0x02
  76. #define GBS_DOCKCLOSE 0x04
  77. #define GBS_DOCKTITLE 0x08
  78. #define GBS_NOGRADIENT 0x10
  79. #define GBS_NOGRIPBARS 0x20
  80. #define GBS_USECOLOR 0x40
  81. class NGTB_EXPORT CGripDialogBar : public CInitDialogBar  
  82. {
  83. friend CGripControl;
  84. DECLARE_DYNAMIC(CGripDialogBar)
  85. // Construction / Destruction
  86. public:
  87. CGripDialogBar();
  88. CGripDialogBar(UINT n_ID, DWORD Style = GBS_DOCKCLOSE | GBS_USECOLOR, COLORREF clr = RGB(192,192,192));
  89. virtual ~CGripDialogBar();
  90. // Attributes
  91. public:
  92. protected:
  93. BOOL m_bActive;
  94. CGripControl* m_GripBar;
  95. // Operations
  96. public:
  97. void GetCaptionRect(CRect* rect);
  98. DWORD GetGripStyle();
  99. void ModifyGripStyle(DWORD remove, DWORD add);
  100. void SetActiveState(UINT nState);
  101. void StartDrag(CPoint point);
  102. void ToggleDocking();
  103. void View(CFrameWnd* fWnd, BOOL state);
  104. // Overrides
  105. public:
  106. protected:
  107. virtual BOOL OnInitDialogBar();
  108. // ClassWizard generated virtual function overrides
  109. //{{AFX_VIRTUAL(CInitDialogBar)
  110. //}}AFX_VIRTUAL
  111. // Implementation
  112. public:
  113. protected:
  114. void ExcludeCaption(CDC* pDC);
  115. void PaintRect(CDC* dc, int x, int y, int w, int h, COLORREF color);
  116. void RecalcLayout();
  117. // Generated message map functions
  118. public:
  119. protected:
  120. //{{AFX_MSG(CInitDialogBar)
  121. afx_msg void OnClose();
  122. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  123. afx_msg BOOL OnNcActivate(BOOL bActive);
  124. afx_msg void OnPaint();
  125. //}}AFX_MSG
  126. DECLARE_MESSAGE_MAP()
  127. };
  128. /////////////////////////////////////////////////////////////////////////////
  129. // class CGripControl: interface for the CGripControl class.
  130. /////////////////////////////////////////////////////////////////////////////
  131. // Hit Test Constants
  132. #define GHT_CLOSE 0x01
  133. #define GHT_DOCKBUT 0x02
  134. #define GHT_CAPTION 0x03
  135. class NGTB_EXPORT CGripControl : public CEdit
  136. {
  137. friend CGripDialogBar;
  138. DECLARE_DYNCREATE(CGripControl)
  139. // Construction
  140. public:
  141. CGripControl();
  142. CGripControl(UINT nID, DWORD Style, COLORREF clr);
  143. virtual ~CGripControl();
  144. // Attributes
  145. public:
  146. protected:
  147. CBitmap m_bmpCap[2];
  148. CFont m_fontCap;
  149. CFont m_fontTitle;
  150. CGripDialogBar* m_pControlBar;
  151. CRect m_rcCap;
  152. CRect m_rcIcon;
  153. CRect m_rcClose;
  154. CString m_appString;
  155. COLORREF m_ColorCap;
  156. DWORD m_GBStyle;
  157. DWORD m_prevHitTest;
  158. UINT m_nID;
  159. // Operations
  160. public:
  161. void Abolish();
  162. void Fasten(CGripDialogBar* pControlBar);
  163. CString GetBarTitle();
  164. void GetCaptionRect(CRect* rect);
  165. // Overrides
  166. public:
  167. protected:
  168. virtual void CreateFonts();
  169. virtual void OnNcDraw(CDC* pDC);
  170. // ClassWizard generated virtual function overrides
  171. //{{AFX_VIRTUAL(CGripControl)
  172. //}}AFX_VIRTUAL
  173. // Implementation
  174. public:
  175. protected:
  176. void DrawOnBitmap(BOOL bActive, CDC* pMemDC, CRect* pRC);
  177. DWORD HitTest(CPoint pt);
  178. void PaintRect(CDC* dc, int x, int y, int w, int h, COLORREF color);
  179. void UpdateBitmap(BOOL bActive, CDC* pMemDC, CDC* pWinDC);
  180. // Generated message map functions
  181. public:
  182. protected:
  183. //{{AFX_MSG(CGripControl)
  184. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  185. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  186. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  187. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  188. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  189. afx_msg void OnPaint();
  190. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  191. afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
  192. afx_msg void OnSysColorChange();
  193. //}}AFX_MSG
  194. DECLARE_MESSAGE_MAP()
  195. };
  196. /////////////////////////////////////////////////////////////////////////////
  197. // class CExDockContext: interface for the CExDockContext class.
  198. /////////////////////////////////////////////////////////////////////////////
  199. class NGTB_EXPORT CExDockContext : public CDockContext  
  200. {
  201. // Construction / Destruction
  202. public:
  203. CExDockContext(CControlBar* pBar);
  204. virtual ~CExDockContext();
  205. // Overrides
  206. public:
  207. virtual void StartDrag(CPoint pt);
  208. protected:
  209. virtual void AdjustWindowForFloat(CRect& rect);
  210. virtual BOOL Tracking();
  211. };
  212. //////////////////////////////////////////////
  213. #endif // !defined(AFX_GRIPDIALOGBAR_H__E3F8F9A2_CBC9_11D1_9783_726AA5000000__INCLUDED_)
  214. //////////////////////////////////////////////