| Allegro CL version 6.2 Unrevised from 6.1 |
This is the class of all dialog-items that are implemented from
scratch in Common Graphics, rather than utilizing controls that are
supplied by the operating system. Common Graphics exports several such
widgets, namely the outline
, dropping-outline
,
grid-widget
, multi-picture-button
, drawable
, and group-box
widgets.
Applications may also write their own lisp-widgets. The basic procedure for defining a custom lisp-widget consists of the following:
lisp-widget
for the dialog-item
itself.
lisp-widget-window
and lisp-widget-top-window
,
to serve as the actual window that appears on the screen for the
dialog-item. The precedence order of the two superclasses does not
matter.
lisp-widget-window
subclass, which
gets called automatically whenever an instance of the lisp-widget
subclass is placed onto a parent window. This method should call
open-lisp-widget-window on the
stream object that is passed to device-open; this will create the actual
window on the screen that is represented by the lisp-widget-window
object. The
device-open method should
also do any needed initial setup of the widget, such as processing the
the initargs that were passed to make-instance to create the
dialog-item instance.
lisp-widget-window
subclass, to
draw the widget whenever it is uncovered or its value changes.
lisp-widget-window
subclass. This
method should call invalidate on the lisp-widget-window
,
which causes its redisplay-window method to be
called.
lisp-widget-window
subclass for
such generic functions as mouse-left-down, mouse-moved, or virtual-key-down. These methods
will typically determine a new value for the widget and call (setf value)
to update the widget according to the user gesture.
lisp-widget-window
subclasses for
any child windows that the widget may have. (Widgets usually do not
have child windows.) These classes should NOT also be subclasses of
lisp-widget-top-window
. The device-open method should also
create the needed child window instances, but by calling make-window rather than
calling open-lisp-widget-window. The name
of the lisp-widget-window
subclass should
be passed as the :class argument to make-window.
lisp-widget-window
subclass that
either draws or erases an indication that the widget currently has the
keyboard focus. These methods are called automatically as the widget
gains and loses the keyboard focus. If the widget does not need to
visually indicate when it has the focus, then these methods are not
needed.
Details of the above procedure may be found in the source code for the Navigator examples called "Custom Widgets: implementing in lisp" and "Circle Widget: a simpler lisp widget". Navigator examples are displayed by the Help menu | CG Examples menu command.
Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page was not revised from the 6.1 page.
Created 2002.2.26.
| Allegro CL version 6.2 Unrevised from 6.1 |