You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.3 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /**[txh]********************************************************************
  2. Copyright (c) 2001-2002 by Salvador E. Tropea
  3. Description:
  4. That's the DOS low level mouse class.
  5. It have more than one driver inside that is selected externally.
  6. 1) It can use a mouse callback or poll the mouse.
  7. 2) It can let the mouse driver draw the cursor or do it in the class.
  8. ***************************************************************************/
  9. #if defined(TVCompf_djgpp) && !defined(DOSMOUSE_HEADER_INCLUDED)
  10. #define DOSMOUSE_HEADER_INCLUDED
  11. class THWMouseDOS : public THWMouse
  12. {
  13. protected:
  14. THWMouseDOS() {};
  15. virtual ~THWMouseDOS();
  16. static void ShowDrv();
  17. static void HideDrv();
  18. static void ShowEmulate();
  19. static void HideEmulate();
  20. static void Suspend();
  21. static void Resume();
  22. static void GetEvent(MouseEventType &me);
  23. static void RegisterHandler(unsigned, void (*)());
  24. static void SetRange(ushort, ushort);
  25. static int DrawMouseDummy(int x, int y);
  26. static int DrawMouseEmulate(int x, int y);
  27. friend class TDisplayDOS;
  28. friend class TScreenDOS;
  29. // Specific for this driver:
  30. // Choose if the mouse will be emulated or the OS driver will draw it.
  31. // Must be called when mouse isn't visible.
  32. static void setEmulation(int emulate);
  33. // Sets the start of video memory (only needed for emulated mouse)
  34. static void setScreenBase(ulong base);
  35. // Functions used to draw the mouse in the driver
  36. static volatile void getMouseChar();
  37. static volatile void setMouseChar();
  38. static volatile void resetMouseChar();
  39. static volatile void showMouseChar();
  40. // Used to force a mouse draw by the driver when emulateMouse!=0
  41. //static volatile int drawMouse(int x, int y);
  42. // Low level functions to save/restore mouse state of the OS
  43. static void biosRestoreState();
  44. static void biosSaveState();
  45. // Low level functions to save/restore "my" mouse state
  46. static int biosRestoreMyState();
  47. static void biosSaveMyState();
  48. // Address of the start of video memory, use setScreenBase()
  49. static ulong screenBase;
  50. // Variables needded to draw the mouse pointer in the driver:
  51. static ushort mouseChar; // Character under pointer
  52. static int lastX,lastY; // Position of the saved mouseChar
  53. static int cols; // Screen width, set by setRange
  54. // Variables used to save/restore mouse state
  55. static int bufferSegment;
  56. static int bufferSelector;
  57. static int bufferSize;
  58. static int bufferAllocated;
  59. static int myBufferSegment;
  60. static int myBufferSelector;
  61. static int myBufferSize;
  62. static int myBufferAllocated;
  63. // !=0 if the mouse will be drawn by the driver, use setEmulation()
  64. static char emulateMouse;
  65. // Number of buttons, needed to restore it in resume
  66. static uchar myButtonCount;
  67. public:
  68. // Needed to initialize it.
  69. static void Init();
  70. static void DeInit();
  71. // Indicates if the initialization will install a Real Mode Callback to
  72. // hook the mouse. That's enabled by default when the OS isn't Win NT.
  73. // Set it to 0 before initialization to avoid hooking the mouse.
  74. static char useMouseHandler;
  75. // This structure hold the mouse event generated by a mouse callback.
  76. static MouseEventType intEvent;
  77. // Nasty hack used by TEventQueue to read the interrupt information and
  78. // draw the mouse pointer
  79. static int getRMCB_InfoDraw(int &buttonPress);
  80. };
  81. #endif // DOSMOUSE_HEADER_INCLUDED