Set the appearance (foreground, background, font) of panes inside interfaces of a specific type.
capi
set-interface-pane-name-appearance interface-type pane-name &key font background foreground check-types
set-interface-pane-type-appearance interface-type pane-type &key font background foreground check-types
interface-type⇩ |
A symbol naming a subtype of interface. |
pane-name⇩ |
Any object. |
font⇩ | |
check-types⇩ |
A generalized boolean. |
pane-type⇩ |
A symbol naming a subtype of simple-pane. |
The function set-interface-pane-name-appearance
creates a setting such that, when a pane whose capi-object name is pane-name is created inside an interface of type interface-type, the pane's font, foreground and background attributes are set to font, foreground and background respectively.
If font, foreground or background is a function or an fboundp symbol, the value to use is the result of calling the function with two arguments: the interface and the pane.
If font, foreground or background is nil
then the corresponding attribute is set to what it would have been set if set-interface-pane-name-appearance
was not called at all for this interface-type and pane-name. See below for the meaning of :default
.
The function set-interface-pane-type-appearance
behaves the same as set-interface-pane-name-appearance
, but the setting is applied to any pane of type pane-type.
Each call to set-interface-pane-name-appearance
with a specific interface-type and pane-name, or to set-interface-pane-type-appearance
with a specific interface-type and pane-type, completely overrides previous calls with the same interface-type and pane-type or pane-name.
When a pane (whose type is a subtype of simple-pane) is created (which happens when the interface is displayed by display), the settings that were created by set-interface-pane-type-appearance
and set-interface-pane-name-appearance
are applied, and override any other settings.
When more than one setting created by set-interface-pane-type-appearance
or set-interface-pane-name-appearance
is applicable to a pane, settings created by set-interface-pane-name-appearance
take precedence over settings created by set-interface-pane-type-appearance
, and otherwise the more specific settings, according to interface-type and pane-type, take precedence. The value for each attribute is specified by the setting with the highest precedence where the value is not nil
.
If the value for an attribute in the highest precedence settings is :default
, then settings of this attribute of lower precedence are ignored, and the attribute is set to what it would have been set to if none of the settings where created. Setting this for one attribute has no effect on the other attributes.
check-types, which defaults to t
, controls whether the functions check if interface-type is a subtype of interface, and if pane-type is a subtype of simple-pane. Using :check-types nil
allows you to use these functions before interface-type or pane-type are defined, at the price of no error checking.
The settings override any defaults for the matching panes and changes to the simple-pane background, foreground or font before the creation of the pane. They can be overridden after the pane is created, for example in a method on interface-display.
You can use these functions to customize the LispWorks IDE. For example in the IDE, the type of the interface of the Editor tool is lw-tools:editor
, and this is also the name of the editor pane inside (but not of the collector-pane or echo-area pane). So you can customize the background of all the Editors in the IDE to red by:
(set-interface-pane-name-appearance 'lw-tools:editor 'lw-tools:editor :background :red)
Note that this will not affect the pane in the "Output" tab and the echo area. You can use instead:
(set-interface-pane-type-appearance 'lw-tools:editor 'capi:editor-pane :background :red)
The latter call affects the output and echo-area panes too, because they are subclasses of editor-pane. This will override the preferences that are set by the Preferences Dialog in the IDE.
You can use interface as interface-type to make it applicable to all interfaces, but that may cause undesired effects if it applies to unintended panes. There is also a little overhead associated with settings, though this is probably negligible unless large number of settings are created.
set-interface-pane-name-appearance
and set-interface-pane-type-appearance
will typically be used in your .lispworks initialization file. They can also be useful for adding customization to your application.
simple-pane
15 The Color System
13.9 Portable font descriptions
18.8 Setting the font and colors for specific panes in specific interfaces.
CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:32:42