Class cursor
provides access to the cursors of the system and allows the user to
define new cursors from an image. The predefined cursors are the
standard (SDL system) cursors and the names that are kept for
compatibility with the X11 cursor font, which map to a standard cursor.
@cursor_names
lists them; cursor<-kind
tells which is which.
Cursors are assigned at the level of graphicals. Given some position
of the pointer, the displayed cursor is determined to be first graphical
that will receive pointer-events from this position and that has a
graphical<->cursor
attribute not equal to @nil
or @default.
Normally, this is a graphical that overlaps with the pointer position
and is exposed (i.e. above the other
graphicals). When the event-focus is set for some device, the cursor is
set to the cursor attribute of the graphical in focus, provided it's
value is a cursor (and not @default
or
@nil).
Like fonts and colours, cursors are reusable objects and are
automatically shared. If the cursor<-name
of the cursor is @nil,
the cursor will not be shared and may be object->free’ed
just like any other object.
The type conversion conventions will automatically transform the name of a predefined cursor to a cursor object.
<-kind
defines the cursor.standard for a cursor of the
system, x11 for a name kept for compatibility with the X11
cursor font (it maps to a standard cursor) and image for a
cursor defined from an image.When @nil,
the name does not appear in @cursors.
The cursor is not reusable and may be destroyed using object->free.
send(DebugIcon, cursor, not_allowed).
In its second form it allows the user the define a cursor. Such a cursor consists of:
cursor <-nameName for reference (see cursor <-lookup).cursor <-imageImage object describing the image. cursor <-hot_spotPosition of the pointer in the image. cursor <-foregroundColour for the _1_-s in cursor <-imagecursor <-backgroundColour for the _0_-s in cursor <-image
cursor<-image must
be specified. cursor<-hot_spot
defaults to ‘image
cursor<-hot_spot’,
or otherwise to point(0,0). Both colours default to the
fore- and background colours of the display on which the cursor is
opened and often need not be specified.
If the cursor has a cursor<-name,
it is locked using object->protect.
Otherwise the livetime of the cursor
object follows the normal rules.