Copyright (C) 2000-2012 |
GNU Info (sawfish.info)Frame Part ClassesFrame Part Classes ================== Although one of the aims of Sawfish is to provide as much flexibility as possible, this can sometimes be detrimental to the overall experience. For example, it would be easier for the user if all themes use consistent keymaps and cursor images in conceptually similar parts of window frames. That is, it would be better if all close buttons had the same mouse button bindings and the same mouse cursor displayed when the pointer is over them. To achieve this, Sawfish defines a number of "classes" of frame parts, each with several default attributes. When defining a window frame, the definitions of each part then specifies which class it is a member of, and inherits the associated default attributes (provided that it hasn't explicitly specified values for these attributes). - Variable: frame-part-classes This variable is an association list, associating symbols naming frame part classes with an association list of default attributes for that class. The names of the pre-defined classes are as follows, their meanings should be self-explanatory: `title', `menu-button', `close-button', `iconify-button', `maximize-button', `top-border', `left-border', `right-border', `bottom-border', `top-left-corner', `top-right-corner', `bottom-left-corner', `bottom-right-corner'. Extra classes can be created by adding to `frame-part-classes'. However, it's likely that more than one theme may need to use the same class, and that the user may then wish to customize any extra keymaps used. The `def-frame-class' macro should be used to add new classes, since it handles these situations. - Macro: def-frame-class class alist-form &rest binding-forms ... Creates a new frame part class named by the symbol CLASS. The ALIST-FORM is evaluated to give an association list defining attributes for the class. Each key-value pairs is only set if no existing value exists for that key. If BINDING-FORMS are given, they will be evaluated when no keymap already exists for the class. A keymap will be created, and stored in the variable named `CLASS-name'. This variable may then be used withing the BINDING-FORMS. So to define a hypothetical `shade-button' class, the following might be used: (def-frame-class shade-button '((cursor . left_ptr)) (bind-keys shade-button-keymap "Button1-Off" 'toggle-window-shaded)) In some cases it might be valuable to be able to override pre-defined frame part properties. For example, it might be your preference that text in window title bars is always blue. - Variable: override-frame-part-classes Similar to `frame-part-classes' except that the properties take precedence over values defined both in that variable and in the frame style itself. The following function may be used to simplify the customization of these two variables: - Function: set-frame-part-value class key value &optional override Associate VALUE with property KEY for all frame parts of class CLASS. If OVERRIDE is non-nil, then the setting is installed in the `override-frame-part-classes' variable, otherwise it's stored in the `frame-part-classes' variable. The following example would override the colors of all title bars: (set-frame-part-value 'title 'background '("black" "white" "green" "blue") t) (See the next section for details about what is actually being set here.) automatically generated by info2www version 1.2.2.9 |