home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CODE4-4.ZIP / HDR_EXMP.ZIP / INCLUDE.ZIP / W4.H < prev   
Encoding:
C/C++ Source or Header  |  1989-10-11  |  9.7 KB  |  270 lines

  1. /*  w4.h   (c)Copyright Sequiter Software Inc., 1987, 1988, 1989.  All rights reserved.  */
  2.  
  3. #ifdef UNIX
  4.    #ifndef CURSES_DONE
  5.       #include <tinfo.h>
  6.       #define CURSES_DONE
  7.    #endif
  8.  
  9.    #define  F_BLUE      A_NORMAL
  10.    #define  F_GREEN     A_NORMAL
  11.    #define  F_RED       A_NORMAL
  12.    #define  F_WHITE     A_NORMAL
  13.    #define  F_INTENSE   A_STANDOUT
  14.    #define  B_BLUE      A_REVERSE
  15.    #define  B_GREEN     A_REVERSE
  16.    #define  B_RED       A_REVERSE
  17.    #define  B_WHITE     A_REVERSE
  18.    #define  B_BLINK     A_BLINK
  19. #else
  20.    #define  F_BLUE      1L
  21.    #define  F_GREEN     2L
  22.    #define  F_RED       4L
  23.    #define  F_CYAN      3L
  24.    #define  F_MAGENTA   5L
  25.    #define  F_YELLOW    6L
  26.    #define  F_WHITE     7L
  27.    #define  F_INTENSE   8L
  28.    #define  B_BLUE   0x10L
  29.    #define  B_GREEN  0x20L
  30.    #define  B_RED    0x40L
  31.    #define  B_WHITE  0x70L
  32.    #define  B_BLINK  0x80L
  33. #endif
  34.  
  35. #define  SINGLE     "\xC4\xC4\xB3\xB3\xDA\xBF\xC0\xD9"
  36. #define  DOUBLE     "\xCD\xCD\xBA\xBA\xC9\xBB\xC8\xBC"
  37. #define  DOUBLE_TOP "\xCD\xCD\xB3\xB3\xD5\xB8\xD4\xBE"
  38. #define  PANEL      "\xDB\xDB\xDB\xDB\xDB\xDB\xDB\xDB"
  39.  
  40. #define  MAX_GET_WIDTH    258
  41. #define  DEFAULT_DATE    "MMM/DD/YY"
  42.  
  43. extern  int  v4default_window ;
  44.  
  45. typedef int  ACTION() ;
  46.  
  47. typedef struct
  48. {
  49.    int   next, prev ;
  50.  
  51.    /* Window Information */
  52.    int   hand ;                  /* A negative handle means use 'screen_ptr' */
  53.    int   start_row ;             /* The windows Origin Row */
  54.    int   start_col ;             /* The windows Origin Column */
  55.    int   row ;                   /* The current Row */
  56.    int   col ;                   /* The current Column */
  57.    int   width ;                 /* Number of characters in screen width */
  58.    int   display_bytes ;         /* Number of bytes on the screen */
  59.    int   height ;                /* The number of rows per page */
  60.    int   active ;                /* True if the window has been displayed */
  61.    char *border_chars ;          /* Border Characters; (char *) 0 if none */
  62.    long  border_attribute ;      /* Border Attribute Character */
  63.    long  attribute ;             /* The Current Attribute */
  64.  
  65.    #ifdef UNIX
  66.       WINDOW  *win ;
  67.       int      border_offset ;
  68.    #else
  69.       /* Some Extra Curses Definitions */
  70.       char *data ;                  /* A memory copy of the screen data */
  71.       char *old_screen ;            /* The old Screen Information for Popups */
  72.    #endif
  73.  
  74.    int   title_row ;
  75.    int   title_col ;
  76.    char *title ;
  77.    long  title_attribute ;
  78.  
  79.    /* Get Information */
  80.    int   first_get ;             /* A Reference to the First Get */
  81.    int   last_get ;              /* A Reference to the Last Get */
  82.    int   release ;               /* True if Gets are Released after Use */
  83.    char  get_delimiter[2] ;
  84.    long  get_attribute ;
  85.  
  86.    /* Menu Information */
  87.    int   first_menu ;            /* Reference to the first menu item reference */
  88.    int   last_menu ;             /* Reference to the last menu item reference */
  89.    int   start_item ;            /* The starting menu item reference */
  90.    int   horizontal ;            /* True if Horizontal Menu */
  91.    int   item_width ;            /* Column Distance between Menu Items */
  92.    int   key_read ;              /* 1 - Single Char; 2 - String Compare */
  93.    int   ignore_case ;           /* 1 - Ignore case of key */
  94.    long  menu_attribute ;        /* Default normal menu item attribute */
  95.    long  menu_att_active ;       /* Selected menu item attribute */
  96.    int   force_refresh ;         /* Refresh the menu window */
  97.    int   arrow_exit ;            /* TRUE if opposite arrow keys cause
  98.                     'n4activate' to exit */
  99.    int   up_key ;                /* A key to move the menu system up one */
  100.    int   exit_key ;              /* A key to exit the menu system */
  101.    int   return_start ;          /* A range of keys which exit the menu system */
  102.    int   return_end ;
  103. }  CB_WINDOW ;
  104.  
  105. typedef struct
  106. {
  107.    int    next, prev ;
  108.  
  109.    int    row ;           /* Specific row of menu item */
  110.    int    col ;           /* Specific column of menu item */
  111.  
  112.    int    window_ref ;    /* Corresponding window reference number */
  113.  
  114.    char  *item_ptr ;      /* Menu Item text */
  115.    int    skip_over ;     /* True if the this Menu Item may not be chosen */
  116.  
  117.    int    key_value ;     /* A key to move to and/or activate the menu item */
  118.    int    key_activate ;  /* Non-zero if the key press activates the menu item */
  119.    int    key_highlight_pos ;  /* -1 if there is no highlighting of special key */
  120.  
  121.    ACTION *reaction ;  /* Pointer to reaction routine */
  122.    int    reaction_parms[4];  /* Paramters for reaction routine */
  123.    ACTION *action ;    /* Pointer to action routine */
  124.    int    action_parms[4]; /* Parameters action routine */
  125.  
  126.    char  *message ;       /* Displayed with routine 'n4message_do' */
  127.    long   attribute ;     /* Attribute for the menu item (When Not Selected) */
  128. }  MENU ;
  129.  
  130.  
  131. typedef struct get_struct
  132. {
  133.    int   next, prev ;
  134.  
  135.    int   row ;              /* Row of the entry area */
  136.    int   col ;              /* Column of the entry area */
  137.    int   width_scr ;        /* Width of the Screen */
  138.  
  139.    int   window_ref ;       /* The Window Reference Number */
  140.  
  141.    char *picture ;          /* A picture entry template */
  142.    int   num_decimals ;     /* The number of decimals for numeric entries */
  143.    int   upper_convert ;    /* TRUE if complete Upper Case Conversion */
  144.  
  145.    int (*call)(struct get_struct *, char *, int) ;
  146.                 /* Routine to call before the GET */
  147.    int   call_data ;        /* Some data to be passed to the call routine */
  148.    int (*valid)(struct get_struct *) ;
  149.                 /* Routine to call to verify the GET */
  150.    char  type ;             /* C (Character), D (Date), L (Logical),
  151.                                N (Numeric),   d (double), l (long), i (int) */
  152.    void *data ;             /* Pointer to the Data Buffer */
  153.    int   width_data ;       /* The number of bytes pointed to by 'data' */
  154.    long  attribute ;        /* The attribute to be used for the 'GET' */
  155.    char  delimiter[2] ;     /* Up to two delimeter characters */
  156.    char *message ;          /* A message displayed by 'g4message_do' */
  157.  
  158. }  GET ;
  159.  
  160. typedef  int GET_ROUTINE( GET *, char *, int ) ;
  161.  
  162. GET     *g4alloc( int, int, void *, char ) ;
  163. void     g4( int, int, char * ) ;
  164. long     g4attribute( long ) ;
  165. void     g4bell( void) ;
  166. int      g4bell_set( int ) ;
  167. void     g4call( GET_ROUTINE *, int ) ;
  168. int      g4char( void) ;
  169. void     g4date( int, int, char * ) ;
  170. void     g4delimiter( char * ) ;
  171. void     g4double( int, int, double * ) ;
  172. void     g4display( void) ;
  173. void     g4field( int, int, long ) ;
  174. void     g4int( int, int, int * ) ;
  175. void     g4logical( int, int, int * ) ;
  176. void     g4long( int, int, long * ) ;
  177. int      g4menu( GET *, char *, int ) ;
  178. int      g4menu_help( GET *, char *, int ) ;
  179. void     g4message( char * ) ;
  180. void     g4message_do( char * ) ;
  181. void     g4numeric( int, int, char * ) ;
  182. void     g4picture( char * ) ;
  183. int      g4read( void) ;
  184. int      g4release( int ) ;
  185. void     g4upper( void) ;
  186. void     g4valid( int (*)(GET *)) ; /* g3valid has a routine as a parameter */
  187. void     g4width( int, int ) ;
  188.  
  189. int      n4( char * ) ;
  190. int      n4activate( int * ) ;
  191. void     n4arrow_exit( void ) ;
  192. void     n4attribute( long, long ) ;
  193. void     n4attribute_item( int, long ) ;
  194. void     n4calc( int, int, int ) ;
  195. void     n4get_calc( int ) ;
  196. void     n4horizontal( void) ;
  197. int      n4item( int, int, char * ) ;
  198. char    *n4item_text( int ) ;
  199. void     n4item_width( int ) ;
  200. void     n4key( int, int, int ) ;
  201. void     n4key_set( int, int ) ;
  202. void     n4key_special( int, int, int, int ) ;
  203. void     n4lotus( int ) ;
  204. void     n4message( char *) ;
  205. void     n4message_do( char * ) ;
  206. void     n4pulldown( int ) ;
  207. void     n4reaction() ;
  208. void     n4refresh( int ) ;
  209. int      n4search( char * ) ;
  210. int      n4skip_over( int, int ) ;
  211. void     n4start_item( int ) ;
  212.  
  213. void     w4( int, int, char * ) ;
  214. void     w4activate( int ) ;
  215. long     w4attribute( long ) ;
  216. void     w4border( char *, long ) ;
  217. void     w4box( char *, int, int, int, int) ;
  218. void     w4centre( int, char *) ;
  219. void     w4clear( int ) ;
  220. void     w4close( int ) ;
  221. int      w4col( void) ;
  222. void     w4cursor( int, int ) ;
  223. void     w4cursor_size( int, int ) ;
  224. void     w4deactivate( int ) ;
  225. int      w4define( int, int, int, int ) ;
  226. void     w4double( int, int, double, int, int ) ;
  227. void     w4eject( void) ;
  228. void     w4enlarge(void) ;
  229. void     w4exit(int) ;
  230. void     w4field( int, int, long ) ;
  231. int      w4handle( int ) ;
  232. int      w4height( int ) ;
  233. int      w4init( int, int, int ) ;
  234. void     w4int( int, int, int, int ) ;
  235. void     w4long( int,  int, long, int ) ;
  236. void     w4memory( void) ;
  237. void     w4num( int, int, char *, int ) ;
  238. void     w4num_att( int, int, char *, int, long ) ;
  239. void     w4out( char * ) ;
  240. void     w4popup(void) ;
  241. void     w4position( int, int ) ;
  242. void     w4read( int, int, char *, int ) ;
  243. void     w4read_window( int, char * ) ;
  244. void     w4repeat( int, int, char, int ) ;
  245. int      w4row( void) ;
  246. void     w4scroll( int ) ;
  247. int      w4select( int ) ;
  248. void     w4shrink(void) ;
  249. void     w4title( int, int, char *, long ) ;
  250. int      w4width( int ) ;
  251. void     w4write( int, int, char *, int ) ;
  252. void     w4write_att( int, int, char *, int, long ) ;
  253. void     w4write_window( int, char * ) ;
  254.  
  255. #ifdef UNIX
  256.    void  n4action() ;
  257.  
  258.    void  w4refresh_off() ;
  259.    void  w4refresh_on() ;
  260.    void  w4refresh(int) ;
  261. #else
  262.    int   w4display( char *, ... ) ;
  263.    void  n4action( ACTION *, ... ) ;
  264.  
  265.    void far W4READ_ASM( char far *, char far *, int ) ;
  266.    void far W4WRITE_ASM( char far *, char far *, int ) ;
  267.    void far W4WRITE_ATT_ASM( char far *, char far *, int, int ) ;
  268. #endif
  269.  
  270.