home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / ranish / SOURCES.ZIP / CONIO.H < prev    next >
C/C++ Source or Header  |  1998-01-12  |  3KB  |  130 lines

  1. #ifndef _CONIO_H
  2. #define _CONIO_H
  3.  
  4. #define  Border11f  "┌─┐│ │└─┘"     /* The middle character will be  */
  5. #define  Border12f  "╒═╕│ │╘═╛"     /* used to fill the window space */
  6. #define  Border22f  "╔═╗║ ║╚═╝"
  7. #define  Border21if "╟─╢║ ║╚═╝"
  8.  
  9. #define  Border11e  "┌─┐│\0│└─┘"    /* if it is '\0' window will not */
  10. #define  Border12e  "╒═╕│\0│╘═╛"    /* be filled and left as it is.  */
  11. #define  Border22e  "╔═╗║\0║╚═╝"
  12.  
  13.  
  14. #define  Black      0x00                        /* Foreground colors */
  15. #define  Blue       0x01
  16. #define  Green      0x02
  17. #define  Cyan       0x03
  18. #define  Red        0x04
  19. #define  Magenta    0x05
  20. #define  Brown      0x06
  21. #define  White      0x07
  22.             
  23. #define  Gray       0x08
  24. #define  BrBlue     0x09
  25. #define  BrGreen    0x0A
  26. #define  BrCyan     0x0B
  27. #define  BrRed      0x0C
  28. #define  BrMagenta  0x0D
  29. #define  Yellow     0x0E
  30. #define  BrWhite    0x0F
  31.  
  32.  
  33. #define  BakBlack      0x00                     /* Background colors */
  34. #define  BakBlue       0x10
  35. #define  BakGreen      0x20
  36. #define  BakCyan       0x30
  37. #define  BakRed        0x40
  38. #define  BakMagenta    0x50
  39. #define  BakBrown      0x60
  40. #define  BakWhite      0x70
  41.  
  42. #define  Blink         0x80
  43.  
  44.  
  45. #define EV_KEY         1
  46. #define EV_SHIFT     2
  47. #define EV_MOUSE     4
  48. #define EV_TIMER     8
  49.  
  50. #define EV_NONBLOCK    16
  51.  
  52. #define CONIO_TICKS_PER_SEC     18.2
  53. #define CONIO_TIMER(seconds)  ((seconds)*18.2)
  54.  
  55. struct event
  56.     {
  57.      unsigned int ev_type;   /* Type of returned event */
  58.      
  59.      unsigned int key;       /* Ascii Code of a key */
  60.      unsigned int scan;      /* Scan & Ascii Codes of a key  */
  61.      unsigned int shift;     /* Status of Shift keys */
  62.      unsigned int shiftX;    /* Only those flags are set which was changed */
  63.      
  64.      unsigned int x,y;       /* Mouse position */
  65.      unsigned int left;
  66.      unsigned int right;     /* 1 - if button pressed, 0 - if not */
  67.      unsigned int middle;
  68.      
  69.      long timer;   /* number of ticks to wait, if EV_TIMER was set */
  70.     };
  71.  
  72.  
  73. extern unsigned char const ScreenWidth;
  74. extern unsigned char const ScreenHeight;
  75. extern unsigned int const MouseInstalled;
  76.  
  77.  
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81.  
  82. void conio_init( void );
  83. void conio_exit( void );
  84.  
  85. void show_mouse( void );
  86. void hide_mouse( void );
  87. void move_mouse( int x, int y );
  88.  
  89. void move_cursor( int x, int y );
  90. void cursor_size( int top, int bottom );
  91.  
  92. void get_event( struct event *ev, int flags );
  93.  
  94. void write_char( int attr, int x, int y, int ch );
  95. void write_string( int attr, int x, int y, char *str );
  96.  
  97. void save_window( int x, int y, int w, int h, char *buf );
  98. void load_window( int x, int y, int w, int h, char *buf );
  99.  
  100. void clear_window(  int attr, int x, int y, int w, int h );
  101. void scroll_window( int attr, int x, int y, int w, int h, int len );
  102. void border_window( int attr, int x, int y, int w, int h, char *border );
  103.  
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107.  
  108.  
  109. #define SK_R_SHIFT    0x01
  110. #define SK_L_SHIFT    0x02
  111. #define SK_SHIFT    0x03
  112. #define SK_CTRL        0x04
  113. #define SK_ALT        0x08
  114. #define SK_SCROLL_LOCKED 0x10
  115. #define SK_NUM_LOCKED    0x20
  116. #define SK_CAPS_LOCKED    0x40
  117. #define SK_INSERT    0x80
  118.  
  119. #define SK_L_CTRL    0x0100
  120. #define SK_L_ALT    0x0200
  121. #define SK_R_CTRL    0x0400
  122. #define SK_R_ALT    0x0800
  123. #define SK_SCROLL_LOCK    0x1000
  124. #define SK_NUM_LOCK    0x2000
  125. #define SK_CAPS_LOCK    0x4000
  126. #define SK_SYS_REQ    0x8000
  127.  
  128.  
  129.  
  130. #endif