30.3 Basic Gadget Classes

The following are the basic gadget classes upon which all gadgets are built. [annotate]

gadget   [Protocol Class]
          

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. All instantiable subclasses of gadget must obey the gadget protocol. [annotate]

All of the subclasses of gadget are mutable. [annotate]

[annotate]

gadgetp  object [Protocol Predicate]
          

Returns true if object is a gadget, otherwise returns false. [annotate]

[annotate]

basic-gadget   [Class]
          

The basic class on which all CLIM gadgets are built, a subclass of gadget. This class is an abstract class, intended only to be subclassed, not instantiated. [annotate]

[annotate]

:id   [Initarg]
:client   [Initarg]
:armed-callback   [Initarg]
:disarmed-callback   [Initarg]
          

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. [annotate]

[annotate]

gadget-id  gadget [Generic Function]
(setf gadget-id)  id gadget [Generic Function]
          

Returns (or sets) the gadget id of the gadget gadget. The id is typically a simple Lisp object that uniquely identifies the gadgets. [annotate]

[annotate]

gadget-client  gadget [Generic Function]
(setf gadget-client)  client gadget [Generic Function]
          

Returns the client of the gadget gadget. The client is often an application frame, but it could be another gadget (for example, in the case of a push button that is contained in a radio box, the client of the button could be the radio box). [annotate]

[annotate]

gadget-armed-callback  gadget [Generic Function]
gadget-disarmed-callback  gadget [Generic Function]
          

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. [annotate]

When these functions return nil, that indicates that there is no armed (or disarmed) callback for the gadget. [annotate]

[annotate]

armed-callback  gadget client gadget-id [Callback Generic Function]
disarmed-callback  gadget client gadget-id [Callback Generic Function]
          

These callbacks are invoked when the gadget gadget is, respectively, armed or disarmed. [annotate]

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. A gadget will not call the activate or value-changed callback unless it is armed. [annotate]

The default methods (on basic-gadget) call the function stored in gadget-armed-callback or gadget-disarmed-callback with one argument, the gadget. [annotate]

[annotate]

activate-gadget  gadget [Generic Function]
          

Causes the host gadget to become active, that is, available for input. [annotate]

[annotate]

deactivate-gadget  gadget [Generic Function]
          

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. [annotate]

[annotate]

gadget-active-p  gadget [Generic Function]
          

Returns t if the gadget gadget is active (that is, has been activated with activate-gadget), otherwise returns nil. [annotate]

[annotate]

note-gadget-activated  client gadget [Generic Function]
          

This function is invoked after a gadget is made active. It is intended to allow the client of the gadget to notice when the gadget has been activated. [annotate]

[annotate]

note-gadget-deactivated  client gadget [Generic Function]
          

This function is invoked after a gadget is made inactive. It is intended to allow the client of the gadget to notice when the gadget has been activated. For instance, when the client is an application frame, the frame may invoke the frame manager to "gray out" deactivated gadgets. [annotate]

[annotate]

value-gadget   [Class]
:value   [Initarg]
:value-changed-callback   [Initarg]
          

All subclasses of value-gadget must handle these two initargs, which are used to specify, respectively, the initial value and the value changed callback of the gadget. [annotate]

[annotate]

gadget-value  value-gadget [Generic Function]
          

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 below specifies how to interpret the value.) [annotate]

[annotate]

(setf gadget-value)  value value-gadget &key invoke-callback [Generic Function]
          

Sets the gadget's value to the specified value. [annotate]

If invoke-callback is true, the value changed callback for the gadget is invoked. The default is false. The syntax for using (setf gadget-value) in conjunction with invoke-callback is: [annotate]

(setf (gadget-value gadget :invoke-callback t) new-value)

[annotate]

gadget-value-changed-callback  value-gadget [Generic Function]
          

Returns the function that will be called when the value changed callback is invoked. This function will be invoked with a two arguments, the gadget and the new value. [annotate]

When this function returns nil, that indicates that there is no value changed callback for the gadget. [annotate]

[annotate]

value-changed-callback  value-gadget client gadget-id value [Callback Generic Function]
          

This callback is invoked when the value of a gadget is changed, either by the user or programatically. [annotate]

The default method (on value-gadget) calls the function stored in gadget-value-changed-callback with two arguments, the gadget and the new value. [annotate]

CLIM implementations must implement or inherit a method for value-changed-callback for every gadget that is a subclass of value-gadget. [annotate]

[annotate]

action-gadget   [Class]
          

The class used by gadgets that perform some kind of action, such as a push button; a subclass of basic-gadget. This class is an abstract class, intended only to be subclassed, not instantiated. [annotate]

[annotate]

:activate-callback   [Initarg]
          

All subclasses of action-gadget must handle this initarg, which is used to specify the activate callback of the gadget. [annotate]

[annotate]

gadget-activate-callback  action-gadget [Generic Function]
          

Returns the function that will be called when the gadget is activated. This function will be invoked with one argument, the gadget. [annotate]

When this function returns nil, that indicates that there is no value activate callback for the gadget. [annotate]

[annotate]

activate-callback  action-gadget client gadget-id [Callback Generic Function]
          

This callback is invoked when the gadget is activated. [annotate]

The default method (on action-gadget) calls the function stored in gadget-activate-callback with one argument, the gadget. [annotate]

CLIM implementations must implement or inherit a method for activate-callback for every gadget that is a subclass of action-gadget. [annotate]

[annotate]

oriented-gadget-mixin   [Class]
:orientation   [Initarg]
          

All subclasses of oriented-gadget-mixin must handle this initarg, which is used to specify the orientation of the gadget. [annotate]

[annotate]

gadget-orientation  oriented-gadget [Generic Function]
          

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

[annotate]

labelled-gadget-mixin   [Class]
:label   [Initarg]
:align-x   [Initarg]
:align-y   [Initarg]
          

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. [annotate]

[annotate]

gadget-label  labelled-gadget [Generic Function]
(setf gadget-label)  label labelled-gadget [Generic Function]
          

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. [annotate]

[annotate]

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

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. [annotate]

[annotate]

range-gadget-mixin   [Class]
          

The class that is mixed in to a gadget that has a range, for example, a slider. This class is not intended to be instantiated. [annotate]

[annotate]

:min-value   [Initarg]
:max-value   [Initarg]
          

All subclasses of range-gadget-mixin must handle these two initargs, which are used to specify the minimum and maximum value of the gadget. [annotate]

[annotate]

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

Returns (or sets) the minimum value of the gadget range-gadget. It will be a real number. [annotate]

[annotate]

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

Returns (or sets) the maximum value of the gadget range-gadget. It will be a real number. [annotate]

[annotate]

gadget-range  range-gadget [Generic Function]
          

Returns the range of range-gadget, that is, the difference of the maximum value and the minimum value. [annotate]

[annotate]

gadget-range*  range-gadget [Generic Function]
          

Returns the minimum and maximum values of range-gadget as two values. [annotate]

[annotate]