home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / LVSWIN31.ZIP / LVSWIN.H < prev    next >
C/C++ Source or Header  |  1992-02-12  |  10KB  |  396 lines

  1. /* Copyright 1991 (c),   Lake View Software
  2.                          4321 Harborough Rd.
  3.                          Columbus, OH 43220
  4. */
  5.  
  6. #ifndef LVSWIN_H
  7. #define LVSWIN_H
  8.  
  9. /*
  10.  * Type defs
  11.  */
  12. typedef void (*bk_func)(void);
  13. typedef void (*key_func)(void);
  14. typedef void (*display_atst) (int ,int, char *, char *, int);
  15. typedef void (*display_ch)   (int,int,int,unsigned char);
  16.  
  17. /*
  18.  * Misc low level screen functions
  19.  */
  20. void Win_init (int mode);
  21. int *Win_save (int, int, int, int);
  22. void Win_restore (int, int, int, int, int *);
  23. void Win_clrscr ();
  24. int Win_setpage (int page);
  25. int Win_getpage ();
  26. void Win_bios (int mode);
  27. void Win_snow (int mode);
  28. void Win_mono (int mode);
  29. int Win_currentmode ();
  30. void Win_dispst (int y, int x, int color, char *str, int count);
  31. void Win_gotoxy (int y,int x);
  32. void Win_getxy (int *y,int *x);
  33. void Win_drawbox (int sr, int sc, int er, int ec, int color, int type);
  34. void Win_hidecur ();
  35. void Win_showcur ();
  36. int Win_map_attr (int attr);
  37. long pow_10 (int i);
  38. double pow_10d (int i);
  39. double dround (double d, int dec);
  40. void Win_beep ();
  41. void Win_delayticks (int ticks);
  42. extern display_atst Win_dispatst;
  43. extern display_ch   Win_dispch;
  44.  
  45. /*
  46.  * Keyboard functions
  47.  */
  48. int Win_lastkey ();                   /* return the last key pressed */
  49. int Win_keystuf (int key);
  50. int Win_getkey (int seconds);
  51. int Win_keywaiting ();
  52. void Win_setbkloop (bk_func func);
  53. void Win_setonkey (int key, key_func func);
  54. int Win_kbhit ();
  55. int is_read_exit_key (int key);
  56. int Win_DesqView_Aware ();
  57.  
  58. /*
  59.  * Information functions
  60.  */
  61. int Win_Max_x ();           /* Max screen x coordinate */
  62. int Win_Max_y ();           /* Max screen y coordinate */
  63. struct  Win_time_s
  64.     {
  65.     unsigned char   min;     /* minutes */
  66.     unsigned char   hour;    /* hours */
  67.     unsigned char   hund;    /* hundredths of seconds */
  68.     unsigned char   sec;     /* seconds */
  69.     };
  70. void Win_gettime (struct Win_time_s *t);
  71.  
  72. /*
  73.  * Control functions
  74.  */
  75. void Win_setcols (int cols);
  76. void Win_setrows (int rows);
  77. int Win_settabsize (int size);
  78.  
  79. /*
  80.  * String functions 
  81.  */
  82. char *strfill (unsigned char ch, int cnt);
  83. char *strtrim (char *str);
  84. char *str_setsz (char *str,int len);
  85. char *str_clear (char *str,int len);
  86. char *cut_spaces (char *str);
  87. int is_in (unsigned char ch, char *str);
  88.  
  89. /*
  90.  * VGA functions
  91.  */
  92.  
  93. int VGA_videotype ();
  94. int VGA_setlines (int lines);  /* Set number of screen lines 25/50 */
  95. int VGA_blinkstate ();      /* return state of blink */
  96. int VGA_setblink (int on_off);
  97. int VGA_fontload ();
  98. extern "C" {
  99.     void far VGA_Fload_16 ();    /* Carefull */
  100.     void far VGA_Fload_14 ();    /* Carefull */
  101.     void far VGA_Fload_8 ();     /* Carefull */
  102. };
  103.  
  104. /*
  105.  * Scroll display characters
  106.  */
  107.  
  108. #define RIGHT_ARROW_CHAR   ((unsigned char)0x10)
  109. #define LEFT_ARROW_CHAR    ((unsigned char)0x11)
  110. #define UP_ARROW_CHAR      ((unsigned char)0x1e)
  111. #define DOWN_ARROW_CHAR    ((unsigned char)0x1f)
  112. #define SCROLL_FILL_CHAR   ((unsigned char)0xb0)
  113. #define SCROLL_ELEV_CHAR   ((unsigned char)0xdb)
  114.  
  115. /*
  116.  * Video types
  117.  */
  118. #define V_VGA       1
  119. #define V_MCGA      2
  120. #define V_EGA       3
  121. #define V_CGA       4
  122. #define V_MONO      5
  123.  
  124. /*
  125.  * Global Variables 
  126.  */
  127. extern char *Box_char[];                /* in win_box.cpp */
  128.  
  129. /* 
  130.  * PC Info Functions 
  131.  */
  132. int Share_Loaded ();
  133. int Print_Loaded ();
  134. int Assign_Loaded ();
  135. int Himem_Loaded ();
  136. int Novel_Loaded ();
  137.  
  138. /*
  139.  * BOOL
  140.  */
  141. #ifndef TRUE
  142. #define TRUE        (1==1)
  143. #define FALSE       (1!=1)
  144. #endif
  145.  
  146. /* 
  147.  * Wait for retrace to suppress cga snow 
  148.  */
  149. #define waithret()          while((inp(0x03da)&0x01)!=0); \
  150.                             while((inp(0x03da)&0x01)==0)
  151. #define waitvret()          while((inp(0x03da)&0x08)!=0); \
  152.                             while((inp(0x03da)&0x08)==0)
  153.  
  154. /*
  155.  * Display Segments
  156.  */
  157. #define COLOR_SEG 0xb800
  158. #define MONO_SEG  0xb000
  159.  
  160. /* 
  161.  * Window init modes 
  162.  */
  163. #define W_DEFAULT 0
  164. #define W_MONO    1     /* Remap colors to mono */
  165. #define W_BIOS    2     /* BIOS video writes */
  166. #define W_SNOW    4     /* CGA snow suppression */
  167. #define W_NOCLEAR 8     /* don't clear the screen with init */
  168.  
  169. /*
  170.  * Predefined picture styles
  171.  */
  172. #define     DATE_STYLE      'D'
  173. #define     CENTURY_STYLE   'C'
  174. #define     SS_STYLE        'S'
  175. #define     PHONE_STYLE     'P'
  176. #define     ZIP_STYLE       'Z'
  177. #define     UPPER_STYLE     'U'
  178. #define     LOWER_STYLE     'L'
  179. #define     FIRST_STYLE     'F'
  180. #define     ANY_STYLE       'A'
  181.  
  182. /* 
  183.  * Get Key Modes 
  184.  */
  185. #define W_NOECHO 0
  186. #define W_ECHO   1
  187.  
  188. /* 
  189.  * Title postions 
  190.  */
  191. #define W_CENTER    0
  192. #define W_LEFT      1
  193. #define W_RIGHT     2
  194.  
  195. /* 
  196.  * Window Border Definitions 
  197.  */
  198. #define W_NOBORDER 0
  199. #define W_SPACES   1
  200. #define W_DOUBLE   2
  201. #define W_SINGLE   3
  202. #define W_DOUSIN   4
  203. #define W_SOLID    5
  204. #define W_SINDOU   6
  205. #define MAX_BOX_TYPE  6
  206. void Win_Load_Alt_Border ();    /* vga graphics only */
  207. void Win_Load_Alt_Box ();    /* vga graphics only */
  208.  
  209. /* 
  210.  * Window function return codes 
  211.  */
  212. #define W_OK       0
  213. #define W_ERROR   -1
  214. #define W_NOTOPEN -3
  215. #define W_OPENED  -4
  216. #define W_NOTINIT -5
  217. #define W_NOMEM   -6
  218. #define W_ESCAPE  -27
  219.  
  220. /* 
  221.  * Window misc 
  222.  */
  223. #define W_ON    1
  224. #define W_OFF   0
  225.  
  226. /* 
  227.  * Some Colors 
  228.  */
  229. #ifndef BLACK
  230. #define BLACK       0                   
  231. #define BLUE        1
  232. #define GREEN       2
  233. #define CYAN        3
  234. #define RED         4
  235. #define MAGENTA     5
  236. #define BROWN       6
  237. #define YELLOW      14
  238. #define WHITE       15
  239. #endif
  240. #define LGREY       7
  241. #define DGREY       8
  242. #define LBLUE       9
  243. #define LGREEN      10
  244. #define LCYAN       11
  245. #define LRED        12
  246. #define LMAGENTA    13
  247. #define _BLACK      0
  248. #define _BLUE       16
  249. #define _GREEN      32
  250. #define _CYAN       48
  251. #define _RED        64
  252. #define _MAGENTA    80
  253. #define _BROWN      96
  254. #define _LGREY      112
  255. /*
  256.  * VGA highlighted background colors
  257.  */
  258. #define _DGREY      (8*16)
  259. #define _LBLUE      (9*16)
  260. #define _LGREEN     (10*16)
  261. #define _LCYAN      (11*16)
  262. #define _LRED       (12*16)
  263. #define _LMAGENTA   (13*16)
  264. #define _YELLOW     (14*16)
  265. #define _WHITE      (15*16)
  266.  
  267. /* 
  268.  * Printer attributes   Can be ored together if you printer can handle it 
  269.  */
  270. #define P_UNDERLINE    1
  271. #define P_BOLD            2
  272. #define P_COMPRESS    4
  273. #define P_NORMAL        8
  274.  
  275. /* 
  276.  * Some keyboard ascii/scan values 
  277.  */
  278. #define   BACK_SPACE   0x0e08
  279. #define   TAB          0x0f09
  280. #define   ESC          0x011B
  281. #define   ENTER        0x1c0d
  282. #define   SPACE_SCAN   0x3920
  283. #define   HOME         0x4700
  284. #define   END          0x4F00
  285. #define   PGUP         0x4900
  286. #define   PGDN         0x5100
  287. #define   UP           0x4800
  288. #define   DOWN         0x5000
  289. #define   RIGHT        0x4D00
  290. #define   LEFT         0x4B00
  291. #define   SHIFT_TAB    0x0F00
  292. #define   SHIFT_UP     0x4838
  293. #define   SHIFT_DOWN   0x5032
  294. #define   SHIFT_RIGHT  0x4d36
  295. #define   SHIFT_LEFT   0x4b34
  296. #define   INS          0x5200
  297. #define   DEL          0x5300
  298. #define   CTRL_HOME    0x7700
  299. #define   CTRL_END     0x7500
  300. #define   CTRL_PGUP    0x8400
  301. #define   CTRL_PGDN    0x7600
  302. #define   CTRL_RIGHT   0x7400
  303. #define   CTRL_LEFT    0x7300
  304. #define   ALT_1        0x7800
  305. #define   ALT_2        0x7900
  306. #define   ALT_3        0x7A00
  307. #define   ALT_4        0x7B00
  308. #define   ALT_5        0x7C00
  309. #define   ALT_6        0x7D00
  310. #define   ALT_7        0x7E00
  311. #define   ALT_8        0x7F00
  312. #define   ALT_9        0x8000
  313. #define   ALT_0        0x8100
  314. #define   ALT_MINUS    0x8200
  315. #define   ALT_EQUAL    0x8300
  316. #define   ALT_Q        0x1000
  317. #define   ALT_W        0x1100
  318. #define   ALT_E        0x1200
  319. #define   ALT_R        0x1300
  320. #define   ALT_T        0x1400
  321. #define   ALT_Y        0x1500
  322. #define   ALT_U        0x1600
  323. #define   ALT_I        0x1700
  324. #define   ALT_M        0x3200
  325. #define   ALT_O        0x1800
  326. #define   ALT_P        0x1900
  327. #define   ALT_A        0x1E00
  328. #define   ALT_S        0x1F00
  329. #define   ALT_D        0x2000
  330. #define   ALT_F        0x2100
  331. #define   ALT_G        0x2200
  332. #define   ALT_H        0x2300
  333. #define   ALT_J        0x2400
  334. #define   ALT_K        0x2500
  335. #define   ALT_L        0x2600
  336. #define   ALT_Z        0x2C00
  337. #define   ALT_X        0x2D00
  338. #define   ALT_C        0x2E00
  339. #define   ALT_V        0x2F00
  340. #define   ALT_B        0x3000
  341. #define   ALT_N        0x3100
  342. #define   ALT_M        0x3200
  343. #define   F1           0x3B00
  344. #define   F2           0x3C00
  345. #define   F3           0x3D00
  346. #define   F4           0x3E00
  347. #define   F5           0x3F00
  348. #define   F6           0x4000
  349. #define   F7           0x4100
  350. #define   F8           0x4200
  351. #define   F9           0x4300
  352. #define   F10          0x4400
  353. #define   CTRL_F1      0x5E00
  354. #define   CTRL_F2      0x5F00
  355. #define   CTRL_F3      0x6000
  356. #define   CTRL_F4      0x6100
  357. #define   CTRL_F5      0x6200
  358. #define   CTRL_F6      0x6300
  359. #define   CTRL_F7      0x6400
  360. #define   CTRL_F8      0x6500
  361. #define   CTRL_F9      0x6600
  362. #define   CTRL_F10     0x6700
  363. #define   CTRL_A       0x1e01
  364. #define   CTRL_B       0x3002
  365. #define   CTRL_C       0x2e03
  366. #define   CTRL_D       0x2004
  367. #define   CTRL_I       0x1709
  368. #define   CTRL_L       0x260c
  369. #define   CTRL_R       0x1312
  370. #define   CTRL_U       0x1615
  371. #define   CTRL_X       0x2d18
  372. #define   CTRL_Y       0x1519
  373. #define   CTRL_Z       0x2c1a
  374. #define   SHIFT_F1     0x5400
  375. #define   SHIFT_F2     0x5500
  376. #define   SHIFT_F3     0x5600
  377. #define   SHIFT_F4     0x5700
  378. #define   SHIFT_F5     0x5800
  379. #define   SHIFT_F6     0x5900
  380. #define   SHIFT_F7     0x5A00
  381. #define   SHIFT_F8     0x5B00
  382. #define   SHIFT_F9     0x5C00
  383. #define   SHIFT_F10    0x5D00
  384. #define   ALT_F1       0x6800
  385. #define   ALT_F2       0x6900
  386. #define   ALT_F3       0x6A00
  387. #define   ALT_F4       0x6B00
  388. #define   ALT_F5       0x6C00
  389. #define   ALT_F6       0x6D00
  390. #define   ALT_F7       0x6E00
  391. #define   ALT_F8       0x6F00
  392. #define   ALT_F9       0x7000
  393. #define   ALT_F10      0x7100
  394.  
  395. #endif    /* ndef lvswin_h */
  396.