NextPrevUpTopContentsIndex

10.5.2 Basic Gadget Classes

The following are the basic gadget classes upon which all abstract gadgets are built.

gadget [Protocol Class]	

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 [Function]	

Arguments: object

Summary: Returns t if object is a gadget; otherwise. it returns nil .

basic-gadget

Summary: The base class on which all CLIM gadget classes are built.

:id

:client

:armed-callback

:disarmed-callback

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 [Generic Function]

Arguments: gadget

(setf gadget-id) [Generic Function]

Arguments: 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]

Arguments: gadget

(setf gadget-client) [Generic Function]

Arguments: 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]

Arguments: gadget

gadget-disarmed-callback [Generic Function]

Arguments: 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

Arguments: gadget client gadget-id

disarmed-callback

Arguments: 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]

Arguments: gadget

Summary: Causes the host gadget to become active, that is, available for input.

deactivate-gadget [Generic Function]

Arguments: 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]

Arguments: gadget

Summary: Returns t if gadget is active, that is, has been activated with activate-gadget .

note-gadget-activated [Generic Function]

Arguments: client gadget

Summary: This function is invoked after a gadget is made active.

note-gadget-deactivated [Generic Function]

Arguments: client gadget

Summary: This function is invoked after a gadget is made inactive.

value-gadget

Summary: The class used by gadgets that have a value; a subclass of basic-gadget .

:value

:value-changed-callback

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 [Generic Function]

Arguments: 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]

Arguments: 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]

Arguments: 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

Arguments: 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 .

action-gadget

Summary: The class used by gadgets that perform some kind of action, such as a push button; a subclass of basic-gadget .

:activate-callback

Summary: All subclasses of action-gadget must handle this initarg, which specifies the activate callback of the gadget.

gadget-activate-callback [Generic Function]

Arguments: 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

Arguments: 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 .

oriented-gadget-mixin

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.

:orientation

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]

Arguments: oriented-gadget

Summary: Returns the orientation of the gadget oriented-gadget . Typically, this will be a keyword such as :horizontal or :vertical .

labelled-gadget-mixin

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

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 [Generic Function]

Arguments: labelled-gadget

(setf gadget-label) [Generic Function]

Arguments: 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]

Arguments: labelled-gadget

(setf gadget-label-align-x) [Generic Function]

Arguments: alignment labelled-gadget

gadget-label-align-y [Generic Function]

Arguments: labelled-gadget

(setf gadget-label-align-y) [Generic Function]

Arguments: 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]

Arguments: labelled-gadget

(setf gadget-label-text-style) [Generic Function]

Arguments: 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.

range-gadget-mixin

Summary: The class that is mixed into a gadget that has a range, for example, a slider.

:min-value

:max-value

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]

Arguments: range-gadget

(setf gadget-min-value) [Generic Function]

Arguments: min-value range-gadget

Summary: Returns (or sets) the minimum value of the gadget range-gadget , a real number.

gadget-max-value [Generic Function]

Arguments: range-gadget

(setf gadget-max-value) [Generic Function]

Arguments: max-value range-gadget

Summary: Returns (or sets) the maximum value of the gadget range-gadget , a real number.

gadget-range[Generic Function]

Arguments: 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]

Arguments: range-gadget

Summary: Returns the the minimum value and the maximum value of range-gadget as two values.


CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005

NextPrevUpTopContentsIndex