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

界面编程

开发平台:

Visual C++

  1. #if !defined(AFX_PAGEBUTTONS_H__D5F47AD0_2BD7_4BFE_91DD_AD9337222252__INCLUDED_)
  2. #define AFX_PAGEBUTTONS_H__D5F47AD0_2BD7_4BFE_91DD_AD9337222252__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // PageButtons.h : header file
  7. //
  8. #include "PageBase.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CPageButtons dialog
  11. //////////////////////////////////////////////////////////////////////////
  12. // class CPageButtons
  13. //////////////////////////////////////////////////////////////////////////
  14. class CPageButtons : public CPageBase
  15. {
  16. // Construction
  17. public:
  18. CPageButtons(CWnd* pParent = NULL);   // standard constructor
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CSkinCheckBox window
  21. /////////////////////////////////////////////////////////////////////////////
  22. class CSkinCheckBox : public CExtCheckBox
  23. {
  24. public:
  25. CSkinCheckBox()
  26. : CExtCheckBox()
  27. , m_nBitmapResource( 0 )
  28. {
  29. }
  30. int m_nBitmapResource;
  31. protected:
  32. virtual bool OnPaintBox(
  33. CDC & dc,
  34. CRect & rcBox,
  35. CExtPaintManager::eBoxState_t eState
  36. )
  37. {
  38. if( m_nBitmapResource == 0 )
  39. return CExtCheckBox::OnPaintBox(dc,rcBox,eState);
  40. COLORREF clrBackground = GetBkColor();
  41. CRect rcClient;
  42. GetClientRect( &rcClient );
  43. CRgn rgnBox;
  44. if( rgnBox.CreateRectRgnIndirect( &rcBox ) )
  45. dc.SelectClipRgn( &rgnBox );
  46. bool bTransparent = false;
  47. if( (! bTransparent )
  48. && g_PaintManager->GetCb2DbTransparentMode(this)
  49. && ( clrBackground == COLORREF(-1L) )
  50. )
  51. {
  52. if( g_PaintManager->PaintDockerBkgnd( true, dc, this ) )
  53. bTransparent = true;
  54. }
  55. if( ! bTransparent )
  56. dc.FillSolidRect( 
  57. &rcBox, 
  58. (clrBackground != COLORREF(-1L)) 
  59. ? clrBackground 
  60. : g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) 
  61. );
  62. INT nImageIndex = 0;
  63. switch( eState ) 
  64. {
  65. case CExtPaintManager::BOX_UNCHECKED:
  66. nImageIndex = 0;
  67. break;
  68. case CExtPaintManager::BOX_CHECKED:
  69. nImageIndex = 1;
  70. break;
  71. case CExtPaintManager::BOX_INDETERMINATE:
  72. nImageIndex = 2;
  73. break;
  74. case CExtPaintManager::BOX_LDOWN_UNCHECKED:
  75. nImageIndex = 3;
  76. break;
  77. case CExtPaintManager::BOX_LDOWN_CHECKED:
  78. nImageIndex = 4;
  79. break;
  80. case CExtPaintManager::BOX_LDOWN_INDETERMINATE:
  81. nImageIndex = 5;
  82. break;
  83. case CExtPaintManager::BOX_MOUSE_HOVER_UNCHECKED:
  84. nImageIndex = 6;
  85. break;
  86. case CExtPaintManager::BOX_MOUSE_HOVER_CHECKED:
  87. nImageIndex = 7;
  88. break;
  89. case CExtPaintManager::BOX_MOUSE_HOVER_INDETERMINATE:
  90. nImageIndex = 8;
  91. break;
  92. case CExtPaintManager::BOX_DISABLED_UNCHECKED:
  93. nImageIndex = 9;
  94. break;
  95. case CExtPaintManager::BOX_DISABLED_CHECKED:
  96. nImageIndex = 10;
  97. break;
  98. case CExtPaintManager::BOX_DISABLED_INDETERMINATE:
  99. nImageIndex = 11;
  100. break;
  101. }
  102. CExtImageList il(m_nBitmapResource, RGB(255,0,255), 13);
  103. bool bRet = il.Draw(
  104. &dc, 
  105. nImageIndex, 
  106. rcBox.TopLeft(), 
  107. ILD_NORMAL
  108. ) == TRUE;
  109. dc.SelectClipRgn( NULL );
  110. return bRet;
  111. }
  112. };// class CSkinCheckBox
  113. /////////////////////////////////////////////////////////////////////////////
  114. // CSkinRadioButton window
  115. /////////////////////////////////////////////////////////////////////////////
  116. class CSkinRadioButton : public CExtRadioButton
  117. {
  118. public:
  119. CSkinRadioButton()
  120. : CExtRadioButton()
  121. , m_nBitmapResource( 0 )
  122. {
  123. }
  124. int m_nBitmapResource;
  125. protected:
  126. virtual bool OnPaintBox(
  127. CDC & dc,
  128. CRect & rcBox,
  129. CExtPaintManager::eBoxState_t eState
  130. )
  131. {
  132. if( m_nBitmapResource == 0 )
  133. return CExtRadioButton::OnPaintBox(dc,rcBox,eState);
  134. COLORREF clrBackground = GetBkColor();
  135. CRect rcClient;
  136. GetClientRect( &rcClient );
  137. CRgn rgnBox;
  138. if( rgnBox.CreateRectRgnIndirect( &rcBox ) )
  139. dc.SelectClipRgn( &rgnBox );
  140. bool bTransparent = false;
  141. if( (! bTransparent )
  142. && g_PaintManager->GetCb2DbTransparentMode(this)
  143. && ( clrBackground == COLORREF(-1L) )
  144. )
  145. {
  146. if( g_PaintManager->PaintDockerBkgnd( true, dc, this ) )
  147. bTransparent = true;
  148. }
  149. if( ! bTransparent )
  150. dc.FillSolidRect( 
  151. &rcBox, 
  152. (clrBackground != COLORREF(-1L)) 
  153. ? clrBackground 
  154. : g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) 
  155. );
  156. INT nImageIndex = 0;
  157. switch( eState ) 
  158. {
  159. case CExtPaintManager::BOX_UNCHECKED:
  160. nImageIndex = 0;
  161. break;
  162. case CExtPaintManager::BOX_CHECKED:
  163. nImageIndex = 1;
  164. break;
  165. case CExtPaintManager::BOX_LDOWN_UNCHECKED:
  166. nImageIndex = 2;
  167. break;
  168. case CExtPaintManager::BOX_LDOWN_CHECKED:
  169. nImageIndex = 3;
  170. break;
  171. case CExtPaintManager::BOX_MOUSE_HOVER_UNCHECKED:
  172. nImageIndex = 4;
  173. break;
  174. case CExtPaintManager::BOX_MOUSE_HOVER_CHECKED:
  175. nImageIndex = 5;
  176. break;
  177. case CExtPaintManager::BOX_DISABLED_UNCHECKED:
  178. nImageIndex = 6;
  179. break;
  180. case CExtPaintManager::BOX_DISABLED_CHECKED:
  181. nImageIndex = 7;
  182. break;
  183. }
  184. CExtImageList il(m_nBitmapResource, RGB(255,0,255), 13);
  185. bool bRet = il.Draw(
  186. &dc, 
  187. nImageIndex, 
  188. rcBox.TopLeft(), 
  189. ILD_NORMAL
  190. ) == TRUE;
  191. dc.SelectClipRgn( NULL );
  192. return bRet;
  193. }
  194. };// class CSkinRadioButton
  195. // Dialog Data
  196. //{{AFX_DATA(CPageButtons)
  197. enum { IDD = IDD_PAGE_BUTTONS };
  198. CExtButton m_wndTextMarginsReset;
  199. CExtButton m_wndIconMarginsReset;
  200. CExtSpinWnd m_wndSpinIconMarginsTop;
  201. CExtSpinWnd m_wndSpinIconMarginsRight;
  202. CExtSpinWnd m_wndSpinIconMarginsLeft;
  203. CExtSpinWnd m_wndSpinIconMarginsBottom;
  204. CExtSpinWnd m_wndSpinTextMarginsTop;
  205. CExtSpinWnd m_wndSpinTextMarginsRight;
  206. CExtSpinWnd m_wndSpinTextMarginsLeft;
  207. CExtSpinWnd m_wndSpinTextMarginsBottom;
  208. CExtEdit m_wndTextMarginsTop;
  209. CExtEdit m_wndTextMarginsRight;
  210. CExtEdit m_wndTextMarginsLeft;
  211. CExtEdit m_wndTextMarginsBottom;
  212. CExtEdit m_wndIconMarginsTop;
  213. CExtEdit m_wndIconMarginsRight;
  214. CExtEdit m_wndIconMarginsLeft;
  215. CExtEdit m_wndIconMarginsBottom;
  216. CExtGroupBox m_wndGroupBoxTextMargins;
  217. CExtGroupBox m_wndGroupBoxIconMargins;
  218. CExtLabel m_wndlabelIconAlignmentVert;
  219. CExtLabel m_wndlabelIconAlignmentHorz;
  220. CExtLabel m_wndlabelTextAlignmentVert;
  221. CExtLabel m_wndlabelTextAlignmentHorz;
  222. CExtComboBox m_wndTextAlignmentVert;
  223. CExtComboBox m_wndTextAlignmentHorz;
  224. CExtComboBox m_wndIconAlignmentVert;
  225. CExtComboBox m_wndIconAlignmentHorz;
  226. CExtGroupBox m_wndGroupBoxTextAlignment;
  227. CExtGroupBox m_wndGroupBoxIconAlignment;
  228. CSkinRadioButton m_wndRadio1;
  229. CSkinRadioButton m_wndRadio2;
  230. CSkinCheckBox m_chkCheckBox2;
  231. CSkinCheckBox m_chkCheckBox1;
  232. CExtButton m_btnWithMenu;
  233. CExtColorButton m_btnColor2;
  234. CExtColorButton m_btnColor1;
  235. CExtCheckBox m_chkCheckBoxShowFocusRect;
  236. CExtEdit m_Tooltip;
  237. CExtLabel m_wndLabelTooltip;
  238. CExtLabel m_wndLabelSkin;
  239. CExtGroupBox m_wndGroupBoxCheck; 
  240. CExtLabel m_wndLabelCursor;
  241. CExtComboBox m_CheckBoxSkin;
  242. CExtButton m_btnPushLikeButton;
  243. CExtButton m_btnPushButton;
  244. CExtComboBox m_Cursor;
  245. CExtCheckBox m_chkTriState;
  246. CExtCheckBox m_chkButtonShowFocusRect;
  247. CExtCheckBox m_chkButtonEnable;
  248. CExtCheckBox m_chkCheckBoxEnable;
  249. CExtCheckBox m_chkLeftText;
  250. CExtCheckBox m_chkSeparatedButtons;
  251. CExtCheckBox m_chkFlat;
  252. CExtCheckBox m_chkBorders;
  253. //}}AFX_DATA
  254. // Overrides
  255. // ClassWizard generated virtual function overrides
  256. //{{AFX_VIRTUAL(CPageButtons)
  257. public:
  258. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
  259. protected:
  260. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  261. //}}AFX_VIRTUAL
  262. // Implementation
  263. protected:
  264. bool m_bInitComplete:1;
  265. // Generated message map functions
  266. //{{AFX_MSG(CPageButtons)
  267. virtual BOOL OnInitDialog();
  268. afx_msg void OnSelendokSkin();
  269. afx_msg void OnSelendokCursor();
  270. afx_msg void OnSelendokIconAlignmentHorz();
  271. afx_msg void OnSelendokIconAlignmentVert();
  272. afx_msg void OnSelendokTextAlignmentHorz();
  273. afx_msg void OnSelendokTextAlignmentVert();
  274. afx_msg void OnTextMarginsReset();
  275. afx_msg void OnIconMarginsReset();
  276. //}}AFX_MSG
  277. afx_msg LRESULT OnExtMenuPrepare(WPARAM wParam, LPARAM lParam);
  278. afx_msg LRESULT OnColorSelectCustom(WPARAM wParam, LPARAM lParam);
  279. afx_msg LRESULT OnColorChangedFinally(WPARAM wParam, LPARAM lParam);
  280. afx_msg LRESULT OnDrawPopupMenuItem(WPARAM wParam, LPARAM lParam);
  281. afx_msg LRESULT OnDrawPopupLeftArea(WPARAM wParam, LPARAM lParam);
  282. DECLARE_MESSAGE_MAP()
  283. };
  284. //{{AFX_INSERT_LOCATION}}
  285. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  286. #endif // !defined(AFX_PAGEBUTTONS_H__D5F47AD0_2BD7_4BFE_91DD_AD9337222252__INCLUDED_)