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

界面编程

开发平台:

Visual C++

  1. #if !defined(AFX_PAGETOOLBARS_H__9A124E60_CFC1_4030_9A92_02516BB0C86B__INCLUDED_)
  2. #define AFX_PAGETOOLBARS_H__9A124E60_CFC1_4030_9A92_02516BB0C86B__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // PageToolbars.h : header file
  7. //
  8. #include "PageBase.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CPageToolbars dialog
  11. class CPageToolbars : public CPageBase
  12. {
  13. // Construction
  14. public:
  15. CPageToolbars(CWnd* pParent = NULL);   // standard constructor
  16. void _Update();
  17. // Dialog Data
  18. //{{AFX_DATA(CPageToolbars)
  19. enum { IDD = IDD_PAGE_TOOLBARS };
  20. CExtCheckBox m_chkForceBalloonStyle;
  21. CExtCheckBox m_chkShowGripper;
  22. //}}AFX_DATA
  23. // Overrides
  24. // ClassWizard generated virtual function overrides
  25. //{{AFX_VIRTUAL(CPageToolbars)
  26. public:
  27. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
  28. protected:
  29. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  30. //}}AFX_VIRTUAL
  31. // Implementation
  32. protected:
  33. bool m_bInitComplete:1;
  34. COLORREF m_clrColorCtrl;
  35. class CThinColorButtonInToolBar : public CExtBarButton
  36. {
  37. COLORREF m_clr;
  38. public:
  39. CThinColorButtonInToolBar(
  40. COLORREF clr,
  41. CExtToolControlBar * pBar
  42. )
  43. : CExtBarButton(
  44. pBar,
  45. g_CmdManager->CmdAllocPtr(
  46. g_CmdManager->ProfileNameFromWnd(
  47. pBar->GetSafeHwnd()
  48. )
  49. )->m_nCmdID
  50. ),
  51. m_clr( clr )
  52. {
  53. CExtCmdItem * pCmdItem =
  54. g_CmdManager->CmdGetPtr(
  55. g_CmdManager->ProfileNameFromWnd(
  56. pBar->GetSafeHwnd()
  57. ),
  58. GetCmdID()
  59. );
  60. ASSERT( pCmdItem != NULL );
  61. pCmdItem->StateSetBasic();
  62. pCmdItem->m_sMenuText.Format(
  63. _T( "RGB color is 0x%02X%02X%02X" ),
  64. INT( GetRValue(clr) ),
  65. INT( GetGValue(clr) ),
  66. INT( GetBValue(clr) )
  67. );
  68. pCmdItem->m_sTipStatus.Format(
  69. _T( "Color in the left toolbarnRGB color is 0x%02X%02X%02X" ),
  70. INT( GetRValue(clr) ),
  71. INT( GetGValue(clr) ),
  72. INT( GetBValue(clr) )
  73. );
  74. //pCmdItem->m_sTipTool = pCmdItem->m_sTipStatus;
  75. HICON hIcon = CExtPaintManager::stat_GenerateColorIconBox( clr );
  76. ASSERT( hIcon != NULL );
  77. VERIFY(
  78. g_CmdManager->CmdSetIcon(
  79. g_CmdManager->ProfileNameFromWnd(
  80. pBar->GetSafeHwnd()
  81. ),
  82. pCmdItem->m_nCmdID,
  83. hIcon,
  84. false
  85. )
  86. );
  87. };
  88. virtual CSize CalculateLayout(
  89. CDC & dc,
  90. CSize sizePreCalc,
  91. BOOL bHorz
  92. )
  93. {
  94. ASSERT_VALID( this );
  95. CSize _size =
  96. CExtBarButton::CalculateLayout(
  97. dc,
  98. sizePreCalc,
  99. bHorz
  100. );
  101. CExtToolControlBar * pBar = GetBar();
  102. ASSERT_VALID( pBar );
  103. CPageToolbars * pDlg = (CPageToolbars *)pBar->GetParent();
  104. ASSERT_VALID( pDlg );
  105. if( bHorz )
  106. _size.cx = pDlg->m_nThinColorBtnHeight + 1;
  107. else
  108. _size.cy = pDlg->m_nThinColorBtnHeight + 1;
  109. return _size;
  110. }
  111. virtual void PaintCompound(
  112. CDC & dc,
  113. bool bPaintParentChain,
  114. bool bPaintChildren,
  115. bool bPaintOneNearestChildrenLevelOnly
  116. )
  117. {
  118. ASSERT_VALID( this );
  119. if( ! IsPaintAble( dc ) )
  120. return;
  121. if( AnimationClient_StatePaint( dc ) )
  122. return;
  123. if( bPaintParentChain )
  124. PaintParentChain( dc );
  125. CRect rcArea( Rect() );
  126. rcArea.DeflateRect(
  127. __EXT_TB_BUTTON_INNER_MARGIN,
  128. __EXT_TB_BUTTON_INNER_MARGIN,
  129. __EXT_TB_BUTTON_INNER_MARGIN,
  130. __EXT_TB_BUTTON_INNER_MARGIN+1
  131. );
  132. dc.FillSolidRect(
  133. &rcArea,
  134. m_clr
  135. );
  136. bool bEnabled = IsDisabled() ? false : true;
  137. bool bPushed =
  138. IsPressed() ? true : false;
  139. bool bHover =
  140. ( bEnabled
  141. && IsHover()
  142. && !CExtToolControlBar::g_bMenuTracking
  143. && !CExtPopupMenuWnd::IsMenuTracking()
  144. ) ? true : false;
  145. if( bPushed || bHover )
  146. {
  147. COLORREF clrTL = g_PaintManager->GetColor( COLOR_3DHIGHLIGHT, this );
  148. COLORREF clrBR = g_PaintManager->GetColor( COLOR_3DDKSHADOW, this );
  149. if( bPushed )
  150. {
  151. dc.Draw3dRect( rcArea, clrBR, clrTL );
  152. }
  153. else
  154. {
  155. //dc.Draw3dRect( rcArea, clrTL, clrBR );
  156. dc.Draw3dRect( rcArea, clrBR, clrBR );
  157. rcArea.DeflateRect( 1, 1 );
  158. if( rcArea.Height() > 3 )
  159. {
  160. dc.Draw3dRect( rcArea, clrTL, clrTL );
  161. rcArea.DeflateRect( 1, 1 );
  162. if( rcArea.Height() > 3 )
  163. dc.Draw3dRect( rcArea, clrBR, clrBR );
  164. }
  165. }
  166. }
  167. if( bPaintChildren )
  168. PaintChildren( dc, bPaintOneNearestChildrenLevelOnly );
  169. }
  170. virtual void OnHover(
  171. CPoint point,
  172. bool bOn,
  173. bool & bSuspendTips
  174. )
  175. {
  176. ASSERT_VALID( this );
  177. CExtBarButton::OnHover(
  178. point,
  179. bOn,
  180. bSuspendTips
  181. );
  182. CExtToolControlBar * pBar = GetBar();
  183. ASSERT_VALID( pBar );
  184. CPageToolbars * pDlg = (CPageToolbars *)pBar->GetParent();
  185. ASSERT_VALID( pDlg );
  186. if( bOn )
  187. {
  188. if( CExtPopupMenuWnd::IsMenuTracking() )
  189. return;
  190. CExtCmdItem * pCmdItem =
  191. g_CmdManager->CmdGetPtr(
  192. g_CmdManager->ProfileNameFromWnd(
  193. pBar->GetSafeHwnd()
  194. ),
  195. GetCmdID()
  196. );
  197. ASSERT( pCmdItem != NULL );
  198. pDlg->m_wndLeftBarTip.SetText( pCmdItem->m_sTipStatus );
  199. CRect rcAreaScreen = Rect();
  200. pBar->ClientToScreen( &rcAreaScreen );
  201. pDlg->m_wndLeftBarTip.Show( pBar, rcAreaScreen );
  202. //pDlg->m_wndStatusBar.SetPaneText( 0, pCmdItem->m_sTipStatus );
  203. }
  204. else
  205. {
  206. pDlg->m_wndLeftBarTip.Hide();
  207. }
  208. }
  209. virtual void OnClick(
  210. CPoint point,
  211. bool bDown
  212. )
  213. {
  214. ASSERT_VALID( this );
  215. CExtToolControlBar * pBar = GetBar();
  216. ASSERT_VALID( pBar );
  217. CPageToolbars * pDlg = (CPageToolbars *)pBar->GetParent();
  218. ASSERT_VALID( pDlg );
  219. pDlg->m_wndLeftBarTip.Hide();
  220. CExtBarButton::OnClick(
  221. point,
  222. bDown
  223. );
  224. }
  225. }; // class CThinColorButtonInToolBar
  226. friend class CThinColorButtonInToolBar;
  227. class CZoomBarSliderButton: public CExtBarSliderButton
  228. {
  229. public:
  230. CZoomBarSliderButton(
  231. CExtToolControlBar * pBar = NULL,
  232. UINT nCmdID = ID_SEPARATOR,
  233. UINT nStyle = 0,
  234. ULONG nScrollTotalRange = 0L,
  235. ULONG nScrollPos = 0L,
  236. ULONG nScrollPageSize = 0L,
  237. INT nScrollButtonExtentH = 0,
  238. INT nScrollButtonExtentV = 0,
  239. INT nScrollControlExtentH = 50,
  240. INT nScrollControlExtentV = 50
  241. )
  242. : CExtBarSliderButton(
  243. pBar,
  244. nCmdID,
  245. nStyle,
  246. nScrollTotalRange,
  247. nScrollPos,
  248. nScrollPageSize,
  249. nScrollButtonExtentH,
  250. nScrollButtonExtentV,
  251. nScrollControlExtentH,
  252. nScrollControlExtentV
  253. )
  254. {
  255. }
  256. ~CZoomBarSliderButton()
  257. {
  258. }
  259. ULONG ScrollPosSet( ULONG nScrollPos )
  260. {
  261. ULONG ulRet = CExtBarSliderButton::ScrollPosSet( nScrollPos );
  262. RedrawButton();
  263. return ulRet;
  264. }
  265. }; // class CZoomBarSliderButton
  266. class CSeekBarSliderButton: public CExtBarSliderButton
  267. {
  268. public:
  269. CSeekBarSliderButton(
  270. CExtToolControlBar * pBar = NULL,
  271. UINT nCmdID = ID_SEPARATOR,
  272. UINT nStyle = 0,
  273. ULONG nScrollTotalRange = 0L,
  274. ULONG nScrollPos = 0L,
  275. ULONG nScrollPageSize = 0L,
  276. INT nScrollButtonExtentH = 0,
  277. INT nScrollButtonExtentV = 0,
  278. INT nScrollControlExtentH = 50,
  279. INT nScrollControlExtentV = 50
  280. )
  281. : CExtBarSliderButton(
  282. pBar,
  283. nCmdID,
  284. nStyle,
  285. nScrollTotalRange,
  286. nScrollPos,
  287. nScrollPageSize,
  288. nScrollButtonExtentH,
  289. nScrollButtonExtentV,
  290. nScrollControlExtentH,
  291. nScrollControlExtentV
  292. )
  293. {
  294. }
  295. ~CSeekBarSliderButton()
  296. {
  297. }
  298. ULONG ScrollPosSet( ULONG nScrollPos)
  299. {
  300. ULONG ulRet = CExtBarSliderButton::ScrollPosSet( nScrollPos );
  301. RedrawButton();
  302. return ulRet;
  303. }
  304. virtual void OnClick(
  305. CPoint point,
  306. bool bDown
  307. )
  308. {
  309. CExtBarSliderButton::OnClick(point,bDown);
  310. }
  311. };// class CSeekBarSliderButton
  312. CExtMenuControlBar m_wndMenuBar;
  313. CExtThemeSwitcherToolControlBar m_wndToolBarUiLook;
  314. CExtToolControlBar m_wndToolBarColor;
  315. CExtToolControlBar m_wndToolBarControls1;
  316. CExtToolControlBar m_wndToolBarControls2;
  317. CExtToolControlBar m_wndToolBarPalette;
  318. CExtComboBox m_wndComboBoxInToolbar;
  319. CExtComboBox m_wndComboBoxInMenubar;
  320. CExtEdit m_wndEditInToolbar;
  321. CExtEdit m_wndEditInMenubar;
  322. CExtLabel m_wndLabelInMenubar;
  323. CExtLabel m_wndLabelInToolbar;
  324. INT m_nThinColorBtnHeight;
  325. CExtPopupMenuTipWnd m_wndLeftBarTip;
  326. // Generated message map functions
  327. //{{AFX_MSG(CPageToolbars)
  328. virtual BOOL OnInitDialog();
  329. afx_msg void OnSize(UINT nType, int cx, int cy);
  330. //}}AFX_MSG
  331. afx_msg LRESULT OnExtMenuPrepare(WPARAM wParam, LPARAM lParam);
  332. afx_msg LRESULT OnColorChangedFinally(WPARAM wParam, LPARAM lParam);
  333. afx_msg LRESULT OnColorSelectCustom(WPARAM wParam, LPARAM lParam);
  334. DECLARE_MESSAGE_MAP()
  335. };
  336. //{{AFX_INSERT_LOCATION}}
  337. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  338. #endif // !defined(AFX_PAGETOOLBARS_H__9A124E60_CFC1_4030_9A92_02516BB0C86B__INCLUDED_)