home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c500 / 4.ddi / ALARM.WEX / ALARM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-28  |  3.8 KB  |  136 lines

  1. /*
  2.  *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3.  *%                                       %
  4.  *%    Copyright (C) 1991, by WATCOM Systems Inc. All rights reserved.    %
  5.  *%                                       %
  6.  *%     Permission is granted to anyone to use this example program for       %
  7.  *%     any purpose on any computer system, subject to the following       %
  8.  *%    restrictions:                               %
  9.  *%                                       %
  10.  *%     1. This example is provided on an "as is" basis, without warranty. %
  11.  *%       You indemnify, hold harmless and defend WATCOM from and against %
  12.  *%       any claims or lawsuits, including attorney's, that arise or       %
  13.  *%       result from the use or distribution of this example, or any     %
  14.  *%       modification thereof.                       %
  15.  *%                                       %
  16.  *%     2. You may not remove, alter or suppress this notice from this       %
  17.  *%        example program or any modification thereof.               %
  18.  *%                                       %
  19.  *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  20.  *
  21.  * ALARM.H
  22.  *
  23.  * definitions for the alarm clock windows program
  24.  *
  25.  */
  26. typedef enum {                /* for foreground or background pen */
  27.     FOREGROUND,
  28.     BACKGROUND,
  29.     NUMBER_OF_PENS
  30. } pen_type;
  31.  
  32. typedef enum {
  33.     HOUR_TENS,
  34.     HOUR_ONES,
  35.     MIN_TENS,
  36.     MIN_ONES,
  37.     SEC_TENS,
  38.     DIGITS_WITHOUT_SECONDS = SEC_TENS,
  39.     SEC_ONES,
  40.     DIGITS_WITH_SECONDS
  41. } digit_index;
  42.  
  43. typedef enum {
  44.     TOP_DOT,
  45.     BOT_DOT,
  46.     NUMBER_OF_DOTS
  47. } dot_index;
  48.  
  49. typedef enum {
  50.     SEGMENT_0,
  51.     SEGMENT_1,
  52.     SEGMENT_2,
  53.     SEGMENT_3,
  54.     SEGMENT_4,
  55.     SEGMENT_5,
  56.     SEGMENT_6,
  57.     NUMBER_OF_SEGMENTS
  58. } segment_index;
  59.  
  60. typedef enum {
  61.     COLON_0,
  62.     COLON_1,
  63.     COLON_2,
  64.     NUMBER_OF_COLONS
  65. } colon_index;
  66.  
  67. #ifdef __WINDOWS_386__
  68. #define _EXPORT
  69. #else
  70. #define _EXPORT __export
  71. #endif
  72.  
  73. #define MINIMUM_HEIGHT            18  /* minimum digit height in pixels */
  74.  
  75. #define PORTION_OF_SPACE_FOR_SEGMENT    5   /* size of segment (1/5 of digit) */
  76. #define PORTION_FOR_SEGMENT_GAP        25  /* gap between segments (1/25) */
  77. #define PORTION_FOR_COLON        4   /* size saved for ":" (1/4) */
  78.  
  79. #define UNUSED_PORTION_OF_SCREEN_HEIGHT    8   /* 1/8 of screen height unused */
  80. #define UNUSED_PORTION_OF_SCREEN_WIDTH    16  /* 1/16 of screen width unused */
  81.  
  82. #define UNUSED_PORTION_OF_DIGIT_SPACE    6   /* 1/6 of digit space is unused */
  83.  
  84. #define NUMBER_OF_COLONS        3   /* there are 3 colons in the clock */
  85.  
  86. #define DIGIT_HEIGHT_SCALE        2   /* digit width is 2/3 its height */
  87. #define DIGIT_WIDTH_SCALE        3
  88.  
  89. typedef unsigned pixels;
  90.  
  91. typedef struct {            /* an (x,y) screen position */
  92.         pixels        x;        /* -- top left is (0,0) */
  93.     pixels        y;
  94. } position;
  95.  
  96. typedef struct {            /* start/end points of a line segment */
  97.         position    start;
  98.     position    end;
  99. } seg_position;
  100.  
  101. typedef struct {            /* info about one digit segment */
  102.     BOOL        on;        /* is it painted on the screen? */
  103.     seg_position    position;    /* where is it */
  104. } segment;
  105.  
  106. typedef struct {            /* info about one clock digit */
  107.     int        value;        /* what number is it? */
  108.     segment        segment[ NUMBER_OF_SEGMENTS ]; /* each segment */
  109. } digit;
  110.  
  111. typedef struct {            /* info about one "dot" of a colon */
  112.     pen_type    pen;        /* is it on (FORE) or off (BACK) */
  113.     position    top_left;    /* where is top left corner */
  114.     position    bot_rite;    /* where is bottom right corner */
  115. } colon_part;
  116.  
  117. typedef struct {            /* info about one colon */
  118.     colon_part    dot[NUMBER_OF_DOTS];
  119. } colon;
  120.  
  121. #define MENU_ABOUT        1    /* define our menu items */
  122. #define MENU_DISPLAY_SECONDS    2
  123. #define MENU_SUPRESS_SECONDS    3
  124. #define MENU_SET_ALARM        4
  125. #define MENU_RUN_CLOCK        5
  126. #define MENU_12_HOUR_CLOCK    6
  127. #define MENU_24_HOUR_CLOCK    7
  128.  
  129. #define ONE_SECOND        1000    /* one second is 1000 milliseconds */
  130.  
  131. #define BUFLEN            30    /* length of buffer reqd by MessageBox */
  132.  
  133. #define BLANK_SPACE_VALUE    10    /* this digit will draw as a blank */
  134.  
  135. #define TIMER_ID        1    /* id to use for our timer */
  136.