home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / SVGALIB / _SVGALIB.TAR / usr / include / vgamouse.h < prev   
Encoding:
C/C++ Source or Header  |  1995-01-18  |  2.7 KB  |  85 lines

  1. /* Mouse interface for svgalib. */
  2. /* Can be used independently. */
  3.  
  4. #ifndef MOUSE_H
  5. #define MOUSE_H
  6.  
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10.  
  11. #define    MOUSE_MICROSOFT 0
  12. #define MOUSE_MOUSESYSTEMS 1
  13. #define MOUSE_MMSERIES 2
  14. #define MOUSE_LOGITECH 3
  15. #define MOUSE_BUSMOUSE 4
  16. #define MOUSE_PS2 5
  17.  
  18. /* Logical or the following values to one of the above at will and give that for
  19.    type in mouse_init (still they make only sense for serial mice) */
  20.  
  21. #define MOUSE_CHG_DTR    0x80000000    /* CLEAR (!) the DTR line */
  22. #define MOUSE_DTR_HIGH    0x40000000    /* when used with MOUSE_CHG_DTR set DTR not clear it */
  23. #define MOUSE_CHG_RTS    0x20000000    /* CLEAR (!) the RTS line */
  24. #define MOUSE_RTS_HIGH    0x10000000    /* when used with MOUSE_CHG_RTS set RTS not clear it */
  25.  
  26. /* If MOUSE_CHG_DTR is not given the DTR state is not touched.. same with RTS resp. */
  27. /* So I use MOUSE_MOUSESYSTEMS|MOUSE_CHG_RTS to force my
  28.    multiprotocol mouse to MOUSESYSTEMS and use init the driver to MOUSESYSTEMS */
  29.  
  30. #define MOUSE_TYPE_MASK 0xffff /* the upper 16bit are reserved for future flags */
  31.  
  32. #define MOUSE_LEFTBUTTON 4
  33. #define MOUSE_MIDDLEBUTTON 2
  34. #define MOUSE_RIGHTBUTTON 1
  35.  
  36. #define MOUSE_DEFAULTSAMPLERATE 150
  37.  
  38. /* Initialize mouse device. Returns 0 if succesful, -1 otherwise. */
  39. /* (Get the svgalib configured type with vga_getmousetype()). */
  40. int mouse_init( char *dev, int type, int samplerate );
  41. /* Similar but returns the mouse fd if succesful. */
  42. int mouse_init_return_fd( char *dev, int type, int samplerate );
  43. /* Set event handler invoked by mouse_update(). */
  44. void mouse_seteventhandler( void (*handler)( int button, int dx, int dy ) );
  45. /* Close mouse device. */
  46. void mouse_close();
  47. /* Read mouse and handle events. Returns 0 if no event. */
  48. int mouse_update();
  49. /* Similar to mouse_update, but wait for an event to happen. */
  50. void mouse_waitforupdate();
  51.  
  52. /* mouse_init sets default event handler that keeps track of absolute */
  53. /* coordinates: */
  54.  
  55. #define MOUSE_NOWRAP 0
  56. #define MOUSE_WRAPX 1
  57. #define MOUSE_WRAPY 2
  58. #define MOUSE_WRAP 3
  59.  
  60. /* Revert to default handler. */
  61. void mouse_setdefaulteventhandler();
  62. /* Set position of mouse. */
  63. void mouse_setposition( int x, int y );
  64. /* Set horizontal range of mouse to [x1, x2] incl. */
  65. void mouse_setxrange( int x1, int x2 );
  66. /* Set vertical range of mouse to [y1, y2] incl. */
  67. void mouse_setyrange( int y1, int y2 );
  68. /* Set scale factor by which raw mouse coordinates are divided. */
  69. void mouse_setscale( int s );
  70. /* Enable/disable wrapping of mouse in horizontal and/or vertical range. */
  71. void mouse_setwrap( int w );
  72.  
  73. /* Get current mouse x-coordinate. */
  74. int mouse_getx();
  75. /* Get current mouse y-coordinate. */
  76. int mouse_gety();
  77. /* Get current mouse button status. */
  78. int mouse_getbutton();
  79.  
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83.  
  84. #endif
  85.