2.5.29 style-list%

► |  | GUI: Racket Graphics Toolkit

1 | Overview
2 | Reference
3 | Configuration
4 | Dynamic Loading
| Bibliography
| Index

► | 2 | Reference

2.1 | Windowing Classes
2.2 | Windowing Functions
2.3 | Drawing Classes
2.4 | Drawing Functions
2.5 | Editor Classes
2.6 | Editor Functions
2.7 | WXME Decoding

▼ | 2.5 | Editor Classes

2.5.1 | add-color<%>
2.5.2 | editor<%>
2.5.3 | editor-admin%
2.5.4 | editor-canvas%
2.5.5 | editor-data%
2.5.6 | editor-data-class%
2.5.7 | editor-data-class-list<%>
2.5.8 | editor-snip-editor-admin<%>
2.5.9 | editor-snip%
2.5.10 | editor-stream-in%
2.5.11 | editor-stream-in-base%
2.5.12 | editor-stream-in-bytes-base%
2.5.13 | editor-stream-out%
2.5.14 | editor-stream-out-base%
2.5.15 | editor-stream-out-bytes-base%
2.5.16 | editor-wordbreak-map%
2.5.17 | image-snip%
2.5.18 | keymap%
2.5.19 | mult-color<%>
2.5.20 | pasteboard%
2.5.21 | readable-snip<%>
2.5.22 | snip%
2.5.23 | snip-admin%
2.5.24 | snip-class%
2.5.25 | snip-class-list<%>
2.5.26 | string-snip%
2.5.27 | style<%>
2.5.28 | style-delta%
2.5.29 | style-list%
2.5.30 | tab-snip%
2.5.31 | text%

On this page:

basic-style
convert
find-named-style
find-or-create-join-style
find-or-create-style
forget-notification
index-to-style
new-named-style
notify-on-change
number
replace-named-style
style-to-index

top← prev up next →

style-list% : class?
superclass: object%

A style-list% object contains a set of style<%> objects and maintains the hierarchical relationships between them. A style<%> object can only be created through the methods of a style-list% object. There is a global style list object, the-style-list, but any number of independent lists can be created for separate style hierarchies. Each editor creates its own private style list.

See Styles for more information.

( new style-list%) → ( is-a?/c style-list%)

The root style, named "Basic", is automatically created.

( send a-style-list basic-style) → ( is-a?/c style<%>)

Returns the root style. Each style list has its own root style.

See also Preferences for information about the 'GRacket:default-font-size preference.

( send a-style-list convert style) → ( is-a?/c style<%>)
style : ( is-a?/c style<%>)

Converts style, which can be from another style list, to a style in this list. If style is already in this list, then style is returned. If style is named and a style by that name is already in this list, then the existing named style is returned. Otherwise, the style is converted by converting its base style (and shift style if style is a join style) and then creating a new style in this list.

( send a-style-list find-named-style name)
→ ( or/c ( is-a?/c style<%>) false/c)
name : string?

Finds a style by name. If no such style can be found, #f is returned.

( send a-style-list find-or-create-join-style |  | base-style |
|  | shift-style) |

→ ( is-a?/c style<%>)
base-style : ( is-a?/c style<%>)
shift-style : ( is-a?/c style<%>)

Creates a new join style, or finds an appropriate existing one. The returned style is always unnamed. See Styles for more information.

The base-style argument must be a style within this style list.

( send a-style-list find-or-create-style |  | base-style |
|  | delta) |

→ ( is-a?/c style<%>)
base-style : ( is-a?/c style<%>)
delta : ( is-a?/c style-delta%)

Creates a new derived style, or finds an appropriate existing one. The returned style is always unnamed. See Styles for more information.

The base-style argument must be a style within this style list. If base-style is not a join style, if it has no name, and if its delta can be collapsed with delta (see collapse in style-delta%), then the collapsed delta is used in place of delta, and the base style of base-style is used in place of base-style; this collapsing and substitution of base styles is performed recursively.

( send a-style-list forget-notification key) → void?
key : any/c

See notify-on-change.

The key argument is the value returned by notify-on-change.

( send a-style-list index-to-style i)
→ ( or/c ( is-a?/c style<%>) false/c)
i : exact-nonnegative-integer?

Returns the style associated with the given index, or #f for a bad index. See also style-to-index.

( send a-style-list new-named-style |  | name |
|  | like-style) |

→ ( is-a?/c style<%>)
name : string?
like-style : ( is-a?/c style<%>)

Creates a new named style, unless the name is already being used.

If name is already being used, then like-style is ignored and the old style associated to the name is returned. Otherwise, a new style is created for name with the same characteristics (i.e., the same base style and same style delta or shift style) as like-style.

The like-style style must be in this style list, otherwise the named style is derived from the basic style with an empty style delta.

( send a-style-list notify-on-change f) → any/c
f : (( or/c ( is-a?/c style<%>) #f) . -> . any)

Attaches a callback to the style list. The callback is invoked whenever a style is modified.

Often, a change in one style will trigger a change in several other derived styles; to allow clients to handle all the changes in a batch, #f is passed in as the changing style after a set of styles has been processed.

The return value from notify-on-change is an opaque key to be used with forget-notification.

( send a-style-list number) → exact-nonnegative-integer?

Returns the number of styles in the list.

( send a-style-list replace-named-style |  | name |
|  | like-style) |

→ ( is-a?/c style<%>)
name : string?
like-style : ( is-a?/c style<%>)

Like new-named-style, except that if the name is already mapped to a style, the existing mapping is replaced.

( send a-style-list style-to-index style)
→ ( or/c exact-nonnegative-integer? false/c)
style : ( is-a?/c style<%>)

Returns the index for a particular style. The index for a style’s base style (and shift style, if it is a join style) is guaranteed to be lower than the style’s own index. (As a result, the root style’s index is always 0.) A style’s index can change whenever a new style is added to the list, or the base style or shift style of another style is changed.

If the given style is not in this list, #f is returned.
top← prev up next →