NextPrevUpTopContentsIndex

element

Class
Summary

The class element is the superclass of all CAPI objects that appear in a window.

Package

capi

Superclasses

capi-object

Subclasses

simple-pane
menu

Initargs

:parent

The element containing this element.

:interface

The interface containing this element.

:accepts-focus-p

Specifies that the element should accept input.

:help-key

An object used for lookup of help. Default value t .

The following initargs are geometry hints, influencing the initial size and position of an element and constraining its size:

:x

The x position of the element in a pinboard.

:y

The y position of the element in a pinboard.

:external-min-width

The minimum width of the element in its parent.

:external-min-height

The minimum height of the element in its parent.

:external-max-width

The maximum width of the element in its parent.

:external-max-height

The maximum height of the element in its parent.

:visible-min-width

The minimum visible width of the element.

:visible-min-height

The minimum visible height of the element.

:visible-max-width

The maximum visible width of the element.

:visible-max-height

The maximum height of the element.

:internal-min-width

The minimum width of the display region.

:internal-min-height

The minimum height of the display region.

:internal-max-width

The maximum width of the display region.

:internal-max-height

The maximum height of the display region.

Accessors

element-parent

Readers

element-interface
help-key

Description

The class element contains the slots parent and interface which contain the element and the interface that the element is contained in respectively. The writer method element-parent can be used to re-parent an element into another parent (or to remove it from a container entirely by setting its parent to nil ). Note that an element should not be used in more than one place at a time.

The initarg accepts-focus-p specifies that the element can accept input. The default value is t . In some subclasses including display-pane and title-pane the default value of accepts-focus-p is nil . A pane accepts the input focus if and only if the function accepts-focus-p returns true.

accepts-focus-p also influences whether a pane is a tabstop on Windows, where a pane acts as a tabstop if and only if the function accepts-focus-p returns true and the :accepts-focus-p initarg value is :force . On Motif and Cocoa, a pane acts as a tabstop if and only if the function accepts-focus-p returns true.

help-key is used to determine how help is displayed for the pane. The value nil means that no help is displayed. Otherwise, help-key is passed to the interface-help-callback , except when help-key is t , when the name of the pane is passed to the interface-help-callback . For details of interface-help-callback , see interface.

All elements accept initargs (listed above) representing hints as to the initial size and position of the element. By default elements have a minimum pixel size of one by one, and a maximum size of nil (meaning no maximum), but the hints can be specified to change these values. The possible values for these hints are as follows:

integer

The size in pixels.

t

For :visible-max-width , t means use the value of :visible-min-width .

For :visible-max-height , t means use the value of :visible-min-height .

:text-width

The width of any text in the element.

:text-height

The height of any text in the element.

:screen-width

The width of the screen.

:screen-height

The height of the screen.

Also, hints can be a list starting with any of the following operators, followed by one or more hints.

max

The maximum size of the hints.

min

The minimum size of the hints.

+

The sum of the hints.

-

The subtraction of hints from the first.

*

The multiplication of the hints.

/

The division of hints from the first.

Also, a hint can be a two element list specifying the size of a certain amount of text when drawn in the element:

(:character integer )

(character integer )

The size of integer characters.

(:string string )

(string string )

The size of string .

A hint can be a two-element list interpreted as the value of a symbol:

(symbol-value foo )

The size of the symbol-value of foo .

Finally, you can choose to apply or funcall an arbitrary function, by passing a list starting with funcall or apply , followed by the function and then the arguments.

The hints of an element can be changed dynamically using set-hint-table: such a call might change the geometry.

Note: If the visible-max-width is the same as the visible-min-width , then the element is not horizontally resizable. If the visible-max-height is the same as the visible-min-height , then the element is not vertically resizable.

Note: Some classes have default initargs providing useful hints. For example, display-pane has :text-height as the default value of :visible-min-height , ensuring that the text is visible.

Note: The ratios , x-ratios and y-ratios settings in some layouts (for example grid-layout) also control the actual size of the pane when the constraints are not specified. In particular, if nil is used in the ratios then the associated pane(s) will be fixed at their minimum size.

Compatibility Note

The :min-width , :max-width , :min-height , and :max-height initargs are still accepted for compatibility with LispWorks 3.2, but their use is discouraged.

In LispWorks 4, :visible - min-width means the same as :min-width , but takes precedence if both are specified. The use of :min-width can lead to confusion because some CAPI classes have default values for :visible-min-width which will override :min-width . Similarly for : min-height , :max-width , and :max-height . Therefore, your code should use :visible-min-width and friends.

Examples
(capi:display (make-instance 'capi:interface
                              :title "Test"
                              :visible-min-width 300))
(capi:display (make-instance 'capi:interface
                              :title "Test"
                              :visible-min-width 300
                              :visible-max-height 200))

Here is a simple example that demonstrates the use of the element-parent accessor to place elements.

(setq pinboard (capi:contain
                (make-instance 
                 'capi:pinboard-layout)
                :visible-min-width 520
                :visible-min-height 395))
 
(setq object 
      (make-instance
       'capi:image-pinboard-object
       :x 10 :y 10
       :image
       (sys:lispworks-file 
        "examples/capi/graphics/lwsplash.bmp")
       :parent pinboard))
 
(capi:apply-in-pane-process
 pinboard #'(setf capi:element-parent) nil object)
 
(capi:apply-in-pane-process
 pinboard #'(setf capi:element-parent) pinboard object)
See also

set-hint-table


LispWorks CAPI Reference Manual - 25 Jul 2006

NextPrevUpTopContentsIndex