home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / include / xcursor.h < prev    next >
C/C++ Source or Header  |  1997-11-18  |  2KB  |  47 lines

  1. #ifndef __XCURSOR_H__
  2. #define __XCURSOR_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------------- r 1.0 */
  6. /*===========================================================================*/
  7. /*                              class: XCursor                               */
  8. /*                       derived from: XObject                               */
  9. /*                        last update: 11/97                                 */
  10. /*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
  11. /*===========================================================================*/
  12.  
  13. #include "xwindow.h"
  14.  
  15. class XCursor: public XObject
  16. {
  17.       XWindow * owner;
  18.       char vis;
  19.    public:
  20.       XCursor( const XFrameWindow * w, const XPoint &p, const XSize& s = XSize(), const LONG type = CURSOR_SOLID|CURSOR_FLASH)
  21.       {
  22.          owner = (XWindow*) w;
  23.          vis = 0;
  24.          if( WinCreateCursor( owner->GetHandle(), p.GetX(), p.GetY(), s.GetWidth(), s.GetHeight(), type, NULL) == FALSE )
  25.             OOLThrow( "couldnt create cursor", -1);
  26.       }
  27.       ~XCursor()
  28.       {
  29.          Show(FALSE);
  30.          WinDestroyCursor( owner->GetHandle());
  31.       }
  32.       void SetPosition( const XPoint& p)
  33.       {
  34.          WinCreateCursor( owner->GetHandle(), p.GetX(), p.GetY(), 0, 0, CURSOR_SETPOS, NULL);
  35.       }
  36.       void SetPosition( const LONG x, const LONG y)
  37.       {
  38.          WinCreateCursor( owner->GetHandle(), x, y, 0, 0, CURSOR_SETPOS, NULL);
  39.       }
  40.       void Show( const BOOL s = TRUE)
  41.       {
  42.          WinShowCursor( owner->GetHandle(), s);
  43.       }
  44. };
  45.  
  46. #endif
  47.