XTPRibbonSystemButton.h
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:14k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // XTPRibbonSystemButton.h: interface for the CXTPRibbonControlSystemButton class.
  2. //
  3. // This file is a part of the XTREME RIBBON MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. //{{AFX_CODEJOCK_PRIVATE
  21. #if !defined(__XTPRIBBONSYSTEMBUTTON_H__)
  22. #define __XTPRIBBONSYSTEMBUTTON_H__
  23. //}}AFX_CODEJOCK_PRIVATE
  24. #if _MSC_VER > 1000
  25. #pragma once
  26. #endif // _MSC_VER > 1000
  27. #include "CommandBars/XTPControlPopup.h"
  28. #include "CommandBars/XTPPopupBar.h"
  29. //===========================================================================
  30. // Summary:
  31. //     CXTPRibbonControlSystemButton is CXTPControlPopup derived class used as system
  32. //     button of ribbon bar
  33. //===========================================================================
  34. class _XTP_EXT_CLASS CXTPRibbonControlSystemButton : public CXTPControlPopup
  35. {
  36. DECLARE_XTP_CONTROL(CXTPRibbonControlSystemButton)
  37. public:
  38. //-----------------------------------------------------------------------
  39. // Summary:
  40. //     Constructs a CXTPRibbonControlSystemButton object
  41. //-----------------------------------------------------------------------
  42. CXTPRibbonControlSystemButton();
  43. public:
  44. //----------------------------------------------------------------------
  45. // Summary:
  46. //     This method is called to draw the control.
  47. // Parameters:
  48. //     pDC - Pointer to a valid device context.
  49. //----------------------------------------------------------------------
  50. void Draw(CDC* pDC);
  51. protected:
  52. //----------------------------------------------------------------------
  53. // Summary:
  54. //     This member is called when the user double-clicks the left mouse button.
  55. // Parameters:
  56. //     point - Specifies the x- and y-coordinates of the cursor.
  57. // Returns:
  58. //     TRUE if successful; otherwise returns FALSE
  59. //----------------------------------------------------------------------
  60. virtual BOOL OnLButtonDblClk(CPoint point);
  61. //-----------------------------------------------------------------------
  62. // Summary:
  63. //     Updates rectangle to set position where child popup bar become visible.
  64. // Parameters:
  65. //     rc - CRect object specifying size of area.
  66. //-----------------------------------------------------------------------
  67. void AdjustExcludeRect(CRect& rc, BOOL bVertical);
  68. };
  69. //===========================================================================
  70. // Summary:
  71. //     CXTPRibbonControlSystemPopupBarButton is CXTPControlButton derived class used
  72. //     in system popupbar as bottom option buttons
  73. //===========================================================================
  74. class _XTP_EXT_CLASS CXTPRibbonControlSystemPopupBarButton : public CXTPControlButton
  75. {
  76. DECLARE_XTP_CONTROL(CXTPRibbonControlSystemPopupBarButton)
  77. public:
  78. //-----------------------------------------------------------------------
  79. // Summary:
  80. //     Constructs a CXTPRibbonControlSystemPopupBarButton object
  81. //-----------------------------------------------------------------------
  82. CXTPRibbonControlSystemPopupBarButton();
  83. //----------------------------------------------------------------------
  84. // Summary:
  85. //     This method is called to determine the size of the control.
  86. // Parameters:
  87. //     pDC - Pointer to a valid device context
  88. // Returns:
  89. //     Size of the control.
  90. //----------------------------------------------------------------------
  91. virtual CSize GetSize(CDC* pDC);
  92. //----------------------------------------------------------------------
  93. // Summary:
  94. //     This method is called to draw the control.
  95. // Parameters:
  96. //     pDC - Pointer to a valid device context.
  97. //----------------------------------------------------------------------
  98. virtual void Draw(CDC* pDC);
  99. //-----------------------------------------------------------------------
  100. // Summary:
  101. //     Determines if control need to draw its background
  102. // Returns:
  103. //     TRUE if paint manager must skip filling background of control
  104. //-----------------------------------------------------------------------
  105. BOOL IsTransparent() const;
  106. //-----------------------------------------------------------------------
  107. // Summary:
  108. //     Call this function to get the size of the command bar button.
  109. // Returns:
  110. //     The width and height values of the command bar button.
  111. //-----------------------------------------------------------------------
  112. virtual CSize GetButtonSize() const;
  113. //-----------------------------------------------------------------------
  114. // Summary:
  115. //     Call this member function to get the size of a toolbar icon.
  116. // See Also:
  117. //     GetButtonSize
  118. //-----------------------------------------------------------------------
  119. virtual CSize GetIconSize() const;
  120. private:
  121. BOOL IsSystemPopupButton() const;
  122. };
  123. //===========================================================================
  124. // Summary:
  125. //     CXTPRibbonSystemPopupBar is CXTPPopupBar derived class used
  126. //     as system popupbar of RibbonBar.
  127. //===========================================================================
  128. class _XTP_EXT_CLASS CXTPRibbonSystemPopupBar : public CXTPPopupBar
  129. {
  130. DECLARE_XTP_COMMANDBAR(CXTPRibbonSystemPopupBar)
  131. public:
  132. //-----------------------------------------------------------------------
  133. // Summary:
  134. //     Constructs a CXTPRibbonSystemPopupBar object
  135. //-----------------------------------------------------------------------
  136. CXTPRibbonSystemPopupBar();
  137. public:
  138. //-----------------------------------------------------------------------
  139. // Summary:
  140. //     This method is called to get borders margins of commandbar
  141. // Returns:
  142. //     Rectangle contains border margins
  143. //-----------------------------------------------------------------------
  144. virtual CRect GetBorders();
  145. //-----------------------------------------------------------------------
  146. // Summary:
  147. //     This method is called to draw background of command bar
  148. // Parameters:
  149. //     pDC - POinter to device context to draw
  150. // See Also: DrawCommandBar
  151. //-----------------------------------------------------------------------
  152. virtual void FillCommandBarEntry(CDC* pDC);
  153. //-----------------------------------------------------------------------
  154. // Summary:
  155. //     This method is called to get the size of the command bar.
  156. // Parameters:
  157. //      nLength - The requested dimension of the control bar, either horizontal or vertical, depending on dwMode.
  158. //      dwMode - see CControlBar::CalcDynamicLayout for list of supported flags.
  159. // Returns:
  160. //     Size of the command bar.
  161. //-----------------------------------------------------------------------
  162. virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
  163. protected:
  164. //{{AFX_CODEJOCK_PRIVATE
  165. DECLARE_MESSAGE_MAP()
  166. afx_msg LRESULT OnNcHitTest(CPoint point);
  167. //}}AFX_CODEJOCK_PRIVATE
  168. };
  169. //===========================================================================
  170. // Summary:
  171. //     CXTPRibbonSystemPopupBarPage is CXTPPopupBar derived class used
  172. //     as system popupbar page of RibbonBar.
  173. //===========================================================================
  174. class _XTP_EXT_CLASS CXTPRibbonSystemPopupBarPage : public CXTPPopupBar
  175. {
  176. DECLARE_XTP_COMMANDBAR(CXTPRibbonSystemPopupBarPage)
  177. public:
  178. //-----------------------------------------------------------------------
  179. // Summary:
  180. //     Constructs a CXTPRibbonSystemPopupBarPage object
  181. //-----------------------------------------------------------------------
  182. CXTPRibbonSystemPopupBarPage();
  183. protected:
  184. //-----------------------------------------------------------------------
  185. // Summary:
  186. //     This method is called to get the size of the command bar.
  187. // Parameters:
  188. //      nLength - The requested dimension of the control bar, either horizontal or vertical, depending on dwMode.
  189. //      dwMode - see CControlBar::CalcDynamicLayout for list of supported flags.
  190. // Returns:
  191. //     Size of the command bar.
  192. //-----------------------------------------------------------------------
  193. virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
  194. //-----------------------------------------------------------------------
  195. // Summary:
  196. //     Updates rectangle to set position where popup bar become visible.
  197. // Parameters:
  198. //     rc - CRect object specifying size of exclude area.
  199. //-----------------------------------------------------------------------
  200. virtual void AdjustExcludeRect(CRect& rc, BOOL bVertical);
  201. };
  202. //===========================================================================
  203. // Summary:
  204. //     CXTPRibbonControlSystemPopupBarListCaption is CXTPControl derived class.
  205. //     It used in Ribbon system popup to draw caption of enumerable controls
  206. //===========================================================================
  207. class _XTP_EXT_CLASS CXTPRibbonControlSystemPopupBarListCaption : public CXTPControl
  208. {
  209. DECLARE_XTP_CONTROL(CXTPRibbonControlSystemPopupBarListCaption)
  210. public:
  211. //-----------------------------------------------------------------------
  212. // Summary:
  213. //     Constructs a CXTPRibbonControlSystemPopupBarListCaption object
  214. //-----------------------------------------------------------------------
  215. CXTPRibbonControlSystemPopupBarListCaption();
  216. protected:
  217. //----------------------------------------------------------------------
  218. // Summary:
  219. //     This method is called to determine the size of the control.
  220. // Parameters:
  221. //     pDC - Pointer to a valid device context
  222. // Returns:
  223. //     Size of the control.
  224. //----------------------------------------------------------------------
  225. virtual CSize GetSize(CDC* pDC);
  226. //----------------------------------------------------------------------
  227. // Summary:
  228. //     This method is called to draw the control.
  229. // Parameters:
  230. //     pDC - Pointer to a valid device context.
  231. //----------------------------------------------------------------------
  232. virtual void Draw(CDC* pDC);
  233. };
  234. //===========================================================================
  235. // Summary:
  236. //     CXTPRibbonControlSystemPopupBarListItem is CXTPControlButton derived class.
  237. //     It used in Ribbon system popup to draw button of enumerable controls
  238. //===========================================================================
  239. class _XTP_EXT_CLASS CXTPRibbonControlSystemPopupBarListItem : public CXTPControlButton
  240. {
  241. DECLARE_XTP_CONTROL(CXTPRibbonControlSystemPopupBarListItem)
  242. public:
  243. //-----------------------------------------------------------------------
  244. // Summary:
  245. //     Constructs a CXTPRibbonControlSystemPopupBarListItem object
  246. //-----------------------------------------------------------------------
  247. CXTPRibbonControlSystemPopupBarListItem();
  248. //----------------------------------------------------------------------
  249. // Summary:
  250. //     This method is called to determine the size of the control.
  251. // Parameters:
  252. //     pDC - Pointer to a valid device context
  253. // Returns:
  254. //     Size of the control.
  255. //----------------------------------------------------------------------
  256. virtual CSize GetSize(CDC* pDC);
  257. //----------------------------------------------------------------------
  258. // Summary:
  259. //     This method is called to draw the control.
  260. // Parameters:
  261. //     pDC - Pointer to a valid device context.
  262. //----------------------------------------------------------------------
  263. virtual void Draw(CDC* pDC);
  264. protected:
  265. BOOL m_bAlignShortcut;
  266. };
  267. //===========================================================================
  268. // Summary:
  269. //     CXTPRibbonControlSystemRecentFileList is CXTPRibbonControlSystemPopupBarListCaption derived class.
  270. //     It used in Ribbon system popup to draw recent file list controls
  271. //===========================================================================
  272. class _XTP_EXT_CLASS CXTPRibbonControlSystemRecentFileList : public CXTPRibbonControlSystemPopupBarListCaption
  273. {
  274. class CControlFileItem;
  275. public:
  276. //-----------------------------------------------------------------------
  277. // Summary:
  278. //     Constructs a CXTPRibbonControlSystemRecentFileList object
  279. //-----------------------------------------------------------------------
  280. CXTPRibbonControlSystemRecentFileList();
  281. protected:
  282. //----------------------------------------------------------------------
  283. // Summary:
  284. //     This method is called before recalculating the parent command
  285. //     bar size to calculate the dimensions of the control.
  286. // Parameters:
  287. //     dwMode - Flags used to determine the height and width of the
  288. //              dynamic command bar.
  289. //-----------------------------------------------------------------------
  290. virtual void OnCalcDynamicSize(DWORD dwMode);
  291. //-----------------------------------------------------------------------
  292. // Summary:
  293. //     Call this member to check if the user can drop the control.
  294. // Parameters:
  295. //     pCommandBar - Points to a CXTPCommandBar object
  296. //     point - Mouse position.
  297. //     dropEffect - DROPEFFECT enumerator.
  298. // Returns:
  299. //     TRUE if successful, otherwise returns FALSE
  300. //-----------------------------------------------------------------------
  301. virtual BOOL IsCustomizeDragOverAvail(CXTPCommandBar* pCommandBar, CPoint point, DROPEFFECT& dropEffect);
  302. protected:
  303. //-----------------------------------------------------------------------
  304. // Summary:
  305. //     Returns pointer to recent file list collection
  306. // Returns:
  307. //     Pointer to recent file list collection
  308. //-----------------------------------------------------------------------
  309. virtual CRecentFileList* GetRecentFileList();
  310. //-----------------------------------------------------------------------
  311. // Summary:
  312. //     Returns ID_FILE_MRU_FILE1.
  313. //-----------------------------------------------------------------------
  314. virtual int GetFirstMruID();
  315. private:
  316. CString ConstructCaption(const CString& lpszTitle, int nIndex);
  317. private:
  318. DECLARE_XTP_CONTROL(CXTPRibbonControlSystemRecentFileList)
  319. };
  320. #endif // !defined(__XTPRIBBONSYSTEMBUTTON_H__)