home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / GUILIB.ZIP / GUI.H < prev    next >
C/C++ Source or Header  |  1994-01-01  |  14KB  |  331 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                 PROTO TYPES                              */
  3. /*--------------------------------------------------------------------------*/
  4. int           alt_control(int,int);
  5. void          pls(int,int,unsigned char[],int);      
  6. void          plsh(int,int,unsigned char[],int,int);
  7. void          gpls(int,int,unsigned char[],int);
  8. void          gpls2(int,int,unsigned char *,int);
  9. void          cgpls(int,int,unsigned char[],int);
  10. void          help(char *,char *,char *);
  11. void          frect(int,int,int,int,int,int);
  12. void          dl_rect(int,int,int,int,int);
  13. void          rect(int,int,int,int,int);
  14. int           menus(char [20][40],int,int,int,int,int,int,int);
  15. void          writechar(int,int,unsigned char,int);
  16. void          gwritechar2(int,int,int ,int);
  17. void          gwritechar(int,int,unsigned char,int);
  18. void          delay_func(int);
  19. void          writecharh(int,int,unsigned char,int,int);
  20. void          initdisplay(void);
  21. int           getkey(void);
  22. int           messagebox(int,int,int,int,int,int,int);
  23. void          destroy_messagebox(int);
  24. void          chcolor(int,int,int,int,int);
  25. void          mchcolor(int,int,int,int,int);
  26. void          mchcolorh(int,int,int,int,int,int);
  27. void          show_mouse_cursor(void);
  28. void          hide_mouse_cursor(void);
  29. void          get_mouse_location(void);
  30. void          get_ml(int *,int *);
  31. void          set_ml(int ,int );
  32. int           mouse_left_pressed(void);
  33. int           mouse_state(void);
  34. void          limit_mouse(int,int,int,int);
  35. int           bar_menu(int);
  36. int           alt_pressed(void);
  37. void          txt_curs(int);
  38. void          cls(void);
  39. void          bg_menu_color(int color);
  40. void          fg_menu_color(int color);
  41. void          bg_menu_hotkey_color(int);
  42. void          fg_menu_hotkey_color(int);
  43. void          bg_menu_sel_color(int);
  44. void          fg_menu_sel_color(int);
  45. void          bg_menu_shadow(int);
  46. void          fg_menu_shadow(int);
  47. void          ch_menu_x(int);
  48. void          ch_menu_y(int);
  49. void          ch_menu_xsize(int);
  50. void          ch_menu_filename(char *);
  51. void          set_menu_descriptor(int, char **,int); 
  52. void          frect_char(unsigned char) ;
  53. unsigned char readchar(int,int);
  54. int           readcolor(int,int);
  55. int           text_field(struct xfield *,int);
  56. int           binary_field(struct bfield *,int,int);
  57. void          readstring(int,int,int,char *);
  58. int           set_video_mode(int);
  59. int           get_video_mode(void);
  60. void          gcurs(int);
  61.  
  62. void          DISPLAYCHAR(int,int,int,int,int);
  63.  
  64. void          SETPIX(int ,int ,char );
  65. int           GETPIX(int ,int );
  66. void          GLINE(int ,int ,int ,int ,int,char );
  67. void          gr_line(int ,int ,int ,int ,int );
  68. void          cgr_line(int ,int ,int ,int ,int );
  69. void          grect(int ,int ,int ,int ,int );
  70. void          gr_line(int ,int ,int ,int ,int );
  71. void          cgrect(int ,int ,int ,int ,int );
  72. void          gfillrect(int ,int ,int ,int ,int );
  73. void          cgfillrect(int ,int ,int ,int ,int );
  74. void          ELLIPSE(int,int,int,int,int);
  75. int           RCELLIP(int,int,int,int,int,int,int,int,int);
  76. int           PCELLIP(int,int,int,int,int,int,int,int,int);
  77. void          RESTORE_IMAGE(char far *,int,int);
  78. int           GET_IMAGE(int,int,int,int,char far *);
  79. long          get_block_size(int ,int ,int ,int );
  80. void          draw_cursor(int,int);
  81. void          xor_line(int,int,int,int,int);
  82. void          xor_rect(int ,int ,int ,int ,int ,int );
  83. void          xor_frect(int ,int ,int ,int ,int );
  84. int           show_percent_bar( int,int, int, int, int, int, int, int ,int);
  85. int           vtext( int,int,int,int,char *,int,int,char);
  86. int           scr_bar(int,int,int,int *,int,int,int,int,int,int,int);
  87. int           draw_button(char *,int ,int ,int ,int ,int ,int );
  88. void          disable_button(int );
  89. void          disable_button2(int ,int);
  90. int           check_button(int);
  91. void          deactivate_activebuttons(void);
  92. void          reactivate_activebuttons(void); // reactivate all previously active buttons
  93.  
  94. /*--------------------------------------------------------------------------*/
  95. /*                               STRUCTURES                                 */
  96. /*--------------------------------------------------------------------------*/
  97. struct xfield          
  98.   int  type;               /* type of the field                 */
  99.   int  x;                  /* field's X coordinate              */
  100.   int  y;                  /* field's Y coordinate              */
  101.   int  length;             /* field length                      */
  102.   char title[20];          /* title of the field                */
  103.   char f[80];              /* field content                     */
  104.   int  fcolor;             /* field color                       */
  105.   int  tcolor;             /* title color                       */
  106.   int  xstart;             /* default x location for the cursor */
  107.  
  108. };
  109. /*--------------------------------------------------------------------------*/
  110. struct bfield
  111. {
  112.   int  x;                  /* x coordinate of the field         */
  113.   int  y;                  /* y coordinate of the field         */
  114.   char title[54];          /* title of the field                */
  115.   int  fcolor;             /* color of the field it selft       */
  116.   int  tcolor;             /* color of the title of the field   */
  117.   int  content;            /* set to yes or no                  */
  118.  
  119. };
  120. /*--------------------------------------------------------------------------*/
  121. /*                               DEFINITIONS                                */
  122. /*--------------------------------------------------------------------------*/
  123.  
  124. /*--------------------------------------------------------------------------*/
  125. /* Changing these values is only effective after a recompile of the library */
  126. /*--------------------------------------------------------------------------*/
  127. #define MAX_TITLE   10
  128. #define MAX_ENTRIES 25
  129. #define MAX_ACC     100     
  130. #define MAX_WINDOWS 20      
  131. #define MAX_BUTTONS 40
  132. /*--------------------------------------------------------------------------*/
  133.  
  134. #define F_TEXT                  0
  135. #define F_NUMBER                1
  136. #define F_DATE                  2
  137. #define F_TIME                  3
  138. #define F_TEL                   4
  139. #define TEXT_FILE               0
  140. #define VARIABLE                1
  141. #define OFF                     0
  142. #define ON                      1
  143. #define YES                     1
  144. #define NO                      0
  145. #define BS                      8
  146. #define FORMFEED                12
  147. #define CR                      13
  148. #define ENTER                   13
  149. #define ESC                     27
  150. #define HOMEKEY                 327
  151. #define ENDKEY                  335
  152. #define UPKEY                   328
  153. #define DOWNKEY                 336
  154. #define PGUPKEY                 329
  155. #define PGDNKEY                 337
  156. #define LEFTKEY                 331
  157. #define INSKEY                  338
  158. #define RIGHTKEY                333
  159. #define DELKEY                  339
  160. #define CTRLLEFTKEY             371
  161. #define CTRLRIGHTKEY            372
  162. #define TAB                     9
  163. #define SHIFTTAB                271
  164. #define SPACE                   32
  165. #define BLOCK1                  176
  166. #define BLOCK2                  177
  167. #define BLOCK3                  178
  168. #define PRESSED                 0
  169. #define RELEASED                1
  170. #define PRESSEDRELEASED         2
  171. #define DOUBLECLICKED           3
  172. #define DOUBLECLICKDELAY        300   // delay between clickes to qualify as 
  173.                                       // double click
  174. #define CONTROL                 -5
  175. #define REPORT                  30
  176. #define SET_NUM_FIELDS          22
  177. #define ACTION                  21
  178. #define NEW_FIELD               20
  179. #define MOVE                    9
  180. #define INIT                    10
  181. #define KEY_RETURN              1
  182. #define DISPLAY                 2
  183. #define EDIT                    3
  184.  
  185. #define F1                      315
  186. #define F2                      316
  187. #define F3                      317
  188. #define F4                      318
  189. #define F5                      319
  190. #define F6                      320
  191. #define F7                      321
  192. #define F8                      322
  193. #define F9                      323
  194. #define F10                     324
  195.  
  196. /*----------*/
  197. /* Alt Keys */
  198. /*----------*/
  199.  
  200. #define ALTA                    286
  201. #define ALTB                    304
  202. #define ALTC                    302
  203. #define ALTD                    288
  204. #define ALTE                    274
  205. #define ALTF                    289
  206. #define ALTG                    290
  207. #define ALTH                    291
  208. #define ALTI                    279
  209. #define ALTJ                    292
  210. #define ALTK                    293
  211. #define ALTL                    294
  212. #define ALTM                    306
  213. #define ALTN                    305
  214. #define ALTO                    280
  215. #define ALTP                    281
  216. #define ALTQ                    272
  217. #define ALTR                    275
  218. #define ALTS                    287
  219. #define ALTT                    276
  220. #define ALTU                    278
  221. #define ALTV                    303
  222. #define ALTW                    273
  223. #define ALTX                    301
  224. #define ALTY                    277
  225. #define ALTZ                    300
  226.  
  227. /*--------------------------------------------*/
  228. /*                  COLORS                    */
  229. /*--------------------------------------------*/
  230. #define BK_BLACK                0x00
  231. #define BK_BLUE                 0x10
  232. #define BK_GREEN                0x20
  233. #define BK_CYAN                 0x30
  234. #define BK_RED                  0x40
  235. #define BK_MAGENTA              0x50
  236. #define BK_BROWN                0x60
  237. #define BK_WHITE                0x70
  238.                              
  239.  
  240. #define FG_BLACK                0x00
  241. #define FG_BLUE                 0x01
  242. #define FG_GREEN                0x02
  243. #define FG_CYAN                 0x03
  244. #define FG_RED                  0x04
  245. #define FG_MAGENTA              0x05
  246. #define FG_BROWN                0x06
  247. #define FG_WHITE                0x07
  248. #define FG_GRAY                 0x08
  249. #define FG_LIGHT_BLUE           0x09
  250. #define FG_LIGHT_GREEN          0x0A
  251. #define FG_LIGHT_CYAN           0x0B
  252. #define FG_LIGHT_RED            0x0C
  253. #define FG_LIGHT_MAGENTA        0x0D
  254. #define FG_LIGHT_YELLOW         0x0E
  255. #define FG_BRIGHT_WHITE         0x0F
  256. /*--------------------------------------------------------------------------*/
  257. /*                          GLOBAL     VARIABLES                            */
  258. /*--------------------------------------------------------------------------*/
  259. extern  int            mousefound;    /* YES or NO  exist ?      */
  260. extern  int            mouse_x;       /* mouse x,y in text mode coordinates */
  261. extern  int            mouse_y;
  262.  
  263. extern  int            txt_curs_x;    /* text cursor coordinates */
  264. extern  int            txt_curs_y;
  265. extern  int            ms;            /* mouse state varaible    */
  266. extern  int            dc;            /* mouse double click state */
  267. extern  unsigned char  back_block;   /* character for fillrect in text mode */
  268. extern char            menu_file[40];     /* current menu file name     */
  269. extern int             menu_color;        /* color of the menu          */
  270. extern int             menu_hotkey_color; /* color of the menu hot keys */
  271. extern int             menu_sel_color;    /* color of the selected entry */
  272. extern int             menu_x;            /* menu x,y coordinates in text */     
  273. extern int             menu_y;
  274. extern int             menu_x_size;       /* menu xsize in text sizes  */    
  275. extern int             font_width;       /* font width & height in graphics */
  276. extern int             font_height;
  277. extern int             gr_scr_xsize;     /* current video mode screen size */
  278. extern int             gr_scr_ysize;
  279. extern int             txt_scr_xsize;    /* current mode text screen size  */
  280. extern int             txt_scr_ysize;
  281. extern int             xwin      [MAX_WINDOWS];  /* open window variables */
  282. extern int             ywin      [MAX_WINDOWS];
  283. extern int             xwinsize  [MAX_WINDOWS];
  284. extern int             ywinsize  [MAX_WINDOWS];
  285. extern int             wincolor  [MAX_WINDOWS];
  286. extern int             winshadow [MAX_WINDOWS];
  287. extern int             winborder [MAX_WINDOWS];
  288. extern char            menu_title[MAX_TITLE][20]; /* menu titles array */   
  289. extern char            title_hotkey[MAX_TITLE];   /* menu bar variables */
  290. extern char            title_hotkey_loc[MAX_TITLE];
  291. extern long            title_loc [MAX_TITLE];        
  292. extern int             title_ident[MAX_TITLE];
  293. extern int             title_acc[MAX_TITLE];
  294. extern int             title_x[MAX_TITLE];
  295. extern int             title_num;                 
  296. extern int             title_ptr;
  297. extern unsigned char   *sc;
  298. extern unsigned char   *save_box [MAX_WINDOWS];
  299. extern int             num_of_lines;
  300. extern int             text_show;
  301. extern int             open_win  [MAX_WINDOWS]; 
  302. extern int             show_win_num;                /* total displayed windows        */
  303. extern int             initvar;
  304. extern char far        *gsave_box[MAX_WINDOWS];
  305. extern int             mouse_display;
  306. extern int             in_menu;
  307. extern int             menu_move_lock;          
  308. extern char            xor_var;
  309. extern int             soft_return    ;    // when on field will do soft returns
  310. extern char            soft_word[80]  ;    // store the word for soft return;
  311. /*-------------------------------*/
  312. /* FOR POWERC      COMPILER      */
  313. /*-------------------------------*/
  314. #ifdef PC
  315. #define delay(i) sleep(i/1000)
  316. #define _enable() enable()
  317. #define _disable() disable()
  318. #endif
  319. /*-------------------------------*/
  320.  
  321. /*-------------------------------*/
  322. /* FOR Microsoft   COMPILER      */
  323. /*-------------------------------*/
  324. #ifdef MSC
  325. #define MK_FP(seg,ofs) ((void far *) (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
  326. #define farmalloc(i) _fmalloc(i)
  327. #define farfree _ffree
  328. #endif
  329. /*-------------------------------*/
  330.