Each frame part is defined as an association list (or alist), a list of
cons cells, the car of each cell defines the attribute, the cdr defines
the value given to that attribute. So, for example, the alist
((foo . 1) (bar . 2)) specifies two attributes: foo with
value 1, and bar with value 2. See Association Lists.
The attributes that may be defined are as follows:
(class . class)
(background . data)
(background . (normal focused highlighted clicked))
If an image is used it will be scaled to the size of the frame part,
unless it's tiled property is set, in which case it will be
tiled across the frame part.
(foreground . data)
(foreground . (normal focused highlighted clicked))
Unlike the background attribute, by default images are not
scaled when used to define the foreground of a frame part.
(scale-foreground . value)
nil, the foreground image of the frame
part will be scaled to the size of the part.
(font . font)
(font . (normal focused highlighted clicked))
(text . value)
foreground property is an image). Either a string,
or a function, that will be called each time that the part is
refreshed, that will return the string to draw.
(x-justify . value)
left, right or center, or a number. If a number it
defines the number of pixels from the left edge if positive, or the
right edge if negative.
(y-justify . value)
x-justify, but the accepted symbols are top,
bottom or center instead.
(renderer . function)
background attribute.
When the part needs to be drawn function will be called with an
image in which to render the background, and the current state of the
part, a symbol focused, highlighted, clicked, or
nil (for the normal state).
(render-scale . value)
renderer property to be reduced by a factor of value, an
integer.
(left-edge . value)
(right-edge . value)
(top-edge . value)
(bottom-edge . value)
(width . value)
(height . value)
(keymap . value)
(cursor . cursor)
get-cursor to create
the required cursor object.
(removable . value)
nil, this frame part may
be removed from the frame without being detrimental to the overall
appearance of the frame. This is only important for button classes,
which may sometimes be removed at the request of the client window.
(below-client . value)
nil, then this frame part
will be displayed beneath the client window. The default action is for
frame parts to be stacked above the client window.
(hidden . value)
nil, don't display this
frame part.
The values specified for the background, foreground,
render-scale, font, left-edge, right-edge,
top-edge, bottom-edge, width, height,
cursor, below-client and hidden attributes may
actually be functions. In which case the function will be called (with
a single argument, the window object) when the frame is constructed,
the value returned will be used as the actual value of the attribute.
The coordinate system used for specifying the part's position is relative to the window edge that the position is defined against. Positive values count in from the window edge towards the center of the window, while negative values count out from the edge, away from the center of the window.
Consider the following example, a solid black title bar that is twenty pixels high, directly above the client window:
`((background . "black")
(foreground . "white")
(text . ,window-name)
(x-justify . 30)
(y-justify . center)
(left-edge . 0)
(right-edge . 0)
(top-edge . -20)
(height . 20)
(class . title))
The backquote operator is used since the definition is only mostly
constant, the comma operator inserts the value of the
window-name variable (a function giving the name of a window)
into the definition; see Backquoting).
This function is then used to dynamically specify the string drawn in the foreground. The window manager will automatically refresh the foreground of all frame parts of a window whenever any X property of that window changes.
Given a framed window, and a particular frame part class, it is possible to retrieve the values of individual attributes from the complete list of definitions (including inherited or overrided definitions).
| frame-part-get part property | Function |
Returns the value of the property property for the frame part
object part. Returns nil if no such attribute exists.
|
| frame-part-put part prop value | Function |
| Set the property prop of frame part part to value. |
| frame-part-state part | Function |
Return the current state for frame part part, one of the symbols
focused, highlighted, clicked,
inactive-highlighted, inactive-clicked, or nil if
the part is inactive.
|