home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / rehack / text / mouse.txt < prev    next >
Encoding:
Text File  |  1993-06-26  |  4.6 KB  |  124 lines

  1. File:            MOUSE.TXT
  2. Path:            ...\REHACK\TEXT\MOUSE.TXT
  3. Version:        0.01
  4. Author:            Pat Reilly
  5. CIS Id:            71333,2764
  6. Created On:        6/26/93
  7. Modified On:
  8. Description:    Documentation on classes in MOUSE.HPP.
  9. Tabs:            4
  10.  
  11.     The Mouse class in MOUSE.HPP and MOUSE.CPP were mainly developed so
  12. that I could test the window classes and the event classes. I'll document
  13. it here in case we want to use some/most/all of it.
  14.  
  15.     MOUSE.CPP was written for Borland's BC++. I don't think it will compile
  16. under MSC++ without a lot of modification. It uses Borland's register
  17. macros (_AX, _BX, etc) and the asm directive (asm int 0x33;).
  18.  
  19.     The Mouse class is designed to work with the REHACK Event, EventQueue
  20. and Game classes (see EVENT.TXT, EVENTQ.TXT and GAME.TXT respectively). It
  21. has the normal gamut of mouse class functions, and installs a user function
  22. to the driver which gets called whenever the mouse moves or a button is
  23. depressed or released. Mouse supports the dblClicked member in the
  24. PosDeviceEvent class.
  25.     All the methods for Mouse are static. That means that if MOUSE.HPP is
  26. included in a module, then you can call the functions directly:
  27.         if(Mouse::isPresent()) ...
  28.  
  29. Methods
  30. =======
  31.  
  32.     ~Mouse()            virtual destructor
  33.         Calls remove() to remove the callback function.
  34.  
  35.     bool isPresent()    static
  36.         Returns true if the mouse driver is present, else false.
  37.  
  38.     bool install()        static
  39.         Installs the callback function and readies the mouse for use; returns
  40.         true if a mouse driver is present, else false (failed install).
  41.  
  42.     void remove()        static
  43.         Removes the callback function and clears the mouse driver (if the
  44.         mouse driver is installed).
  45.  
  46.     void setBounds(const Rect& rect)    static
  47.         Sets the bounding rect for the mouse (if installed). Note that this
  48.         can be misleading; even in 320x200 mode, my Logitech wanted a rect
  49.         width of 640 (instead of 320).
  50.  
  51.     void show()            static
  52.         If installed, calls the mouse driver's show function. Note that
  53.         mouse driver's use an incremental hide(), so this function won't
  54.         necessarily make the mouse visible; it 'pops' one hide() call from
  55.         the driver. So if you call hide() twice and then call show(), the
  56.         mouse cursor will not be displayed; you have to call show() again.
  57.  
  58.     void hide()            static
  59.         If installed, calls the mouse driver's hide function. See show().
  60.  
  61.     void moveTo(const Point& pt)    static
  62.         Moves the mouse cursor to pt's location, or the nearest point to it
  63.         that's in the bounding rectangle for the mouse (see setBounds). Note
  64.         that some older mouse drivers also will call hide() when this
  65.         function is called, but newer ones won't.
  66.  
  67.     void setCursor(const Point& hotSpot, void* buffer)
  68.         Changes the mouse cursor to the masks in buffer, with a hotspot at
  69.         hotSpot.
  70.  
  71.     void setDblClickInterval(word w)    static
  72.         Changes the interval used to determine if a double-click has occured.
  73.         This value is in system time ticks (18.2 per second). The default
  74.         value is 8, which is just short of 1/2 second.
  75.  
  76.     void getStatus(PosDeviceEvent& pd)    static
  77.         Sets pd to the current mouse values. See EVENT.TXT for more info on
  78.         the PosDeviceEvent class.
  79.  
  80.     void huge callbackFunction()    static protected
  81.         This is the function called by the mouse driver when a mouse change
  82.         occurs. It builds an appropriate Event and calls Game::eventQueue to
  83.         insert the event. The huge modifier is required so that the #pragma
  84.         saveregs can be used to ensure that the registers aren't modified.
  85.  
  86.     bool checkFor()        static protected
  87.         Used internally to check the driver status.
  88.  
  89. Members
  90. =======
  91.  
  92.     bool checked        static protected
  93.         true if the class has already checked for driver presence. Since a
  94.         presence test requires a call which resets the mouse, we only want
  95.         to perform this once.
  96.  
  97.     bool present        static protected
  98.         true if a mouse driver is present, else false.
  99.  
  100.     bool installed        static protected
  101.         true if callbackFunction() has been registered with the mouse driver.
  102.  
  103.     Event curEvent        static protected
  104.         Used by callbackFunction() to build the event which is passed to
  105.         the event queue.
  106.  
  107.     word dblClickInterval    static protected
  108.         The maximum number of time ticks (18.2 per second) between depresses
  109.         of a mouse button for it to be considered a double-click. Default
  110.         value is 8 (a little less than 1/2 second).
  111.  
  112.     dword lastLBDown    static protected
  113.         The value of the system time counter for the last occurance of a
  114.         left button depress.
  115.  
  116.     dword lastRBDown    static protected
  117.         The value of the system time counter for the last occurance of a
  118.         right button depress.
  119.  
  120.     dword lastCBDown    static protected
  121.         The value of the system time counter for the last occurance of a
  122.         center button depress.
  123.  
  124.