home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc / qc20 / menu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-29  |  1.9 KB  |  63 lines

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