Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
8.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. blttd.hxx
  7. BLT time/date control object header file
  8. FILE HISTORY:
  9. terryk 01-Jun-91 Created
  10. terryk 11-Jul-91 Set up as a group
  11. terryk 12-Aug-91 Remove BLT_TIMER class from the TIME_DATE
  12. control
  13. terryk 17-Apr-92 passed intlprof object to the classes
  14. beng 13-Aug-1992 Disabled unused TIME_DATE_DIALOG
  15. Yi-HsinS 08-Dec-1992 Fix due to WIN_TIME class change
  16. */
  17. #ifndef _BLTTD_HXX_
  18. #define _BLTTD_HXX_
  19. #include "ctime.hxx"
  20. #include "intlprof.hxx"
  21. /**********************************************************************
  22. NAME: BLT_TIME_SPIN_GROUP
  23. SYNOPSIS: display the current time and let the user uses the
  24. spin button to change the time
  25. INTERFACE: BLT_TIME_SPIN_GROUP() - constructor
  26. ~BLT_TIME_SPIN_GROUP() - destructor
  27. IsValid() - return TRUE if the time in the time control
  28. panel is valid
  29. TimeClick() - set the group values to the current time
  30. IsModified() - return whether the group has been changed
  31. by the user or not
  32. QueryHour() - return the hour value
  33. QueryMin() - return the minute value
  34. QuerySec() - return the second value
  35. PARENT: PUSH_BUTTON, CUSTOM_CONTROL
  36. USES: SPIN_GROUP, SPIN_SLE_NUM, SPIN_SLT_SEPARATOR, XYPOINT,
  37. XYDIMENSION, OWNER_WINDOW
  38. HISTORY:
  39. terryk 01-Jun-91 Created
  40. terryk 11-Jul-91 Make it to a group
  41. beng 14-Aug-1992 Pretty up the painting a bit
  42. jonn 5-Sep-95 Use BLT_BACKGROUND_EDIT
  43. **********************************************************************/
  44. DLL_CLASS BLT_TIME_SPIN_GROUP: public CONTROL_GROUP
  45. {
  46. private:
  47. SPIN_GROUP _sbControl; // spin button
  48. SPIN_SLE_NUM_VALID _ssnHour; // hour field
  49. SPIN_SLT_SEPARATOR _ssltSeparator1; // separator 1
  50. SPIN_SLE_NUM_VALID _ssnMin; // minute field
  51. SPIN_SLT_SEPARATOR _ssltSeparator2; // separator 2
  52. SPIN_SLE_NUM_VALID _ssnSec; // second field
  53. SPIN_SLE_STR *_psssAMPM; // AMPM field
  54. BLT_BACKGROUND_EDIT _bkgndFrame; // framing rectangle
  55. BOOL _f24Hour; // 24 hour format flag
  56. BOOL IsConstructionFail( CONTROL_WINDOW * pwin );
  57. protected:
  58. virtual VOID SaveValue( BOOL fInvisible = TRUE );
  59. virtual VOID RestoreValue( BOOL fInvisible = TRUE );
  60. virtual VOID SetControlValueFocus();
  61. public:
  62. BLT_TIME_SPIN_GROUP( OWNER_WINDOW *powin, const INTL_PROFILE & intlprof,
  63. CID cidSpinButton,
  64. CID cidUpArrow, CID cidDownArrow, CID cidHour,
  65. CID cidSeparator1, CID cidMin, CID cidSeparator2,
  66. CID cidSec, CID cidAMPM, CID cidFrame );
  67. ~BLT_TIME_SPIN_GROUP();
  68. BOOL IsValid();
  69. APIERR SetCurrentTime();
  70. BOOL IsModified()
  71. { return _sbControl.IsModified();}
  72. INT QueryHour() const;
  73. INT QueryMin() const;
  74. INT QuerySec() const;
  75. VOID SetHour( INT nHour );
  76. VOID SetMinute( INT nMinute );
  77. VOID SetSecond( INT nSecond );
  78. };
  79. /**********************************************************************
  80. NAME: BLT_DATE_SPIN_GROUP
  81. SYNOPSIS: display the current month/day/year and let the user uses
  82. the spin button to change the time
  83. INTERFACE: BLT_DATE_SPIN_GROUP() - constructor
  84. ~BLT_DATE_SPIN_GROUP() - destructor
  85. IsValid() - check the inputed date is correct or not
  86. TimeClick() - update the spin group values
  87. IsModified() - return whether the spin group has been
  88. modified by the user
  89. QueryYear() - return the year
  90. QueryMonth() - return the month
  91. QueryDay() - return the day
  92. PARENT: PUSH_BUTTON, CUSTOM_CONTROL
  93. USES: SPIN_GROUP, SPIN_SLE_NUM, SPIN_SLT_SEPARATOR, OWNER_WINDOW,
  94. XYPOINT, XYDIMENSION
  95. HISTORY:
  96. terryk 1-Jun-91 Created
  97. beng 14-Aug-1992 Pretty up the painting a bit
  98. jonn 5-Sep-95 Use BLT_BACKGROUND_EDIT
  99. **********************************************************************/
  100. DLL_CLASS BLT_DATE_SPIN_GROUP: public CONTROL_GROUP
  101. {
  102. private:
  103. SPIN_GROUP _sbControl; // spin group
  104. SPIN_SLE_NUM_VALID _ssnMonth; // month field
  105. SPIN_SLT_SEPARATOR _ssltSeparator1; // separator1
  106. SPIN_SLE_NUM_VALID _ssnDay; // day field
  107. SPIN_SLT_SEPARATOR _ssltSeparator2; // separator2
  108. SPIN_SLE_NUM_VALID _ssnYear; // Year field
  109. BLT_BACKGROUND_EDIT _bkgndFrame; // framing rectangle
  110. BOOL _fYrCentury; // Year 4 digits or 2 digits
  111. APIERR PlaceControl( INT nPos, OWNER_WINDOW * powin,
  112. const INTL_PROFILE & intlprof,
  113. const XYPOINT & xyYear, const XYDIMENSION & dxyYear,
  114. const XYPOINT & xyMonth, const XYDIMENSION & dxyMonth,
  115. const XYPOINT & xyDay, const XYDIMENSION & dxyDay);
  116. BOOL IsConstructionFail( CONTROL_WINDOW * pwin );
  117. protected:
  118. virtual VOID SaveValue( BOOL fInvisible = TRUE );
  119. virtual VOID RestoreValue( BOOL fInvisible = TRUE );
  120. virtual VOID SetControlValueFocus();
  121. public:
  122. BLT_DATE_SPIN_GROUP( OWNER_WINDOW *powin, const INTL_PROFILE & intlprof,
  123. CID cidSpinButton,
  124. CID cidUpArrow, CID cidDownArrow, CID cidMonth,
  125. CID cidSeparator1, CID cidDay, CID cidSeparator2,
  126. CID cidYear, CID cidFrame);
  127. ~BLT_DATE_SPIN_GROUP();
  128. BOOL IsValid();
  129. APIERR SetCurrentDay();
  130. BOOL IsModified()
  131. {
  132. return _sbControl.IsModified();
  133. }
  134. INT QueryYear() const;
  135. INT QueryMonth() const;
  136. INT QueryDay() const;
  137. VOID SetYear( INT nYear );
  138. VOID SetMonth( INT nMonth );
  139. VOID SetDay( INT nDay );
  140. };
  141. #if 0
  142. /**********************************************************************
  143. NAME: TIME_DATE_DIALOG
  144. SYNOPSIS: Time and date control panel
  145. INTERFACE:
  146. TIME_DATE_DIALOG() - constructor
  147. ~TIME_DATE_DIALOG() - destructor
  148. QueryHour() - return hour (0-24)
  149. QueryMin() - return minute (0-59)
  150. QuerySec() - return second (0-59)
  151. QueryYear() - return year
  152. QueryMonth() - return month(1-12)
  153. QueryDay() - return Day (1-31)
  154. PARENT: DIALOG_WINDOW
  155. USES: BLT_TIME_SPIN_GROUP, BLT_DATE_SPIN_GROUP, WINDOW_TIMER
  156. CAVEATS: This class should be the parent class of TIME/DATE
  157. control panel. The user can add OK or Cancel button
  158. into the dialog book by subclassing this class.
  159. HISTORY:
  160. terryk 11-Jul-91 Created
  161. rustanl 11-Sep-91 Changed BLT_TIMER to WINDOW_TIMER
  162. beng 05-Oct-1991 Win32 conversion
  163. **********************************************************************/
  164. DLL_CLASS TIME_DATE_DIALOG: public DIALOG_WINDOW
  165. {
  166. private:
  167. BLT_TIME_SPIN_GROUP _TimeSG;
  168. BLT_DATE_SPIN_GROUP _DateSG;
  169. WINDOW_TIMER *_pTimer;
  170. protected:
  171. virtual BOOL OnTimer( const TIMER_EVENT & e );
  172. public:
  173. TIME_DATE_DIALOG( const TCHAR * pszResourceName, HWND hwndOwner,
  174. const INTL_PROFILE & intlprof,
  175. CID cidTimeSpinButton,
  176. CID cidTimeUpArrow, CID cidTimeDownArrow, CID cidHour,
  177. CID cidTimeSeparator1, CID cidMin, CID cidTimeSeparator2,
  178. CID cidSec, CID cidAMPM,
  179. CID cidDateSpinButton,
  180. CID cidDateUpArrow, CID cidDateDownArrow, CID cidMonth,
  181. CID cidDateSeparator1, CID cidDay, CID cidDateSeparator2,
  182. CID cidYear);
  183. ~TIME_DATE_DIALOG();
  184. INT QueryHour() const
  185. { return _TimeSG.QueryHour(); }
  186. INT QueryMin() const
  187. { return _TimeSG.QueryMin(); }
  188. INT QuerySec() const
  189. { return _TimeSG.QuerySec(); }
  190. INT QueryYear() const
  191. { return _DateSG.QueryYear(); }
  192. INT QueryMonth() const
  193. { return _DateSG.QueryMonth(); }
  194. INT QueryDay() const
  195. { return _DateSG.QueryDay(); }
  196. BOOL IsValid()
  197. {
  198. // TimerSG is always valid
  199. return _DateSG.IsValid();
  200. }
  201. };
  202. #endif // disabled unused code
  203. #endif // _BLTTD_HXX_