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.

166 lines
5.7 KiB

  1. /****************************************************************************/
  2. /* */
  3. /* CLOCK.H - */
  4. /* */
  5. /* Windows Clock Include File */
  6. /* */
  7. /****************************************************************************/
  8. /****************************************************************************/
  9. /* */
  10. /* Touched by : Diane K. Oh */
  11. /* On Date : June 11, 1992 */
  12. /* Revision remarks by Diane K. Oh ext #15201 */
  13. /* This file has been changed to comply with the Unicode standard */
  14. /* Following is a quick overview of what I have done. */
  15. /* */
  16. /* Was Changed it into Remark */
  17. /* === =============== ====== */
  18. /* CHAR TCHAR if it refers to text */
  19. /* LPCHAR & LPSTR LPTSTR if it refers to text */
  20. /* PSTR & NPSTR LPTSTR if it refers to text */
  21. /* */
  22. /****************************************************************************/
  23. /*--------------------------------------------------------------------------*/
  24. /* Typedefs and Structures */
  25. /*--------------------------------------------------------------------------*/
  26. typedef struct tagTIME
  27. {
  28. int hour; /* 0 - 11 hours for analog clock */
  29. int hour12; /* 12 hour format */
  30. int hour24; /* 24 hour format */
  31. int minute;
  32. int second;
  33. int ampm; /* 0 - AM , 1 - PM */
  34. } TIME;
  35. typedef struct tagDATE
  36. {
  37. int day;
  38. int month;
  39. int year;
  40. } xDATE;
  41. typedef struct tagCLOCKDISPSTRUCT
  42. {
  43. /* Clock display format for main window/icon outut */
  44. /* either IDM_ANALOG, or IDM_DIGITAL */
  45. WORD wFormat;
  46. /* flags */
  47. BOOL bIconic, bNoSeconds, bNoTitle, bTopMost, bNoDate;
  48. /* X and Y offset within client area of window
  49. * or icon where digital clock will be displayed */
  50. int nPosY, nPosHr, nPosSep1, nPosMin, nPosSep2, nPosSec, nPosAMPM;
  51. int nSizeChar, nSizeSep, nSizeY, nSizeAMPM;
  52. int nPosDateX, nPosDateY, nSizeDateX, nSizeDateY;
  53. /* size of shadow offset, in pixels. If 0, no shadow */
  54. WORD wShdwOff;
  55. /* handle to offscreen bitmap for fast painting of shadowed digits */
  56. HBITMAP hBitmap;
  57. /* buffer to hold the win.ini international indicators
  58. * for 1159, and 2359 AM/PM 12 hour time format.
  59. * szAMPM[0] holds AM, szAMPM[1] holds PM indicator */
  60. #define MAX_AMPM_LEN 10
  61. TCHAR szAMPM[2][MAX_AMPM_LEN];
  62. int nMaxAMPMLen;
  63. WORD wAMPMPosition;
  64. /* intl time format (like DOS) 0 - 12 hour, 1 - 24 hour */
  65. WORD wTimeFormat, wTimeLZero;
  66. #define MAX_DATE_LEN 80
  67. TCHAR szDateFmt[MAX_DATE_LEN];
  68. TCHAR szDate[MAX_DATE_LEN];
  69. int nDateLen;
  70. #define MAX_TIME_LEN 80
  71. TCHAR szTimeFmt[MAX_TIME_LEN];
  72. int nTimeLen;
  73. /* intl time seperator character */
  74. #define MAX_TIME_SEP 5
  75. TCHAR szTimeSep[MAX_TIME_SEP];
  76. } CLOCKDISPSTRUCT, *PCLOCKDISPSTRUCT;
  77. /*--------------------------------------------------------------------------*/
  78. /* Function Templates */
  79. /*--------------------------------------------------------------------------*/
  80. void NEAR GetTime (TIME *);
  81. void NEAR ConvTime (TIME *);
  82. void NEAR GetDate (xDATE *);
  83. void NEAR PASCAL PrepareSavedWindow (LPTSTR, PRECT);
  84. void NEAR PASCAL ParseSavedWindow (LPTSTR, PRECT);
  85. void NEAR PASCAL PrepareSavedFlags (LPTSTR, PCLOCKDISPSTRUCT);
  86. void NEAR PASCAL ParseSavedFlags (LPTSTR, PCLOCKDISPSTRUCT);
  87. LONG FAR PASCAL ClockWndProc (HWND, WORD, WORD, LONG);
  88. /*--------------------------------------------------------------------------*/
  89. /* Constants */
  90. /*--------------------------------------------------------------------------*/
  91. /* Main Menu ID defines */
  92. #define IDM_ANALOG 1
  93. #define IDM_DIGITAL 2
  94. #define IDM_SETFONT 3
  95. #define IDM_ABOUT 4
  96. #define IDM_TOPMOST 5 /* actually in system menu */
  97. #define IDM_NOTITLE 6
  98. #define IDM_SECONDS 7
  99. #define IDM_DATE 8
  100. #define IDM_UTC 9
  101. /* Temp ID for dialogs. */
  102. #define ID_JUNK 0xCACC
  103. #define ID_DATA 99
  104. /* String Resource definitions */
  105. #define IDS_APPNAME 2
  106. #define IDS_TOOMANY 3
  107. #define IDS_FONTFILE 4
  108. #define IDS_TOPMOST 5
  109. #define IDS_FONTCHOICE 22
  110. #define IDS_USNAME 23
  111. #define IDS_INIFILE 24
  112. #define IDD_FONT 100
  113. #define HOURSCALE 65
  114. #define MINUTESCALE 80
  115. #define HHAND TRUE
  116. #define MHAND FALSE
  117. #define SECONDSCALE 80
  118. #define MAXBLOBWIDTH 25
  119. #define BUFLEN 30
  120. #define REPAINT 0
  121. #define HANDPAINT 1
  122. #define UPDATE 0
  123. #define REDRAW 1
  124. #define OPEN_TLEN 450 /* < half second */
  125. #define ICON_TLEN 20000 /* 20 seconds */
  126. #ifndef HWND_TOPMOST
  127. #define HWND_TOPMOST ((HWND)-1)
  128. #endif
  129. #ifndef HWND_NOTOPMOST
  130. #define HWND_NOTOPMOST ((HWND)-2)
  131. #endif
  132.