3.2 Mouse cursor objects
(setq *mouse-bitmap* (make-bitmap :height (min 15 maximum-cursor-height) :width (min 15 maximum-cursor-width) :depth 1))Next, use the function
(draw-line *mouse-bitmap* (make-position 0 0) (make-position maximum-cursor-width maximum-cursor-height) :width 2)
(draw-circle *mouse-bitmap* (make-position (/ maximum-cursor-width 2) (/ maximum-cursor-height 2)) 5 :width 2)
make-mouse-cursorto make a mouse cursor object whose image is the new cursor's bitmap:
(setq *mouse-cursor* (make-mouse-cursor *mouse-bitmap*))The function
current-mouse-cursorreturns the current mouse cursor object. In the next example the current mouse cursor is saved and then changed to the new mouse cursor.
(setf *old-mouse-cursor* (current-mouse-cursor)) (setf (current-mouse-cursor) *mouse-cursor*)Move the mouse cursor onto the root viewport. You see that the mouse cursor object appears as a line drawn through a circle, which is the design you drew on
To restore the original appearance of the mouse cursor, bind the current mouse cursor to the value of
(setf (current-mouse-cursor) *old-mouse-cursor*)The mouse cursor's hot spot is the exact location that the mouse is pointing to at any moment. To specify the mouse cursor's hot spot when invoking the function
make-mouse-cursor, use the keyword arguments
:y-offset; the value of these arguments is 0 by default.
Generated with Harlequin WebMaker