ExtControls.h
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:6k
源码类别:

界面编程

开发平台:

Visual C++

  1. // This is part of the Professional User Interface Suite library.
  2. // Copyright (C) 2001-2009 FOSS Software, Inc.
  3. // All rights reserved.
  4. //
  5. // http://www.prof-uis.com
  6. // mailto:support@prof-uis.com
  7. //
  8. // This source code can be used, modified and redistributed
  9. // under the terms of the license agreement that is included
  10. // in the Professional User Interface Suite package.
  11. //
  12. // Warranties and Disclaimers:
  13. // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND
  14. // INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  16. // IN NO EVENT WILL FOSS SOFTWARE INC. BE LIABLE FOR ANY DIRECT,
  17. // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES,
  18. // INCLUDING DAMAGES FOR LOSS OF PROFITS, LOSS OR INACCURACY OF DATA,
  19. // INCURRED BY ANY PERSON FROM SUCH PERSON'S USAGE OF THIS SOFTWARE
  20. // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  21. #if (!defined __EXT_CONTROLS_H)
  22. #define __EXT_CONTROLS_H
  23. #if (!defined __EXT_MFC_DEF_H)
  24. #include <ExtMfcDef.h>
  25. #endif // __EXT_MFC_DEF_H
  26. #if (!defined __EXT_TOOLCONTROLBAR_H)
  27. #include <ExtToolControlBar.h>
  28. #endif
  29. #if (!defined __EXT_HOOK_H)
  30. #include "../Src/ExtHook.h"
  31. #endif
  32. #if _MSC_VER > 1000
  33. #pragma once
  34. #endif // _MSC_VER > 1000
  35. #define __EXT_SUBCLASS_PROFUISCTRL( hWnd, class_name ) 
  36. CWnd * pWnd = CWnd::FromHandlePermanent( hWnd ); 
  37. if( pWnd == NULL ) 
  38. class class_name##Dynamic : public class_name 
  39. void PostNcDestroy() 
  40. delete this; 
  41. }; 
  42. pWnd = new class_name##Dynamic; 
  43. ASSERT_VALID( pWnd ); 
  44. pWnd->SubclassWindow( hWnd ); 
  45. if( pWnd->IsWindowVisible() ) 
  46. pWnd->RedrawWindow( NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW|RDW_ALLCHILDREN|RDW_FRAME ); 
  47. }
  48. void __PROF_UIS_API SubclassChildControls( 
  49. HWND hWndParent 
  50. );
  51. void __PROF_UIS_API SubclassChildControls( 
  52. const CWnd * pWndParent 
  53. );
  54. void __PROF_UIS_API SubclassChildControls( 
  55. const CWnd & wndParent 
  56. );
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CExtWSGripper for the CExtWS template
  59. #define __EXT_SIZE_GRIPPER_CLASS_NAME _T("ProfUIS-SizeGripper") 
  60. class __PROF_UIS_API CExtWSGripper : public CWnd
  61. {
  62. public:
  63. DECLARE_DYNCREATE( CExtWSGripper );
  64. CExtWSGripper();
  65. virtual CExtPaintManager * PmBridge_GetPM() const;
  66. protected:
  67. virtual void DoPaint( CDC * pDC );
  68. virtual LRESULT WindowProc(
  69. UINT message,
  70. WPARAM wParam,
  71. LPARAM lParam
  72. );
  73. }; // class CExtWSGripper
  74. #if (!defined __EXT_MFC_NO_THEME_SWITCHER_TOOLBAR)
  75. /////////////////////////////////////////////////////////////////////////////
  76. // CExtThemeSwitcherToolButton
  77. class __PROF_UIS_API CExtThemeSwitcherToolButton : public CExtBarButton
  78. {
  79. public:
  80. DECLARE_DYNCREATE( CExtThemeSwitcherToolButton );
  81. CExtThemeSwitcherToolButton(
  82. CExtToolControlBar * pBar = NULL,
  83. UINT nCmdID = ID_SEPARATOR,
  84. UINT nStyle = 0
  85. );
  86. virtual ~CExtThemeSwitcherToolButton();
  87. virtual void OnUpdateCmdUI(
  88. CWnd * pTarget,
  89. BOOL bDisableIfNoHndler,
  90. int nIndex
  91. );
  92. virtual void OnDeliverCmd();
  93. virtual BOOL PutToPopupMenu(
  94. CExtPopupMenuWnd * pPopup
  95. );
  96. }; // class CExtThemeSwitcherToolButton
  97. /////////////////////////////////////////////////////////////////////////////
  98. // CExtThemeSwitcherToolControlBar
  99. class __PROF_UIS_API CExtThemeSwitcherToolControlBar
  100. : public CExtToolControlBar
  101. , public CExtHookSink
  102. {
  103. public:
  104. DECLARE_DYNCREATE( CExtThemeSwitcherToolControlBar );
  105. // Construction
  106. public:
  107. bool m_bEnableOffice2007r3:1;
  108. CExtThemeSwitcherToolControlBar();
  109. // Implementation
  110. public:
  111. virtual ~CExtThemeSwitcherToolControlBar();
  112. virtual CExtBarButton * OnCreateBarCommandBtn(
  113. UINT nCmdID,
  114. UINT nStyle = 0
  115. );
  116. enum e_ThemeIconSize_t
  117. {
  118. __ETIS_16x16 = 0,
  119. __ETIS_24x24 = 1,
  120. __ETIS_32x32 = 2,
  121. };
  122. UINT m_nMenuMarkerID;
  123. protected:
  124. CExtSafeString m_strCommandProfileName;
  125. e_ThemeIconSize_t m_eTIS_PopupMenu, m_eTIS_ToolBar;
  126. typedef
  127. CMap < UINT, UINT, CRuntimeClass *, CRuntimeClass * >
  128. MapCmd2RTC_t;
  129. MapCmd2RTC_t m_mapCmd2RTC;
  130. typedef
  131. CMap < UINT, UINT, UINT, UINT >
  132. MapCmdID2ThemeType_t;
  133. MapCmdID2ThemeType_t m_mapCmdID2ThemeType;
  134. typedef
  135. CMap < UINT, UINT, UINT, UINT >
  136. MapThemeType2CmdID_t;
  137. MapThemeType2CmdID_t m_arrMapsTT[3];
  138. bool m_bCommandProfileInitialized:1;
  139. typedef
  140. CList < UINT, UINT >
  141. ListCmdSequence_t;
  142. ListCmdSequence_t m_listCmdSequence;
  143. public:
  144. virtual bool ThemeSwitcherInit(
  145. e_ThemeIconSize_t _eTIS_PopupMenu = __ETIS_16x16,
  146. e_ThemeIconSize_t _eTIS_ToolBar = __ETIS_24x24
  147. );
  148. virtual void ThemeSwitcher_OnButtonInvoke(
  149. CExtThemeSwitcherToolButton * pTBB
  150. );
  151. virtual void ThemeSwitcher_OnButtonUpdate(
  152. CExtThemeSwitcherToolButton * pTBB
  153. );
  154. virtual UINT ThemeSwitcher_GetMenuCmdIDByToolBarCmdID(
  155. UINT nCmdID
  156. );
  157. virtual UINT ThemeSwitcher_GetToolBarCmdIDByMenuCmdID(
  158. UINT nCmdID
  159. );
  160. protected:
  161. virtual bool OnHookWndMsg(
  162. LRESULT & lResult,
  163. HWND hWndHooked,
  164. UINT nMessage,
  165. WPARAM & wParam,
  166. LPARAM & lParam
  167. );
  168. // Overrides
  169. //{{AFX_VIRTUAL(CExtThemeSwitcherToolControlBar)
  170. public:
  171. virtual BOOL PreTranslateMessage( MSG * pMsg );
  172. virtual BOOL OnCmdMsg( UINT nID, int nCode, void * pExtra, AFX_CMDHANDLERINFO * pHandlerInfo );
  173. protected:
  174. virtual void PreSubclassWindow();
  175. virtual void PostNcDestroy();
  176. virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );
  177. //}}AFX_VIRTUAL
  178. //{{AFX_MSG(CExtThemeSwitcherToolControlBar)
  179. //}}AFX_MSG
  180. DECLARE_MESSAGE_MAP()
  181. };// class CExtThemeSwitcherToolControlBar
  182. #endif // (!defined __EXT_MFC_NO_THEME_SWITCHER_TOOLBAR)
  183. /////////////////////////////////////////////////////////////////////////////
  184. //{{AFX_INSERT_LOCATION}}
  185. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  186. #endif // (!defined __EXT_CONTROLS_H)