home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c040 / 1.ddi / SAMPLES / MENU.H$ / MENU.bin
Encoding:
Text File  |  1990-01-19  |  2.2 KB  |  75 lines

  1. /* Function prototypes, macros, structure, and global variables for
  2.  * Menu and related functions.
  3.  */
  4.  
  5. /* Include only once */
  6. #ifndef MENU_H
  7. #define MENU_H
  8.  
  9. #define TRUE  1
  10. #define FALSE 0
  11.  
  12. /* Sample key codes for getkey. Additional codes in the same format may
  13.  * be added.
  14.  */
  15. #define U_UP    0x0148      /* Unshifted */
  16. #define U_DN    0x0150
  17. #define U_LT    0x014b
  18. #define U_RT    0x014d
  19. #define S_UP    0x0248      /* Shifted */
  20. #define S_DN    0x0250
  21. #define S_LT    0x024b
  22. #define S_RT    0x024d
  23.  
  24. #define N_PLUS  0x014e      /* PLUS and MINUS on numeric keypad */
  25. #define N_MINUS 0x014a
  26.  
  27. #define ENTER   13          /* ASCII */
  28.  
  29. /* Action codes for getkey */
  30. enum WAITACTION { NO_WAIT, WAIT, CLEAR_WAIT };
  31.  
  32. /* Text output colors. Note that monochrome can only use _TBLACK,
  33.  * _TWHITE, _TBRIGHTWHITE, and _TUNDERLINE. Graphics black-and-white
  34.  * can only use the first three of these. The first eight colors
  35.  * can be used as background colors (although they may need to be
  36.  * cast to long).
  37.  */
  38. enum TEXTCOLORS
  39. {
  40.     _TBLACK,        _TBLUE,         _TGREEN,        _TCYAN,
  41.     _TRED,          _TMAGENTA,      _TBROWN,        _TWHITE,
  42.     _TGREY,         _TLIGHTBLUE,    _TLIGHTGREEN,   _TLIGHTCYAN,
  43.     _TLIGHTRED,     _TLIGHTMAGENTA, _TLIGHTYELLOW,  _TBRIGHTWHITE,
  44.     _TUNDERLINE = 1
  45. };
  46.  
  47. /* Structure and global variable for menu attributes */
  48. typedef struct _MENU
  49. {
  50.     int     fgBorder, fgNormal, fgSelect, fgNormHilite, fgSelHilite;
  51.     long    bgBorder, bgNormal, bgSelect, bgNormHilite, bgSelHilite;
  52.     int     fCentered;
  53.     unsigned char   chNW, chNE, chSE, chSW, chNS, chEW;
  54. } MENU;
  55. extern MENU mnuAtrib;
  56.  
  57. /* Structure and maximum length for menu items */
  58. #define MAXITEM 20
  59. typedef struct _ITEM
  60. {
  61.     int     iHilite;
  62.     char    achItem[MAXITEM];
  63. } ITEM;
  64.  
  65. /* Public menu, output, and input functions */
  66. int  Menu( int row, int col, ITEM aItem[], int iCur );
  67. int  EventLoop( int row, int col, ITEM aItem[], int iCur, int cItem,
  68.                 int cchItem, int acchItem[], char achHilite[] );
  69. void Box( int row, int col, int rowLast, int colLast );
  70. unsigned GetKey( int fWait );
  71. void _outchar( char out );
  72. int  ClickOrPress( void );
  73.  
  74. #endif /* MENU_H */
  75.