[previous] [up] [next]     [index]
Next: File Format Up: Editor Structure and Terminology Previous: Administrators

Styles

A style, an instance of the style<%> interface, parameterizes high-level display information that is common to all snip classes. This includes the font, color, and alignment for drawing the item. A single style is attached to each snip.

Styles are hierarchical: each style is defined in terms of another style. There is a single root style, named "Basic", from which all other styles in an editor are derived. The difference between a base style and each of its derived style is encoded in a style delta (or simply delta). A delta encodes changes such as

Style objects are never created separately; rather, they are always be created through a style list, an instance of the style-list% class. A style list manages the styles, servicing external requests to find a particular style, as well as the hierarchical relationship between the styles. A global style list is available (the-style-list), but new style lists can be created for managing separate style hierarchies. For example, each editor will typically have its own style list.

Each new style is defined in one of two ways:

Usually, when text is inserted into a buffer, a it inherits the style of the preceeding snip. If text is inserted into an empty editor, the new snip is usually assigned a style called "Standard". By default, the "Standard" style is unmodified from the root style.

The exception to the above is when change-style in text% is called with the current selection position (when the selection is a position and not a range). In that case, the style is remembered, and if the next buffer-modifying action is a text insertion, the inserted text gets the remembered style.


[previous] [up] [next]     [index]
Next: File Format Up: Editor Structure and Terminology Previous: Administrators

PLT