home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 December / VPR9712B.ISO / Nsos2 / OS2PLUG.EXE / SAMPLE / NPCLOCK / clock.h < prev    next >
Text File  |  1996-09-18  |  8KB  |  257 lines

  1. /***************************************************************************
  2.  *
  3.  * File name   :  clock.h
  4.  *
  5.  *  Copyright (C) 1996 IBM Corporation
  6.  *
  7.  *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  8.  *      sample code created by IBM Corporation. This sample code is not
  9.  *      part of any standard or IBM product and is provided to you solely
  10.  *      for  the purpose of assisting you in the development of your
  11.  *      applications.  The code is provided "AS IS", without
  12.  *      warranty of any kind.  IBM shall not be liable for any damages
  13.  *      arising out of your use of the sample code, even if they have been
  14.  *      advised of the possibility of such damages.                            
  15.  *
  16.  ***************************************************************************/
  17.  
  18. #ifndef _CLOCK_
  19. #define _CLOCK_
  20.  
  21. //-------------------------------------------------------------------------
  22. // Constants
  23. //-------------------------------------------------------------------------
  24.  
  25. #define MATLF_SIZE ( sizeof ( MATRIXLF ) / sizeof ( LONG ) )
  26.  
  27. #define CLK_MAJORTICKS  0x0001
  28. #define CLK_MINORTICKS  0x0002
  29.  
  30. #define XDATE 52L
  31. #define YDATE 14L
  32. #define ZDATE 1L
  33.  
  34. #define HT_HOUR           1
  35. #define HT_MINUTE         2
  36. #define HT_HOUR_SHADE     3
  37. #define HT_MINUTE_SHADE   4
  38. #define HT_SECOND   5
  39.  
  40. #define DM_TIME         ( (USHORT)0x0001)
  41. #define DM_DATE         ( (USHORT)0x0002)
  42. #define DM_ANALOG       ( (USHORT)0x0010)
  43. #define DM_DIGITAL      ( (USHORT)0x0020)
  44. #define DM_SECONDHAND   ( (USHORT)0x0040)
  45.  
  46. #define MAXTITLELENGTH 256
  47. #ifndef  MESSAGELEN
  48. #define MESSAGELEN     80
  49. #endif
  50. #define SHADE               0
  51. #define LIGHT               1
  52. #define SURFACE             2
  53. #define BACKGROUND          3
  54.  
  55. #define DP_INSIDE           0
  56. #define DP_UNDER            1
  57. #define DP_LEFTDOWN         2
  58. #define DP_LEFTMIDDLE       3
  59.  
  60. #define DM_REDRAW           0
  61. #define DM_UPDATE           1
  62.  
  63. #define AM_ACTIVE           ( (USHORT) 0x0001)
  64. #define AM_AUDIO            ( (USHORT) 0x0002)
  65. #define AM_MSGBOX           ( (USHORT) 0x0004)
  66. #define TIMER_ASYNC         1
  67. #define TIMER_CONT          2
  68. #define SEM_TIMER_NAME      "\\sem32\\applnam.sem"
  69. #ifndef NO_ERROR
  70. #define NO_ERROR            (APIRET ) 0L
  71. #endif
  72.  
  73. #define SEM_TIMER_VALUE     ( (ULONG) (1000L * 60 * 60) )
  74.  
  75. #define SZ_APPNAME  "ClockProgram 2.1"
  76. #define SZ_KEYNAME  "Preferences"
  77.  
  78. /*--------------------------------------------------------------*\
  79.  *  Messagetable ids
  80. \*--------------------------------------------------------------*/
  81. #ifndef IDMSG_INITFAILED
  82.  
  83. #define IDMSG_INITFAILED              101
  84. #define IDMSG_MAINWINCREATEFAILED     102
  85. #define IDMSG_CANNOTOPENINPUTFILE     103
  86. #define IDMSG_CANNOTOPENOUTPUTFILE    104
  87. #define IDMSG_CANNOTRUNCOLOR          108
  88. #define IDMSG_CANNOTGETHPS            109
  89. #define IDMSG_HELPLOADERROR           110
  90. #define IDMSG_CANNOTLOADSTRING        111
  91. #define IDMSG_CANNOTOPENPRINTER       112
  92. #define IDMSG_HELPDISPLAYERROR        113
  93. #define IDMSG_CANNOTLOADEXITLIST      114
  94. #define IDMSG_PRINTINITFAILED         115
  95. #define IDMSG_OVERWRITEFILE           116
  96. #define IDMSG_PRINTERROR              117
  97. #define IDMSG_UNDOFAILED              118
  98. #define IDMSG_CANNOTGETFILEINFO       119
  99. #define IDMSG_CANNOTALLOCATEMEMORY    120
  100. #define IDMSG_CANNOTREADFILE          121
  101. #define IDMSG_CANNOTWRITETOFILE       122
  102. #define IDMSG_CANNOTLOADFONTS         123
  103. #define IDMSG_CANNOTGETPAGEINFO       124
  104. #endif
  105. /**************************************************************************\
  106. *                                                                          *
  107. *       MODULE:     dialogs.h                                              *
  108. *                                                                          *
  109. *       COMMENT:    Constants for the Clock dialogs                        *
  110. *                                                                          *
  111. \**************************************************************************/
  112.  
  113.  
  114. #define CLKTM_MAJOR 0x0100
  115. #define CLKTM_MINOR 0x0200
  116.  
  117. #define CLKTM_ALWAYS    0x0001
  118. #define CLKTM_NOTICONIC 0x0002
  119. #define CLKTM_NEVER     0x0004
  120.  
  121. #define CLKCLR_BUTTONSHIFT 0x08
  122.  
  123. #define CLKCLR_OBJECTS      0x0100
  124. #define CLKCLR_BACKGROUND   0x0101
  125. #define CLKCLR_FACE         0x0102
  126. #define CLKCLR_HOURHAND     0x0103
  127. #define CLKCLR_MINUTEHAND   0x0104
  128.  
  129. #define CCHMAXSTRING                    256
  130. #define TIME_SEP_LEN        1
  131. #define DATE_SEP_LEN        1
  132. #define STRING_AM_LEN       2
  133. #define STRING_PM_LEN       2
  134. #define AM_PM  2                    /* index into rTimeSep */
  135. #define PATHMAX 259           /* path cb     max                     */
  136. #define COUNTRY_USA     1              /* Country code               */
  137. #define COUNTRY_UK      44             /* Country code               */
  138.  
  139. /*--------------------------------------------------------------*\
  140.  *  Standard Dialog box ids
  141. \*--------------------------------------------------------------*/
  142. #define FILEOPEN        2000
  143. #define FILESAVE        2001
  144.  
  145. #define MSGBOXID        1001
  146. #define OBJECTID        1002
  147.  
  148. //-------------------------------------------------------------------------
  149. // Structures
  150. //-------------------------------------------------------------------------
  151.  
  152. typedef struct _ALARMTIME
  153. {
  154.    UCHAR uchHour;
  155.    UCHAR uchMinutes;
  156.    USHORT usMode;
  157. } ALARMTIME;
  158.  
  159.  
  160. typedef struct _CLOCKPREF
  161. {
  162.     USHORT usMajorTickPref;    /*0,1*/
  163.     USHORT usMinorTickPref;    /*2,3*/
  164.     LONG clrBackground;        /*4,5,6,7*/
  165.     LONG clrFace;              /*8,9,a,b*/
  166.     LONG clrHourHand;          /*c,d,e,f*/
  167.     LONG clrMinuteHand;        /*10,11,12,13*/
  168.     LONG clrDateOnAnalog;      /*14,15,16,17*/
  169.     BOOL fControlsHidden;      /*18,19*/
  170.     USHORT usDispMode;         /*1a,1b*/
  171.     ALARMTIME alarm ;          /*1c,1d,1e,1f*/
  172.     SWP swp;                   /*20....*/
  173.     SHORT sTimerType;
  174.  
  175. } CLOCKPREF;
  176. typedef CLOCKPREF *PCLOCKPREF;
  177.  
  178. typedef struct _INISAVERESTORE
  179. {
  180.     SWP    swp;
  181.     USHORT yRestore;
  182.     USHORT xRestore;
  183.     USHORT yMinRestore;
  184.     USHORT xMinRestore;
  185. } INISAVERESTORE;
  186. typedef struct _DATETIME FAR *LPDT;    /* For DosGet/SetDateTime     */
  187.  
  188. struct CLKDATA {
  189.    HDC  hdcBuffer;
  190.    HPS  hpsBuffer;
  191.    BOOL fBufferDirty;
  192.    BOOL fEndThread;
  193.    HRGN hClipRegion;
  194.    HRGN hrgnFace;
  195.    CLOCKPREF cp;
  196.    HWND hwndHelpInstance;
  197.    HSWITCH hsw ;
  198.    BOOL fStartAsIcon ;
  199.    BOOL fHelpEnabled;
  200.    SHORT      Selected ;
  201.    SHORT      PreviousSelected;
  202.    BOOL     bLeadingZero;
  203.    BOOL     bIsIconic;
  204.    WRECT rDateTime[6];
  205.    WRECT rAlarmTime[3];      /* placement of time and date matters */
  206.    WRECT rRepaintTime;
  207.    WRECT rDateAssign[3];
  208.    SHORT sFirstTime;
  209.    SHORT sFirstDate;
  210.    SHORT asLeftOf[6];
  211.    SHORT asRightOf[6];
  212.    SHORT wDateTime[6];
  213.    SHORT wPrevDateTime[6];
  214.    HWND  hDate,hTime;
  215.    HWND  hDateScroll;
  216.    HWND  hTimeScroll;
  217.    HWND  hCurrentFocus;
  218.    HWND  hDateTime;
  219.    HWND  hAlarmTime;
  220.    BOOL bTwelveHourFormat;
  221.    WRECT rTimeSep[3];
  222.    CHAR  szTimeSep[TIME_SEP_LEN+1];
  223.    CHAR  szAnteMeridian[STRING_AM_LEN+1];
  224.    CHAR  szPostMeridian[STRING_PM_LEN+1];
  225.    CHAR  szTitle   [81];
  226.    CHAR  szErrClocks[PATHMAX+1];
  227.    WRECT rDateSep[2];
  228.    CHAR  szDateSep[DATE_SEP_LEN+1];
  229.    BOOL fTimeFreez ;
  230.    BOOL fDateFreez ;
  231.    USHORT vusDateFormat;
  232.    MATRIXLF vmatlfDateTrans;
  233.    MATRIXLF vmatlfDateScale;
  234.    DATETIME dt ;
  235.    BOOL fIconic , fShowSecondHand ;
  236.    char achOldTime[9];
  237.    char achAmPm[3];
  238.    char achOldAmPm[3];
  239.    char achOldDate[9];
  240.    HPS hpsWnd;
  241.    LONG cxScreen, cyScreen;  /* screen dimensions */
  242.    LONG vclrBG[3];
  243.    LONG vclrFace[3];
  244.    LONG vclrRing[3];
  245.    LONG vclrHands[3];
  246.    LONG vclrMajorTicks[3];
  247.    LONG vclrMinorTicks[3];
  248.    LONG vclrDate[4];
  249.    USHORT vusDatePos;
  250.    BOOL vbInAlarm;
  251.    HWND hwndEntryField;
  252. };
  253.  
  254. typedef CLKDATA *PCLKDATA;
  255.  
  256. #endif
  257.