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

界面编程

开发平台:

Visual C++

  1. #if !defined(AFX_PAGEDATETIMEDURATION_H__B15ECEDA_5E82_4F10_9A40_F6232C2EB49E__INCLUDED_)
  2. #define AFX_PAGEDATETIMEDURATION_H__B15ECEDA_5E82_4F10_9A40_F6232C2EB49E__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // PageDateTimeDuration.h : header file
  7. //
  8. #include "PageBase.h"
  9. #if (!defined __EXT_MFC_NO_DURATIONWND && !defined __EXT_MFC_NO_DATETIMEWND )
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CPageDateTimeDuration dialog
  12. class CPageDateTimeDuration : public CPageBase
  13. {
  14. // Construction
  15. public:
  16. CPageDateTimeDuration(CWnd* pParent = NULL);   // standard constructor
  17. // Dialog Data
  18. //{{AFX_DATA(CPageDateTimeDuration)
  19. enum { IDD = IDD_PAGE_DATE_TIME_DURATION };
  20. CExtCheckBox m_wndDisabledDuration;
  21. CExtCheckBox m_wndDisabledDateTime;
  22. CExtCheckBox m_wndReadOnlyDuration;
  23. CExtCheckBox m_wndReadOnlyDateTime;
  24. CExtCheckBox m_wndModeSeconds;
  25. CExtCheckBox m_wndModeMinutes;
  26. CExtCheckBox m_wndModeHours;
  27. CExtCheckBox m_wndModeDays;
  28. CExtLabel m_wndLabelNotifications;
  29. CExtCheckBox m_wndContinuousDateTime;
  30. CExtCheckBox m_wndContinuousDuration;
  31. CExtGroupBox m_wndBoxTimeFormat;
  32. CExtGroupBox m_wndBoxModeDateTime;
  33. CExtGroupBox m_wndBoxModeDuration;
  34. CExtCheckBox m_wndBtnSpinDateTime;
  35. CExtCheckBox m_wndBtnSpinDuration;
  36. CExtCheckBox m_wndBtnDropDown;
  37. CExtCheckBox m_wndBtnShowSelectionAlwaysDateTime;
  38. CExtCheckBox m_wndBtnShowSelectionAlwaysDuration;
  39. CExtColorButton m_wndColorTextDateTime;
  40. CExtColorButton m_wndColorBackDateTime;
  41. CExtButton m_wndAdjustSizeDateTime;
  42. CExtColorButton m_wndColorTextDuration;
  43. CExtColorButton m_wndColorBackDuration;
  44. CExtButton m_wndAdjustSizeDuration;
  45. CExtGroupBox m_wndBoxDuration;
  46. CExtGroupBox m_wndBoxDateTime;
  47. CExtDurationWnd m_wndDuration;
  48. CExtDateTimeWnd m_wndDateTime;
  49. CExtRadioButton m_wndTimeFormatAuto;
  50. CExtRadioButton m_wndTimeFormatH12;
  51. CExtRadioButton m_wndTimeFormatH24;
  52. CExtRadioButton m_wndModeTime;
  53. CExtRadioButton m_wndModeDate;
  54. CExtRadioButton m_wndModeDateTime;
  55. int m_nTimeFormat;
  56. int m_nMode;
  57. //}}AFX_DATA
  58. CExtNCSB < CExtFlatEdit > m_wndNotifications;
  59. // Overrides
  60. // ClassWizard generated virtual function overrides
  61. //{{AFX_VIRTUAL(CPageDateTimeDuration)
  62. public:
  63. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
  64. protected:
  65. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  66. //}}AFX_VIRTUAL
  67. // Implementation
  68. protected:
  69. bool m_bInitComplete:1;
  70. // Generated message map functions
  71. //{{AFX_MSG(CPageDateTimeDuration)
  72. virtual BOOL OnInitDialog();
  73. //}}AFX_MSG
  74. afx_msg LRESULT OnSelChangedDuration( WPARAM wParam, LPARAM lParam );
  75. afx_msg LRESULT OnSelChangedDateTime( WPARAM wParam, LPARAM lParam );
  76. afx_msg LRESULT OnColorChanged(WPARAM wParam, LPARAM lParam);
  77. DECLARE_MESSAGE_MAP()
  78. };
  79. #endif // (!defined __EXT_MFC_NO_DURATIONWND && !defined __EXT_MFC_NO_DATETIMEWND )
  80. #if (!defined __EXT_MFC_NO_DATE_BROWSER )
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CLogCtrl window
  83. #define ID_TIMER_DELAYED_UPDATE 1
  84. #define ELAPSE_TIMER_DELAYED_UPDATE 50
  85. #define ID_TIMER_DELAYED_DESTROY 2
  86. #define ID_TIMER_EVENT_SOURCE 3
  87. #define ELAPSE_TIMER_EVENT_SOURCE 50
  88. #define WM_USR_WRITE_LOG_TEXT (WM_USER + 0x1234)
  89. class CLogCtrl : public CRichEditCtrl
  90. {
  91. DWORD m_dwHelperThreadID;
  92. struct _MthMessageDataFor_WM_USR_WRITE_LOG_TEXT
  93. {
  94. bool m_bBold:1;
  95. COLORREF m_clrText;
  96. LPCTSTR m_sText;
  97. _MthMessageDataFor_WM_USR_WRITE_LOG_TEXT(
  98. bool bBold,
  99. COLORREF clrText,
  100. LPCTSTR sText
  101. )
  102. : m_bBold( bBold )
  103. , m_clrText( clrText )
  104. , m_sText( sText )
  105. {
  106. }
  107. operator LPARAM () const
  108. {
  109. return reinterpret_cast < LPARAM > ( this );
  110. }
  111. static _MthMessageDataFor_WM_USR_WRITE_LOG_TEXT &
  112. FromLPARAM(
  113. LPARAM lParam
  114. )
  115. {
  116. _MthMessageDataFor_WM_USR_WRITE_LOG_TEXT * pData =
  117. reinterpret_cast < _MthMessageDataFor_WM_USR_WRITE_LOG_TEXT * > ( lParam );
  118. ASSERT( pData != NULL );
  119. return * pData;
  120. }
  121. }; // _MthMessageDataFor_WM_USR_WRITE_LOG_TEXT
  122. // Construction
  123. public:
  124. CLogCtrl();
  125. // Attributes
  126. public:
  127. LONG m_nLineCountMax;
  128. // Operations
  129. public:
  130. BOOL Create(
  131. CWnd * pWndParent,
  132. UINT nID = UINT(IDC_STATIC),
  133. CRect rect = CRect(0,0,0,0),
  134. DWORD dwWindowStyles =
  135. WS_CHILD|WS_VISIBLE
  136. |WS_HSCROLL|WS_VSCROLL
  137. |ES_AUTOHSCROLL|ES_AUTOVSCROLL
  138. |ES_LEFT|ES_MULTILINE|ES_NOHIDESEL
  139. |ES_READONLY
  140. )
  141. {
  142. m_dwHelperThreadID = ::GetCurrentThreadId();
  143. return
  144. CRichEditCtrl::Create(
  145. dwWindowStyles,
  146. rect,
  147. pWndParent,
  148. nID
  149. );
  150. }
  151. void WriteText(
  152. bool bBold,
  153. COLORREF clrText,
  154. LPCTSTR sText
  155. );
  156. // Overrides
  157. // ClassWizard generated virtual function overrides
  158. //{{AFX_VIRTUAL(CLogCtrl)
  159. protected:
  160. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  161. virtual void PreSubclassWindow();
  162. //}}AFX_VIRTUAL
  163. // Implementation
  164. public:
  165. virtual ~CLogCtrl();
  166. protected:
  167. void _InitRichEditProps();
  168. bool _CanUpdate();
  169. // Generated message map functions
  170. protected:
  171. //{{AFX_MSG(CLogCtrl)
  172. afx_msg void OnTimer(__EXT_MFC_UINT_PTR nIDEvent);
  173. afx_msg void OnEditCopy();
  174. afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
  175. //}}AFX_MSG
  176. afx_msg LRESULT On_WM_USR_WRITE_LOG_TEXT( WPARAM wParam, LPARAM lParam );
  177. DECLARE_MESSAGE_MAP()
  178. };
  179. //////////////////////////////////////////////////////////////////////////
  180. // CLocalDateBrowser
  181. class CLocalDateBrowser : public CExtDateBrowserWnd
  182. {
  183. protected:
  184. static LPCTSTR stat_ViewModeToText( e_view_mode_t _eVM );
  185. static CString stat_FormatHitTestInfo(
  186. const HITTESTINFO & _hitTest
  187. );
  188. void WriteLog(
  189. LPCTSTR strHeaderText,
  190. LPCTSTR strDetailsText,
  191. COLORREF clr
  192. ) const;
  193. void WriteLog(
  194. CLogCtrl & wndLog,
  195. LPCTSTR strHeaderText,
  196. LPCTSTR strDetailsText,
  197. COLORREF clr
  198. ) const;
  199. public:
  200. bool m_bShowHoverEvents:1;
  201. CLocalDateBrowser()
  202. : m_bShowHoverEvents( false )
  203. {
  204. }
  205. virtual bool OnDateBrowserHoverChanging(
  206. const HITTESTINFO & _hitTestOld,
  207. const HITTESTINFO & _hitTestNew
  208. );
  209. virtual void OnDateBrowserHoverChanged(
  210. const HITTESTINFO & _hitTestOld,
  211. const HITTESTINFO & _hitTestNew
  212. );
  213. virtual CSize OnDateBrowserCalcSize(
  214. CDC & dcMeasure,
  215. const COleDateTime & _time
  216. ) const;
  217. virtual bool OnDateBrowserAnimateTimeChanging(
  218. const COleDateTime & _timeOld,
  219. const COleDateTime  & _timeNew
  220. ) const;
  221. virtual bool OnDateBrowserAnimateViewModeChanging(
  222. e_view_mode_t eVM_old,
  223. e_view_mode_t eVM_new
  224. ) const;
  225. virtual bool OnDateBrowserTimeChanging(
  226. const COleDateTime & _timeOld,
  227. const COleDateTime & _timeNew
  228. );
  229. virtual void OnDateBrowserTimeChanged(
  230. const COleDateTime & _timeOld,
  231. const COleDateTime & _timeNew
  232. );
  233. virtual bool OnDateBrowserViewModeChanging(
  234. e_view_mode_t eVM_old,
  235. e_view_mode_t eVM_new
  236. );
  237. virtual void OnDateBrowserViewModeChanged(
  238. e_view_mode_t eVM_old,
  239. e_view_mode_t eVM_new
  240. );
  241. };
  242. /////////////////////////////////////////////////////////////////////////////
  243. // CPageDateBrowser dialog
  244. class CPageDateBrowser : public CPageBase
  245. {
  246. // Construction
  247. public:
  248. DECLARE_DYNAMIC( CPageDateBrowser );
  249. CPageDateBrowser(CWnd* pParent = NULL); // standard constructor
  250. // Dialog Data
  251. //{{AFX_DATA(CPageDateBrowser)
  252. enum { IDD = IDD_PAGE_DATE_BROWSER };
  253. CExtCheckBox m_wndCheckShowHoverEventsInLogView;
  254. CExtCheckBox m_checkShowNonYearDecadeItems;
  255. CExtCheckBox m_checkShowNonCenturyItems;
  256. CExtCheckBox m_checkShowOutOfRangeItems;
  257. CExtCheckBox m_checkShowNonMonthDays;
  258. CExtComboBox m_comboLastYear;
  259. CExtComboBox m_comboFirstYear;
  260. CExtComboBox m_comboFirstDayOfWeek;
  261. CExtComboBox m_comboDateBrowserTheme;
  262. CExtGroupBox m_gropBoxAnimationParameters;
  263. CExtEdit m_editZoomStepTime;
  264. CExtEdit m_editZoomStepCount;
  265. CExtEdit m_editScrollStepTime;
  266. CExtEdit m_editScrollStepCount;
  267. CExtSpinWnd m_spinZoomStepTime;
  268. CExtSpinWnd m_spinZoomStepCount;
  269. CExtSpinWnd m_spinScrollStepTime;
  270. CExtSpinWnd m_spinScrollStepCount;
  271. //}}AFX_DATA
  272. CExtNCSB < CLogCtrl > m_wndNotifications;
  273. // ClassWizard generated virtual function overrides
  274. //{{AFX_VIRTUAL(CPageDateBrowser)
  275. protected:
  276. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  277. //}}AFX_VIRTUAL
  278. void SetZoomAnimation( INT _stepCount, INT _stepTime );
  279. void SetScrollAnimation( INT _stepCount, INT _stepTime );
  280. void SetTheme( LPCTSTR _theme );
  281. void SetFirstDayOfWeek( LPCTSTR _day );
  282. // Implementation
  283. protected:
  284. HICON m_hIcon;
  285. CLocalDateBrowser m_wndDateBrowser;
  286. // Generated message map functions
  287. //{{AFX_MSG(CPageDateBrowser)
  288. virtual BOOL OnInitDialog();
  289. afx_msg void OnButtonContentToSize();
  290. afx_msg void OnButtonApZoomReset();
  291. afx_msg void OnButtonApScrollReset();
  292. afx_msg void OnSelendokComboDateBrowserTheme();
  293. afx_msg void OnChangeEditApScrollStepCount();
  294. afx_msg void OnChangeEditApScrollStepTime();
  295. afx_msg void OnChangeEditApZoomStepCount();
  296. afx_msg void OnChangeEditApZoomStepTime();
  297. afx_msg void OnSelendokComboFirstDayOfWeek();
  298. afx_msg void OnSelendokComboFirstYear();
  299. afx_msg void OnSelendokComboLastYear();
  300. afx_msg void OnCheckShowOutOfRangeItems();
  301. afx_msg void OnCheckShowNonMonthDays();
  302. afx_msg void OnCheckShowNonCenturyItems();
  303. afx_msg void OnCheckShowNonYearDecadeItems();
  304. afx_msg void OnCheckShowHoverEvents();
  305. //}}AFX_MSG
  306. DECLARE_MESSAGE_MAP()
  307. };
  308. #endif  // (!defined __EXT_MFC_NO_DATE_BROWSER )
  309. //{{AFX_INSERT_LOCATION}}
  310. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  311. #endif // !defined(AFX_PAGEDATETIMEDURATION_H__B15ECEDA_5E82_4F10_9A40_F6232C2EB49E__INCLUDED_)