Gadgets are panes that implement such common toolkit components as push buttons or scroll bars. Each gadget class has a set of associated generic functions that serve the same role that callbacks serve in traditional toolkits. (A callback is a function that informs an application that one of its gadgets has been used.) For example, a push button has an "activate" callback function that is invoked when its button is "pressed;" a scroll bar has a "value changed" callback that is invoked after its indicator has been moved.
The gadget definitions specified by CLIM are abstract; that is, the gadget definition does not specify the exact user interface of the gadget, but only specifies the semantics that the gadget should provide. For instance, it is not defined whether the user clicks on a push button with the mouse, or moves the mouse over the button and then presses some key on the keyboard to invoke the "activate" callback. Each toolkit implementation will specify the look and feel of their gadgets. Typically, the look and feel will be derived directly from the underlying toolkit.
Each of CLIM's abstract gadgets has at least one standard implementation that is written using the facilities provided solely by CLIM itself. The gadgets' appearances are achieved via calls to the CLIM graphics functions, and their interactive behavior is defined in terms of the CLIM input event processing mechanism. Since these gadget implementations are written entirely in terms of CLIM, they are portable across all supported CLIM host window systems. Furthermore, since the specific look and feel of each such gadget is "fixed" in CLIM Lisp code, the gadget implementation will look and behave the same in all environments.
The push button and slider gadgets alluded to previously are abstract gadgets. The callback interface to all of the various implementations of the gadget is defined by the abstract class. In the :panes
clause of define-application-frame, the abbreviation for a gadget is the name of the abstract gadget class.
At pane creation time (that is, make-pane), the frame manager resolves the abstract class into a specific implementation class; the implementation classes specify the detailed look and feel of the gadget. Each frame manager will keep a mapping from abstract gadgets to an implementation class; if the frame manager does not implement its own gadget for the abstract gadget classes in the following sections, it will use the portable class provided by CLIM. Since every implementation of an abstract gadget class is a subclass of the abstract class, they all share the same programmer interface.
Every gadget has a client that is specified when the gadget is created. The client is notified via the callback mechanism when any important user interaction takes place. Typically, a gadget's client will be an application frame or a composite pane. Each callback generic function is invoked on the gadget, its client, the gadget id, and other arguments that vary depending on the callback.
For example, the argument list for activate-callback looks like (gadget client gadget-id). Assuming the programmer has defined an application frame called button-test
that has a CLIM stream pane in the slot output-pane, she could write the following method:
(defmethod activate-callback ((button push-button) (client button-test) gadget-id) (with-slots (output-pane) client (format output-pane "The button ~S was pressed, client ~S, id ~S." button client gadget-id)))
One problem with this example is that it differentiates on the class of the gadget, not on the particular gadget instance. That is, the same method will run for every push button that has the button-test
frame as its client.
One way to distinguish between the various gadgets is via the gadget id, which is also specified when the gadget is created. The value of the gadget id is passed as the third argument to each callback generic function. In this case, if we have two buttons, we might install start
and stop
as the respective gadget ids and then use eql specializers on the gadget ids. We could then refine the previous method as:
(defmethod activate-callback ((button push-button) (client button-test) (gadget-id (eql 'start))) (start-test client)) (defmethod activate-callback ((button push-button) (client button-test) (gadget-id (eql 'stop))) (stop-test client)) ;; Create the start and stop push buttons (make-pane 'push-button :label "Start" :client frame :id 'start) (make-pane 'push-button :label "Stop" :client frame :id 'stop)
Another way to distinguish between gadgets is to specify explicitly what function should be called when the callback is invoked. This is done by supplying an appropriate initarg when the gadget is created. The previous example could then be written as follows:
;; No callback methods needed; just create the push buttons. (make-pane 'push-button :label "Start" :client frame :id 'start :activate-callback #'(lambda (gadget) (start-test (gadget-client gadget)))) (make-pane 'push-button :label "Stop" :client frame :id 'stop :activate-callback #'(lambda (gadget) (stop-test (gadget-client gadget))))
The following shows how a push button gadget might be implemented.
;; A PUSH-BUTTON uses the ACTIVATE-CALLBACK, and has a label. ;; This is the abstract class (defclass push-button (action-gadget labelled-gadget) ()) ;; Here is a concrete implementation of a PUSH-BUTTON. ;; The "null" frame manager create a pane of type PUSH-BUTTON-PANE when ;; asked to create a PUSH-BUTTON. (defclass push-button-pane (push-button leaf-pane space-requirement-mixin) ((show-as-default :initarg :show-as-default :accessor push-button-show-as-default) (armed :initform nil))) ;; General highlight-by-inverting method (defmethod highlight-button ((pane push-button-pane) medium) (with-bounding-rectangle* (left top right bottom) (sheet-region pane) (draw-rectangle* medium left top right bottom :ink +flipping-ink+ :filled t))) ;; Compute the amount of space required by a PUSH-BUTTON-PANE (defmethod compose-space ((pane push-button-pane) &key width height) (multiple-value-bind (width height) (compute-gadget-label-size pane) (make-space-requirement :width width :height height))) ;; This gets invoked to draw the push button. (defmethod repaint-sheet ((pane push-button-pane) region) (declare (ignore region)) (with-sheet-medium (medium pane) (let ((text (gadget-label pane)) (text-style (slot-value pane 'text-style)) (armed (slot-value pane 'armed)) (region (sheet-region pane))) (multiple-value-call #'draw-rectangle* medium (bounding-rectangle* (sheet-region pane)) :filled nil) (draw-textmedium text (clim-utils::bounding-rectangle-center region) :text-style text-style :align-x ':center :align-y ':top) (when (eql armed ':button-press) (highlight-button pane medium))))) ;; When we enter the push button's region, arm it. (defmethod handle-event ((pane push-button-pane) (event pointer-enter-event)) (with-slots (armed) pane (unless armed (setf armed t) (armed-callback pane (gadget-client pane) (gadget-id pane))))) ;; When we leave the push button's region, disarm it. (defmethod handle-event ((pane push-button-pane) (event pointer-exit-event)) (with-slots (armed) pane (when armed (when (eql armed ':button-press) (highlight-button pane medium)) (setf armed nil) (disarmed-callback pane (gadget-client pane) (gadget-id pane))))) ;; When the user presses a pointer button, ensure that the button ;; is armed, and highlight it. (defmethod handle-event ((pane push-button-pane) (event pointer-button-press-event)) (with-slots (armed) pane (unless armed (setf armed ':button-press) (armed-callback pane (gadget-client pane) (gadget-id pane)) (with-sheet-medium (medium pane) (highlight-button pane medium))))) ;; When the user releases the button and the button is still armed, ;; call the activate callback. (defmethod handle-event ((pane push-button-pane) (event pointer-button-release-event)) (with-slots (armed) pane (when (eql armed ':button-press) (activate-callback pane (gadget-client pane) (gadget-id pane)) (setf armed t) (with-sheet-medium (medium pane) (highlight-button pane medium)))))
The following are the basic gadget classes upon which all abstract gadgets are built.
Summary: The protocol class that corresponds to a gadget, a subclass of pane. If you want to create a new class that behaves like a gadget, it should be a subclass of gadget
. Subclasses of gadget
must obey the gadget protocol.
All of the subclasses of gadget
are mutable.
gadgetp object
Summary: Returns t
if object is a gadget; otherwise. it returns nil
.
Summary: The base class on which all CLIM gadget classes are built.
:id
:client
:armed-callback
:disarmed-callback Initargs
Summary: All subclasses of gadget must handle these four initargs, which are used to specify, respectively, the gadget id, client, armed callback, and disarmed callback of the gadget.
gadget-id gadget
(setf gadget-id) Generic Function
(setf gadget-id) id gadget
Summary: Returns (or sets) the gadget id of the gadget gadget. The id is typically a simple Lisp object that uniquely identifies the gadget.
gadget-client Generic Function
gadget-client gadget
(setf gadget-client) Generic Function
(setf gadget-client) client gadget
Summary: Returns the client of the gadget gadget. The client is usually an application frame, but it could be another gadget (for example, a push button contained in a radio box).
gadget-armed-callback Generic Function
gadget-armed-callback gadget
gadget-disarmed-callback Generic Function
gadget-disarmed-callback gadget
Summary: Returns the functions that will be called when the armed or disarmed callback, respectively, are invoked. These functions will be invoked with a single argument, the gadget.
When these functions return nil
, there is no armed (or disarmed) callback for the gadget.
armed-callback gadget client gadget-id
disarmed-callback gadget client gadget-id
Summary: These callbacks are invoked when the gadget gadget is, respectively, armed or disarmed. The exact definition of arming and disarming varies from gadget to gadget, but typically a gadget becomes armed when the pointer is moved into its region, and disarmed when the pointer moves out of its region.
The default methods (on basic-gadget) call the function stored in gadget-armed-callback or gadget-disarmed-callback with one argument, the gadget.
activate-gadget Generic Function
activate-gadget gadget
Summary: Causes the host gadget to become active, that is, available for input.
deactivate-gadget Generic Function
deactivate-gadget gadget
Summary: Causes the host gadget to become inactive, that is, unavailable for input. In some environments this may cause the gadget to become grayed over; in others, no visual effect may be detected.
gadget-active-p Generic Function
gadget-active-p gadget
Summary: Returns t
if gadget is active, that is, has been activated with activate-gadget.
note-gadget-activated Generic Function
note-gadget-activated client gadget
Summary: This function is invoked after a gadget is made active.
note-gadget-deactivated Generic Function
note-gadget-deactivated client gadget
Summary: This function is invoked after a gadget is made inactive.
Summary: The class used by gadgets that have a value; a subclass of basic-gadget.
:value
:value-changed-callback Initargs
Summary: All subclasses of value-gadget must handle these two initargs, which specify, respectively, the initial value and the value changed callback of the gadget.
gadget-value value-gadget
Summary: Returns the value of the gadget value-gadget. The interpretation of the value varies from gadget to gadget. For example, a scroll bar's value might be a number between 0 and 1, while a toggle button's value is either t
or nil
. (The documentation of each individual gadget specifies how to interpret the value.)
(setf gadget-value) Generic Function
(setf gadget-value) value value-gadget &key invoke-callback
Summary: Sets the gadget's value to the specified value. In addition, if invoke-callback is t
(the default is nil
), the value-changed callback for the gadget is invoked. The syntax for using (setf gadget-value)
is:
(setf (gadget-value gadget :invoke-callback t) new-value)
gadget-value-changed-callback Generic Function
gadget-value-changed-callback value-gadget
Summary: Returns the function that will be called when the value changed callback is invoked. This function will be invoked with two arguments, the gadget and the new value.
When this function returns nil
, there is no value-changed callback for the gadget.
value-changed-callback Callback
value-changed-callback value-gadget client gadget-id value
Summary: This callback is invoked whenever the value of a gadget is changed.
The default method (on value-gadget) calls the function stored in gadget-value-changed-callback with two arguments, the gadget and the new value.
CLIM implements or inherits a method for value-changed-callback
for every gadget that is a subclass of value-gadget.
Summary: The class used by gadgets that perform some kind of action, such as a push button; a subclass of basic-gadget.
Summary: All subclasses of action-gadget must handle this initarg, which specifies the activate callback of the gadget.
gadget-activate-callback Generic Function
gadget-activate-callback action-gadget
Summary: Returns the function that will be called when the gadget is activated. This function will be invoked with one argument, the gadget.
When this function returns nil
, there is no value-activate callback for the gadget.
activate-callback action-gadget client gadget-id
Summary: This callback is invoked when the gadget is activated.
The default method (on action-gadget) calls the function stored in gadget-activate-callback with one argument, the gadget.
CLIM implements or inherits a method for activate-callback
for every gadget that is a subclass of action-gadget.
Summary: The class that is mixed into a gadget that has an orientation associated with it, for example, a slider. This class is not intended to be instantiated.
Summary: All subclasses of oriented-gadget-mixin must handle this initarg, which is used to specify the orientation of the gadget. The value is either :horizontal
or :vertical
.
gadget-orientation Generic Function
gadget-orientation oriented-gadget
Summary: Returns the orientation of the gadget oriented-gadget. Typically, this will be a keyword such as :horizontal
or :vertical
.
Summary: The class that is mixed into a gadget that has a label, for example, a push button. This class is not intended to be instantiated.
:label
:align-x
:align-y Initargs
Summary: All subclasses of labelled-gadget-mixin must handle these initargs, which are used to specify the label and its x and y alignment. Labelled gadgets will also have a text style for the label, but this is managed by the usual text-style mechanism for panes.
gadget-label labelled-gadget
(setf gadget-label) Generic Function
(setf gadget-label) label labelled-gadget
Summary: Returns (or sets) the label of the gadget labelled-gadget. The label must be a string. Changing the label of a gadget may result in invoking the layout protocol on the gadget and its ancestor sheets.
gadget-label-align-x Generic Function
gadget-label-align-x labelled-gadget
(setf gadget-label-align-x) Generic Function
(setf gadget-label-align-x) alignment labelled-gadget
gadget-label-align-y Generic Function
gadget-label-align-y labelled-gadget
(setf gadget-label-align-y) Generic Function
(setf gadget-label-align-y) alignment labelled-gadget
Summary: Returns (or sets) the alignment of the label of the gadget labelled-gadget. Changing the alignment a gadget may result in invoking the layout protocol on the gadget and its ancestor sheets.
gadget-label-text-style Generic Function
gadget-label-text-style labelled-gadget
(setf gadget-label-text-style) Generic Function
(setf gadget-label-text-style) text-style labelled-gadget
Summary: Returns (or sets) the text style of the label of the gadget labelled-gadget. This must be a CLIM text style object. Changing the label text style of a gadget may result in invoking the layout protocol on the gadget and its ancestor sheets.
Summary: The class that is mixed into a gadget that has a range, for example, a slider.
:min-value
:max-value Initargs
Summary: All subclasses of range-gadget-mixin must handle these two initargs, which are used to specify the minimum and maximum value of the gadget.
gadget-min-value Generic Function
gadget-min-value range-gadget
(setf gadget-min-value) Generic Function
(setf gadget-min-value) min-value range-gadget
Summary: Returns (or sets) the minimum value of the gadget range-gadget, a real number.
gadget-max-value Generic Function
gadget-max-value range-gadget
(setf gadget-max-value) Generic Function
(setf gadget-max-value) max-value range-gadget
Summary: Returns (or sets) the maximum value of the gadget range-gadget, a real number.
gadget-range range-gadget
Summary: Returns the range of range-gadget, that is, the difference of the maximum value and the minimum value.
gadget-range* Generic Function
gadget-range* range-gadget
Summary: Returns the the minimum value and the maximum value of range-gadget as two values.
CLIM supplies a set of gadgets that have been designed to be compatible with a variety of user interface toolkits, including Xt widget-based toolkits (such as Motif), OpenLook, and the MacToolbox.
Each gadget maps to an implementation-specific object that is managed by the underlying toolkit. For example, when a CLIM program manipulates an object of class scroll-bar, the underlying implementation-specific object might be a Motif ScrollBar
widget. As events are processed on the underlying object, the corresponding generic operations are applied to the Lisp gadget.
Note that not all operations will necessarily be generated by particular toolkit implementations. For example, a user interface toolkit that is designed for a 3-button mouse may generate significantly more gadget events than one designed for a 1-button mouse.
labelling (&rest options &key label label-alignment &allow-other-keys) &body contents
Summary: Creates a pane that consists of the specified label, which is a string.
Valid options are :align-x
(one of :left
, :right
, or :center
) and :text-style.
label-alignment may be one of :top
or :bottom
.
contents must be a single (but possibly compound) pane.
A list pane is a list of buttons. An option pane is a single button that, when pressed, pops up a menu of selections.
Summary: The class that implements an abstract list pane. It is a subclass of value-gadget.
Summary: Either :one-of
or :some-of
. When it is :one-of
, the list pane acts like a radio box; that is, only one item can be selected. When it is :some-of
(the default), zero or more items can be selected at a time.
:items
:name-key
:value-key
:test Initargs
Summary: The :items
initarg specifies a sequence of items to use as the items of the list pane. The name of the item is extracted by the function that is the value of the :name-key
initarg, which defaults to princ-to-string. The value of the item is extracted by the function that is the value of the :value-key
initarg, which defaults to identity. The :test
initarg specifies a function of two argument that is used to compare items; it defaults to eql. For example:
(make-pane 'list-pane :value '("Lisp" "C++") :mode :some-of :items '("Lisp" "Fortran" "C" "C++" "Cobol" "Ada") :test 'string=)
gadget-value (button list-pane)
Summary: Returns the single selected item when the mode is :one-of
, or a sequence of selected items when the mode is :some-of
.
Summary: The class that implements a portable list pane; a subclass of list-pane.
Summary: The class that implements an abstract option pane. It is a subclass of value-gadget.
:items
:name-key
:value-key
:test Initargs
Summary: The :items
initarg specifies a sequence of items to use as the items of the option pane. The name of the item is extracted by the function that is the value of the :name-key
initarg, which defaults to princ-to-string. The value of the item is extracted by the function that is the value of the :value-key
initarg, which defaults to identity. The :test
initarg specifies a function of two argument that is used to compare items; it defaults to eql.
gadget-value (button option-pane)
Summary: Returns the single selected item.
Summary: The class that implements a portable option pane; a subclass of option-pane.
Note: The Menu-Button gadget is available only in Liquid CL CLIM.
The menu-button gadget provides similar behavior to the toggle-button gadget, except that it is intended for items in menus. The returned value is generally the item chosen from the menu.
arm-callback
will be invoked when the menu button becomes armed (such as when the pointer moves into it, or a pointer button is pressed over it). When the menu button is actually activated (by releasing the pointer button over it), value-changed-callback will be invoked. Finally, disarm-callback
will be invoked after value-changed-callback, or when the pointer is moved outside of the menu button.
Summary: The class that implements an abstract menu button. It is a subclass of value-gadget and labelled-gadget-mixin.
Summary: The class that implements a portable menu button; a subclass of menu-button.
The push-button gadget provides press-to-activate switch behavior.
arm-callback
will be invoked when the push button becomes armed (such as when the pointer moves into it, or a pointer button is pressed over it). When the button is actually activated (by releasing the pointer button over it), activate-callback will be invoked. Finally, disarm-callback
will be invoked after activate-callback, or when the pointer is moved outside of the button.
Summary: The class that implements an abstract push button. It is a subclass of active-gadget
and labelled-gadget-mixin.
Summary: This initializes the "show as default" property for the gadget.
push-button-show-as-default Generic Function
push-button-show-as-default push-button
Summary: Returns the "show as default" property for the push button gadget. When t
, the push button will be drawn with a heavy border, which indicates that this button is the "default operation".
Summary: The class that implements a portable push button; a subclass of push-button.
A radio box is a special kind of gadget that constrains one or more toggle buttons. At any one time, only one of the buttons managed by the radio box may be "on." A radio box is responsible for laying out its contents (the buttons that it contains). So that the value of the radio box can be properly computed, it is a client of each of its buttons. As the current selection changes, the previously selected button and the newly selected button both have their value-changed-callback handlers invoked.
Like a radio box, a check box is a gadget that constrains a number of toggle buttons, but unlike a radio box, a check box may have zero or more of its buttons selected at a time.
Summary: The class that implements a radio box. It is a subclass of value-gadget and oriented-gadget-mixin.
Summary: This is used to specify which button, if any, should be initially selected.
radio-box-current-selection Generic Function
radio-box-current-selection radio-box
(setf radio-box-current-selection) Generic Function
(setf radio-box-current-selection) button radio-box
Summary: Returns (or sets) the current selection for the radio box. The current selection will be one of the toggle buttons in the box.
radio-box-selections Generic Function
radio-box-selections radio-box
Summary: Returns a sequence of all the selections in the radio box. The elements of the sequence will be toggle buttons.
gadget-value (button radio-box)
Summary: Returns the selected button (i.e., returns the same value as radio-box-current-selection).
Summary: The class that implements a portable radio box; it is a subclass of radio-box.
Summary: The class that implements a check box. check-box
is a subclass of value-gadget and oriented-gadget-mixin.
Summary: This is used to specify which button, if any, should be initially selected.
check-box-current-selection Generic Function
check-box-current-selection check-box
(setf check-box-current-selection) Generic Function
(setf check-box-current-selection) button check-box
Summary: Returns (or sets) the current selection for the check box. The current selection will be a list of zero or more of the toggle buttons in the box.
check-box-selections Generic Function
check-box-selections check-box
Summary: Returns a sequence of all the selections in the check box. The elements of the sequence will be toggle buttons.
gadget-value (button check-box)
Summary: Returns the selected buttons as a list (i.e., returns the same value as check-box-current-selection).
Summary: The class that implements a portable check box; it is a subclass of check-box.
with-radio-box (&rest options &key (type one-of) &allow-other-keys) &body body
Summary: Creates a radio box whose buttons are created by the forms in body. The macro radio-box-current-selection can be wrapped around one of forms in body in order to indicate that that button is the current selection.
A radio box will be created if type is :one-of
, a check box if :some-of
.
For example, the following creates a radio box with three buttons in it, the second of which is initially selected.
(with-radio-box () (make-pane 'toggle-button :label "Mono") (radio-box-current-selection (make-pane 'toggle-button :label "Stereo")) (make-pane 'toggle-button :label "Quad"))
The following simpler form can be used when you do not need to control the appearance of each button closely.
(with-radio-box () "Mono" "Stereo" "Quad")
The scroll-bar gadget corresponds to a scroll bar.
Summary: The class that implements a scroll bar. This is a subclass of value-gadget, oriented-gadget-mixin, and range-gadget-mixin.
:drag-callback
:scroll-to-bottom-callback
:scroll-to-top-callback
:scroll-down-line-callback
:scroll-up-line-callback
:scroll-down-page-callback
:scroll-up-page-callback Initargs
Summary: Specifies the various callbacks for the scroll bar.
scroll-bar-drag-callback Generic Function
scroll-bar-drag-callback scroll-bar
Summary: Returns the function that will be called when the indicator of the scroll bar is dragged. This function will be invoked with a two arguments, the scroll bar and the new value.
scroll-bar-scroll-to-bottom-callback Generic Function
scroll-bar-scroll-to-bottom-callback scroll-bar
scroll-bar-scroll-to-top-callback Generic Function
scroll-bar-scroll-to-top-callback scroll-bar
scroll-bar-scroll-down-line-callback Generic Function
scroll-bar-scroll-down-line-callback scroll-bar
scroll-bar-scroll-up-line-callback Generic Function
scroll-bar-scroll-up-line-callback scroll-bar
scroll-bar-scroll-down-page-callback Generic Function
scroll-bar-scroll-down-page-callback scroll-bar
scroll-bar-scroll-up-page-callback Generic Function
scroll-bar-scroll-up-page-callback scroll-bar
Summary: Returns the functions that will be used as callbacks when various parts of the scroll bar are clicked on. These are all functions of one argument, the scroll bar.
When any of these functions returns nil
, there is no callback of that type for the gadget.
drag-callback scroll-bar client gadget-id value
Summary: This callback is invoked when the value of the scroll bar is changed while the indicator is being dragged. The function stored in scroll-bar-drag-callback is called with two arguments, the scroll bar and the new value.
The value-changed-callback is invoked only after the indicator is released after dragging it.
scroll-to-top-callback Callback
scroll-to-top-callback scroll-bar client gadget-id
scroll-to-bottom-callback Callback
scroll-to-bottom-callback scroll-bar client gadget-id
scroll-up-line-callback Callback
scroll-up-line-callback scroll-bar client gadget-id
scroll-up-page-callback Callback
scroll-up-page-callback scroll-bar client gadget-id
scroll-down-line-callback Callback
scroll-down-line-callback scroll-bar client gadget-id
scroll-down-page-callback Callback
scroll-down-page-callback scroll-bar client gadget-id
Summary: All the callbacks above are invoked when appropriate parts of the scroll bar are clicked on. Note that each implementation may not have "hot spots" corresponding to each of these callbacks.
gadget-value (button scroll-bar)
Summary: Returns a real number within the specified range.
Summary: The class that implements a portable scroll bar; it is a subclass of scroll-bar.
The slider gadget corresponds to a slider.
Summary: The class that implements a slider. This is a subclass of value-gadget, oriented-gadget-mixin, range-gadget-mixin, and labelled-gadget-mixin.
:drag-callback
:show-value-p
:decimal-places Initargs
Summary: Specifies the drag callback for the slider, whether the slider should show its current value, and how many decimal places to the right of the decimal point should be displayed when the slider is showing its current value.
slider-drag-callback Generic Function
slider-drag-callback slider
Summary: Returns the function that will be called when the slider's indicator is dragged. This function will be invoked with two arguments, the slider and the new value.
When this function returns nil
, there is no drag callback for the gadget.
drag-callback slider client gadget-id value
Summary: This callback is invoked when the value of the slider is changed while the indicator is being dragged. The function stored in slider-drag-callback is called with two arguments, the slider and the new value.
The value-changed-callback is invoked only after the indicator is released after dragging it.
gadget-value (button slider)
Summary: Returns a real number that is the value of button.
Summary: The class that implements a portable slider; a subclass of slider.
:number-of-tick-marks
:number-of-quanta Initargs
Summary: Specifies the number of tick marks that should be drawn on the scroll bar, and the number of quanta in the scroll bar. If the scroll bar is quantized, it will consist of discrete (rather than continuous) values.
Note: :number-of-tick-marks and :number-of-quanta are available only in Liquid CL CLIM.
gadget-show-value-p Generic Function
gadget-show-value-p slider
Summary: Returns t
if the slider shows its value; otherwise, it returns nil
.
Note: gadget-show-value-p is available only in Liquid CL CLIM.
The text-field gadget corresponds to a small field containing text. The text-editor gadget corresponds to a large field containing multiple lines of text.
Summary: The class that implements a text field. This is a subclass of value-gadget and action-gadget. The value of a text field is the text string.
Summary: Specifies whether or not the text field can be edited.
gadget-value (value-gadget text-field)
Summary: Returns the resulting string.
Summary: The instantiable class that implements a portable text field; it is a subclass of text-field.
Summary: The instantiable class that implements an abstract large text field. This is a subclass of text-field.
The value of a text editor is the text string.
Summary: Specifies the width and height of the text editor in columns and number of lines.
gadget-value (value-gadget text-editor)
Summary: Returns the resulting string.
Summary: The instantiable class that implements a portable text editor; it is a subclass of text-editor.
The toggle-button gadget provides "on/off" switch behavior. This gadget typically appears as a recessed or prominent box. If the box is recessed, the gadget's value is t
; if it is prominent, the value is nil
.
arm-callback
will be invoked when the toggle button becomes armed (such as when the pointer moves into it, or a pointer button is pressed over it). When the toggle button is actually activated (by releasing the pointer button over it), value-changed-callback will be invoked. Finally, disarm-callback
will be invoked after value-changed-callback, or when the pointer is moved outside of the toggle button.
Summary: The class that implements an abstract toggle button. It is a subclass of value-gadget and labelled-gadget-mixin.
Summary: This initializes the indicator type property for the gadget.
toggle-button-indicator-type Generic Function
toggle-button-indicator-type toggle-button
Summary: Returns the indicator type for the toggle button. This will be either :one-of
or :some-of
. The indicator type controls the appearance of the toggle button. For example, many toolkits present a one-of-many choice differently from a some-of-many choice.
gadget-value (value-gadget toggle-button)
Summary: Returns t
if the button is selected; otherwise, it returns nil
.
Summary: The class that implements a portable toggle button; a subclass of toggle-button.
In addition to gadget panes, CLIM allows gadgets to be used inside of CLIM stream panes. For instance, an accepting-values pane whose fields consist of gadgets may appear in an ordinary CLIM stream pane.
Note that many of the functions in the output record protocol must correctly manage the case where output records contain gadgets. For example, (setf output-record-position)
may need to notify the host window system that the toolkit object representing the gadget has moved, window-clear needs to deactivate any gadgets, and so forth.
Summary: The instantiable class that represents an output record class that contains a gadget. This is a subclass of output-record.
with-output-as-gadget (stream &rest options) &body body
Summary: Invokes body to create a gadget, and then creates a gadget output record that contains the gadget and installs it into the output history of the output recording stream stream. The returned value of body must be the gadget.
The options in options are passed as initargs to the call to invoke-with-new-output-record that is used to create the gadget output record.
The stream argument is not evaluated, and must be a symbol that is bound to an output recording stream. If stream is t
, *standard-output* is used. body may have zero or more declarations as its first forms.
For example, the following could be used to create an output record containing a radio box that contains several toggle buttons:
(with-output-as-gadget (stream) (let* ((radio-box (make-pane 'radio-box :client stream :id 'radio-box))) (dolist (item sequence) (make-pane 'toggle-button :label (princ-to-string (item-name item)) :value (item-value item) :id item :parent radio-box)) radio-box))
An example of a push button that calls back into the presentation type system to execute a command might be as follows:
(with-output-as-gadget (stream) (make-pane 'push-button :label "Click here to exit" :activate-callback #'(lambda (button) (frame-exit (pane-frame button)))))
CLIM 2.0 User Guide - 01 Dec 2021 19:38:58