30.4 Abstract Gadget Classes

  • 30.4.1 The push-button Gadget
  • 30.4.2 The toggle-button Gadget
  • 30.4.3 The menu-button Gadget
  • 30.4.4 The scroll-bar Gadget
  • 30.4.5 The slider Gadget
  • 30.4.6 The radio-box and check-box Gadgets
  • 30.4.7 The list-pane and option-pane Gadgets
  • 30.4.8 The text-field Gadget
  • 30.4.9 The text-editor Gadget
  • CLIM supplies a set of abstract gadgets that have been designed to be compatible with with a variety of user interface toolkits, including Xt widget-based toolkits (such as Motif), OpenLook, and MacApp and MicroSoft Windows. [annotate]

    CLIM's "concrete" gadget classes will all be subclasses of these abstract gadget classes. Each concrete gadget maps to an implementation-specific object that is managed by the underlying toolkit. For example, while a CLIM program manipulates an object of class scroll-bar, the underlying implementation-specific object might be an Xt widget of type Xm_Scroll_Bar. As events are processed on the underlying object the corresponding generic operations are applied to the Lisp gadget. [annotate]

    Minor issue: Do we want to define something like gadget-handle that is a documented way to get ahold of the underlying toolkit object? --- ILA [annotate]

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

    30.4.1 The push-button Gadget

    The push-button gadget provides press-to-activate switch behavior. [annotate]

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

    push-button   [Class]
    :show-as-default   [Initarg]
              

    This is used to initialize the "show as default" property for the gadget, described below. [annotate]

    [annotate]

    push-button-show-as-default  push-button [Generic Function]
              

    Returns the "show as default" property for the push button gadget. When true, the push button will be drawn with a heavy border, which indicates that this button is the "default operation". [annotate]

    [annotate]

    push-button-pane   [Class]
              

    The instantiable class that implements a portable push button; a subclass of push-button. [annotate]

    [annotate]

    30.4.2 The toggle-button Gadget

    The toggle-button gadget provides "on/off" switch behavior. This gadget typically appears as a box that is optionally highlighted with a check-mark. If the check-mark is present, the gadget's value is t, otherwise it is nil. [annotate]

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

    toggle-button   [Class]
    :indicator-type   [Initarg]
              

    This is used to initialize the indicator type property for the gadget, described below. [annotate]

    [annotate]

    toggle-button-indicator-type  toggle-button [Generic Function]
              

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

    [annotate]

    toggle-button-pane   [Class]
              

    The instantiable class that implements a portable toggle button; a subclass of toggle-button. [annotate]

    [annotate]

    30.4.3 The menu-button Gadget

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

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

    menu-button   [Class]
              

    The instantiable class that implements an abstract menu button. It is a subclass of value-gadget and labelled-gadget-mixin. [annotate]

    [annotate]

    menu-button-pane   [Class]
              

    The instantiable class that implements a portable menu button; a subclass of menu-button. [annotate]

    [annotate]

    30.4.4 The scroll-bar Gadget

    The scroll-bar gadget corresponds to a scroll bar. [annotate]

    scroll-bar   [Class]
    :drag-callback   [Initarg]
    :scroll-to-bottom-callback   [Initarg]
    :scroll-to-top-callback   [Initarg]
    :scroll-down-line-callback   [Initarg]
    :scroll-up-line-callback   [Initarg]
    :scroll-down-page-callback   [Initarg]
    :scroll-up-page-callback   [Initarg]
              

    Specifies the drag and other scrolling callbacks for the scroll bar. [annotate]

    [annotate]

    scroll-bar-drag-callback  scroll-bar [Generic Function]
              

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

    [annotate]

    scroll-bar-scroll-to-bottom-callback  scroll-bar [Generic Function]
    scroll-bar-scroll-to-top-callback  scroll-bar [Generic Function]
    scroll-bar-scroll-down-line-callback  scroll-bar [Generic Function]
    scroll-bar-scroll-up-line-callback  scroll-bar [Generic Function]
    scroll-bar-scroll-down-page-callback  scroll-bar [Generic Function]
    scroll-bar-scroll-up-page-callback  scroll-bar [Generic Function]
              

    Returns the functions that will be used as callbacks when various parts of the scroll bar are clicked on. These are all functions of a single argument, the scroll bar. [annotate]

    When any of these functions returns nil, that indicates that there is no callback of that type for the gadget. [annotate]

    [annotate]

    drag-callback  scroll-bar client gadget-id value [Callback Generic Function]
              

    This callback is invoked when the value of the scroll bar is changed while the indicator is being dragged. This is implemented by calling the function stored in scroll-bar-drag-callback with two arguments, the scroll bar and the new value. [annotate]

    The value-changed-callback is invoked only after the indicator is released after dragging it. [annotate]

    [annotate]

    scroll-to-top-callback  scroll-bar client gadget-id [Callback Generic Function]
    scroll-to-bottom-callback  scroll-bar client gadget-id [Callback Generic Function]
    scroll-up-line-callback  scroll-bar client gadget-id [Callback Generic Function]
    scroll-up-page-callback  scroll-bar client gadget-id [Callback Generic Function]
    scroll-down-line-callback  scroll-bar client gadget-id [Callback Generic Function]
    scroll-down-page-callback  scroll-bar client gadget-id [Callback Generic Function]
              

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

    [annotate]

    scroll-bar-pane   [Class]
              

    The instantiable class that implements a portable scroll bar; a subclass of scroll-bar. [annotate]

    [annotate]

    30.4.5 The slider Gadget

    The slider gadget corresponds to a slider. [annotate]

    :drag-callback   [Initarg]
    :show-value-p   [Initarg]
    :decimal-places   [Initarg]
              

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

    [annotate]

    :min-label   [Initarg]
    :max-label   [Initarg]
    :range-label-text-style   [Initarg]
              

    Specifies a label to be used at the low end and high end of the sldier, and what the text style of those labels should be. [annotate]

    [annotate]

    :number-of-tick-marks   [Initarg]
    :number-of-quanta   [Initarg]
              

    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, the scroll bar will consist of discrete values rather than continuous values. [annotate]

    [annotate]

    gadget-show-value-p  slider [Generic Function]
              

    Returns true if the slider shows its value, otherwise returns false [annotate]

    [annotate]

    slider-drag-callback  slider [Generic Function]
              

    Returns the function that will be called when the indicator of the slider is dragged. This function will be invoked with a two arguments, the slider and the new value. [annotate]

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

    [annotate]

    drag-callback  slider client gadget-id value [Callback Generic Function]
              

    This callback is invoked when the value of the slider is changed while the indicator is being dragged. This is implemented by calling the function stored in slider-drag-callback with two arguments, the slider and the new value. [annotate]

    The value-changed-callback is invoked only after the indicator is released after dragging it. [annotate]

    [annotate]

    slider-pane   [Class]
              

    The instantiable class that implements a portable slider; a subclass of slider. [annotate]

    [annotate]

    30.4.6 The radio-box and check-box Gadgets

    Radio boxes and check boxes are special kinds of gadgets that constrain one or more toggle buttons. At any one time, only one of the buttons managed by the radio box, or zero or more of the buttons managed by a check box, may be "on". The contents of a radio box or a check box are its buttons, and as such a radio box or check bnox is responsible for laying out the buttons that it contains. A radio box or check box is a client of each of its buttons so that the value of the radio or check box can be properly computed. [annotate]

    As the current selection changes, the previously selected button and the newly selected button both have their value-changed-callback handlers invoked. [annotate]

    radio-box   [Class]
              

    The instantiable class that implements an abstract radio box, that is, a gadget that constrains a number of toggle buttons, only one of which may be selected at any one time. It is a subclass of value-gadget and oriented-gadget-mixin. [annotate]

    [annotate]

    :current-selection   [Initarg]
              

    This is used to specify which button, if any, should be initially selected. [annotate]

    [annotate]

    radio-box-current-selection  radio-box [Generic Function]
    (setf radio-box-current-selection)  button radio-box [Generic Function]
              

    Returns (or sets) the current selection for the radio box. The current selection will be one of the toggle buttons in the box. [annotate]

    [annotate]

    radio-box-selections  radio-box [Generic Function]
              

    Returns a sequence of all of the selections in the radio box. The elements of the sequence will be toggle buttons. [annotate]

    [annotate]

    radio-box-pane   [Class]
              

    The instantiable class that implements a portable radio box; a subclass of radio-box. [annotate]

    [annotate]

    check-box   [Class]
              

    The instantiable class that implements an abstract check box, that is, a gadget that constrains a number of toggle buttons, zero or more of which may be selected at any one time. It is a subclass of value-gadget and oriented-gadget-mixin. [annotate]

    [annotate]

    :current-selection   [Initarg]
              

    This is used to specify which buttons, if any, should be initially selected. [annotate]

    [annotate]

    check-box-current-selection  check-box [Generic Function]
    (setf check-box-current-selection)  button check-box [Generic Function]
              

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

    [annotate]

    check-box-selections  check-box [Generic Function]
              

    Returns a sequence of all of the selections in the check box. The elements of the sequence will be toggle buttons. [annotate]

    [annotate]

    check-box-pane   [Class]
              

    The instantiable class that implements a portable check box; a subclass of check-box. [annotate]

    [annotate]

    with-radio-box  (&rest options &key (type :one-of) &allow-other-keys ) &body body [Macro]
              

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

    If type is :one-of, a radio-box will be created. If type is :some-of, a check-box will be created. [annotate]

    For example, the following creates a radio box with three buttons in it, the second of which is initially selected. [annotate]

    (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 also be used when the programmer does not need to control the appearance of each button closely. [annotate]

    (with-radio-box ()
      "Mono" "Stereo" "Quad")
    

    [annotate]

    30.4.7 The list-pane and option-pane Gadgets

    list-pane   [Class]
              

    The instantiable class that implements an abstract list pane, that is, a gadget whose semantics are similar to a radio box or check box, but whose visual appearance is a list of buttons. It is a subclass of value-gadget. [annotate]

    [annotate]

    :mode   [Initarg]
              

    Either :nonexclusive or :exclusive. When it is :exclusive, the list pane acts like a radio box, that is, only a single item can be selected. Otherwise, the list pane acts like a check box, in that zero or more items can be selected. The default is :exclusive. [annotate]

    [annotate]

    :items   [Initarg]
    :name-key   [Initarg]
    :value-key   [Initarg]
    :test   [Initarg]
              

    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 arguments that is used to compare items; it defaults to eql. [annotate]

    For example, [annotate]

    (make-pane 'list-pane
      :value '("Lisp" "C++")
      :mode :nonexclusive
      :items '("Lisp" "Fortran" "C" "C++" "Cobol" "Ada")
      :test 'string=)
    

    [annotate]

    gadget-value  (button list-pane) [Method]
    generic-list-pane   [Class]
              

    The instantiable class that implements a portable list pane; a subclass of list-pane. [annotate]

    [annotate]

    option-pane   [Class]
              

    The instantiable class that implements an abstract option pane, that is, a gadget whose semantics are identical to a list pane, but whose visual appearance is a single push button which, when pressed, pops up a menu of selections.. It is a subclass of value-gadget. [annotate]

    [annotate]

    :mode   [Initarg]
              

    Either :nonexclusive or :exclusive. When it is :exclusive, the option pane acts like a radio box, that is, only a single item can be selected. Otherwise, the option pane acts like a check box, in that zero or more items can be selected. The default is :exclusive. [annotate]

    [annotate]

    :items   [Initarg]
    :name-key   [Initarg]
    :value-key   [Initarg]
    :test   [Initarg]
              

    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 arguments that is used to compare items; it defaults to eql. [annotate]

    For example,

    (make-pane 'option-pane
      :value '("Lisp" "C++")
      :mode :nonexclusive
      :items '("Lisp" "Fortran" "C" "C++" "Cobol" "Ada")
      :test 'string=)
    

    [annotate]

    gadget-value  (button option-pane) [Method]
    generic-option-pane   [Class]
              

    The instantiable class that implements a portable option pane; a subclass of option-pane. [annotate]

    [annotate]

    30.4.8 The text-field Gadget

    The text-field gadget corresponds to a small field containing text. [annotate]

    text-field   [Class]
              

    The instantiable class that implements an abstract text field. This is a subclass of value-gadget and action-gadget. [annotate]

    The value of a text field is the text string. [annotate]

    [annotate]

    :editable-p   [Initarg]
              

    This is used to specify whether or not the text field may be edited. [annotate]

    [annotate]

    text-field-pane   [Class]
              

    The instantiable class that implements a portable text field; a subclass of text-field. [annotate]

    [annotate]

    30.4.9 The text-editor Gadget

    The text-editor gadget corresponds to a large field containing multiple lines of text. [annotate]

    text-editor   [Class]
              

    The instantiable class that implements an abstract large text field. This is a subclass of text-field. [annotate]

    The value of a text editor is the text string. [annotate]

    [annotate]

    :ncolumns   [Initarg]
    :nlines   [Initarg]
              

    Specifies the width and height of the text editor in columns and number of lines. [annotate]

    [annotate]

    text-editor-pane   [Class]
              

    The instantiable class that implements a portable text editor; a subclass of text-editor. [annotate]

    [annotate]