home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / add-on / include / menu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-19  |  3.6 KB  |  100 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ident    "@(#)libetitam:menu.h    1.1"
  12. #ifndef _MENU
  13. #define _MENU
  14.  
  15. #include "track.h"
  16. #include "sys/window.h"
  17.  
  18. extern char *strtok(), *strchr();
  19.                     /* cosmetic and build params    */
  20. #define MIN(a,b)    (((a)<(b))?(a):(b))
  21. #define MAX(a,b)    (((a)>(b))?(a):(b))
  22. #define ROUND(a,b)    (((a)+(b-1))/(b))
  23. #define MINROW        4    /* min space in rows for vscroll arrows */
  24.  
  25. #define M_MAXLINE    76        /* size of typing line        */
  26. #define M_SHORT        15        /* size before leave 1 col    */
  27. #define M_MAXHEIGHT    20        /* maximum menu height        */
  28. #define M_MAXWIDTH    75        /* maximum menu width        */
  29.  
  30. #define M_LRMARGIN    2        /* size of left, right margins    */
  31. #define M_TBMARGIN    1        /* size of top/bottom margins    */
  32. #define M_CSPACE    2        /* space between columns    */
  33.  
  34. #define M_BORDFLAGS    (BORDHELP|BORDCANCEL|BORDVSCROLL|BORDRESIZE)
  35.  
  36.                     /* menu operations        */
  37. #define M_BEGIN        0x1        /* begin a menu            */
  38. #define M_END        0x2        /* end (delete) the menu    */
  39. #define M_INPUT        0x4        /* accept input            */
  40. #define M_DESEL        0x8        /* de-select everything first    */
  41. #define M_POPUP        (M_BEGIN|M_END|M_INPUT|M_DESEL)
  42.  
  43.                     /* menu flags            */
  44. #define M_SINGLE    0x1        /* allow only single selections    */
  45. #define M_USEWIN    0x2        /* use caller's window        */
  46. #define M_WINSON    0x4        /* use son placement algorithm    */
  47. #define M_WINNEW    0x8        /* use new placement algorithm    */
  48. #define M_NOMOVE    0X10        /* true if no move icon        */
  49. #define M_NOHELP    0X20        /* true if no help icon        */
  50. #define M_NORESIZE    0X40        /* true if no resize icon    */
  51. #define M_ASISTITLE    0X80        /* true if use title as is      */
  52.  
  53.                     /* item flags            */
  54. #define M_MARKED    0x1        /* item is marked        */
  55. #define M_DIMMED    0x2        /* item is lower intensity    */
  56. #define M_REDISP    0x80        /* needs redisplay (internal)    */
  57.  
  58.                     /* return codes            */
  59.                     /* positive number is keycode    */
  60. #define MERR_OK        0        /* returned when no keystroke    */
  61. #define MERR_SYS    -1        /* system err (signal)        */
  62. #define MERR_ARGS    -2        /* catch all for bad args    */
  63. #define MERR_NOWIN    -3        /* can't create a window    */
  64. #define MERR_TOOSMALL    -4        /* window is too small        */
  65. #define MERR_GETSTAT    -5        /* error during getstat        */
  66. #define MERR_SETSTAT    -6        /* error during setstat        */
  67. #define MERR_NOMEM    -7        /* malloc failed        */
  68. #define MERR_BIG    -8        /* window is too big        */
  69. #define MERR_WRITE    -9        /* window write failed        */
  70.  
  71. typedef struct
  72. {
  73.     char        *mi_name;    /* name of item            */
  74.     char        mi_flags;    /* flags            */
  75.     int        mi_val;        /* user-supplied value        */
  76. } mitem_t;
  77.  
  78. typedef struct
  79. {
  80.     char        *m_label;    /* menu label            */
  81.     char        *m_title;    /* menu title            */
  82.     char        *m_prompt;    /* menu prompt            */
  83.     char        m_rows;        /* desired rows            */
  84.     char        m_cols;        /* desired cols            */
  85.     char        m_iwidth;    /* truncation width        */
  86.     char        m_iheight;    /* item height            */
  87.     char        m_flags;    /* flags            */
  88.     char        m_lbuf[M_MAXLINE]; /* input buffer        */
  89.     int        m_win;        /* window pointer        */
  90.     track_t        *m_track;    /* ptr to allocated track    */
  91.     int        m_oldwidth;    /* last known width        */
  92.     int        m_oldheight;    /* last known height        */
  93.     int        m_selcnt;    /* count of # selected        */
  94.     mitem_t        *m_items;    /* pointer to items        */
  95.     mitem_t        *m_curi;    /* current item            */
  96.     mitem_t        *m_topi;    /* top item            */
  97. } menu_t;
  98.  
  99. #endif /*_MENU*/
  100.