home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / PROGRAMM / CPPMOUSE.ZIP / MOUSE.HPP < prev   
Text File  |  1990-12-01  |  3KB  |  86 lines

  1. /* Translated by Kevin Brooks from C routines written Ken Porter */
  2. /* December 11, 1990 */
  3.  
  4. #ifndef MOUSE_HPP
  5. #define MOUSE_HPP 1
  6.  
  7. #include <dos.h>
  8.  
  9. extern
  10. const int HARDWARE;                                /* cursor types */
  11. extern
  12. const int SOFTWARE;
  13.  
  14. enum Button {Left, Right};
  15.  
  16. /* STRUCTURES USED BY THESE FUNCTIONS */
  17. class resetRec {
  18. public:
  19.   resetRec() {}
  20.   resetRec(int _exists, int _nButtons) {
  21.      exists = _exists; nButtons = _nButtons; }
  22.  
  23.   int exists,                             /* TRUE if mouse is present */
  24.       nButtons;                           /* # of buttons on mouse */
  25. };                                      /* returned by mReset */
  26.  
  27. class locRec {
  28. public:
  29.   locRec() {}
  30.   locRec(int _buttonStatus, int _opCount, int _column, int _row) {
  31.      buttonStatus = _buttonStatus; opCount = _opCount; 
  32.      column = _column; row= _row; }
  33.  
  34.   int buttonStatus,       /* bits 0-2 on if corresp button is down */
  35.       opCount,                  /* # times button has been clicked */
  36.       column, row;                                     /* position */
  37. };                        /* returned by mPos, mPressed, mReleased */
  38.  
  39. class moveRec {
  40. public:
  41.   moveRec() {}
  42.   moveRec(int _hCount, int _vCount) {
  43.      hCount = _hCount; vCount = _vCount; }
  44.  
  45.   int hCount,                           /* net horizontal movement */
  46.   vCount;                               /* net vertical movement */
  47. };                                      /* returned by mMotion */
  48.  
  49. class Mouse : public resetRec, locRec, moveRec {
  50. private:
  51.    union REGS  inreg, 
  52.              outreg;
  53.  
  54. protected:
  55. /* Define int for mouse device driver */
  56.    inline void callMDD() { int86(0x33, &inreg, &outreg); }
  57.  
  58. /* Define sorting macros used locally */
  59.    inline int lower (int x, int y) const { return (x < y) ? x : y; }
  60.    inline int upper (int x, int y) const { return (x > y) ? x : y; }
  61.  
  62. public:
  63.    Mouse() {}
  64.    ~Mouse() {}
  65.     
  66.    resetRec& Reset();
  67.    void Show();
  68.    void Hide();
  69.    locRec& Pos();
  70.    void  Moveto(int newCol, int newRow);
  71.    locRec& Pressed(Button button);           
  72.    locRec& Released(Button button);
  73.    void SetColRange(int hmin, int hmax);
  74.    void SetRowRange(int vmin, int vmax);
  75.    void GraphCursor(int hHot, int vHot, unsigned maskSeg,
  76.                     unsigned maskOfs);
  77.    void TextCursor(int curstype, unsigned arg1, unsigned arg2);
  78.    moveRec& Motion();
  79.    void InstTask(unsigned mask, unsigned taskSeg, unsigned taskOfs);
  80.    void LpenOn();
  81.    void LpenOff();
  82.    void Ratio(int horiz, int vert);
  83. };
  84.  
  85. #endif // MOUSE_HPP
  86.