| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (4 out of 6)

Configuring a GMS Icon

gms-icon-specification

The attributes that control the color and scaling of a GMS icon are not part of the gms-highlightable-icon subclass that defines the icon. Defining them in the icon subclass would force every menu entry to use a given GMS icon class in the same way. To provide greater flexibility, the attributes that configure GMS icon appearance are defined separately by each template that uses the icon.

The necessary attributes could be specified in the template object itself, but this practice would burden every template with many attributes that typically are not needed. To prevent this:

  1. A template object has only one attribute that relates to icon configuration: Gms-inline-icon-description.

  2. A separate class, gms-icon-specification, defines all icon configuration attributes.

  3. A template that needs icon configuration includes a gms-icon-specification as the value of its Gms-inline-icon-description attribute.

  4. Attributes in the gms-icon-specification specify any special configuration applicable to the icon.

The instructions in this section tell you how to set up and access a gms-icon-specification.

To prepare to configure a menu entry's GMS icon:

  1. Open the table of the template object that defines the entry.

    The template's Gms-inline-icon-class attribute specifies the class of the icon. The template's Gms-inline-icon-description attribute has the value none.

  2. Click on the Gms-inline-icon-description attribute somewhere away from the current value of the attribute (none).

    A G2 menu appears.

  3. Select add optional-subtable > gms-icon-specification.

    The subtable of a gms-icon-specification appears.

  4. Edit subtable attributes as desired.

The value of Gms-inline-icon-description is now a gms-icon-specification.

To reconfigure a menu entry's GMS icon:

  1. Open the table of the template object that defines the entry.

    The template's Gms-inline-icon-class attribute specifies the class of the icon. The template's Gms-inline-icon-description attribute has the value a gms-icon-specification.

  2. Click on the Gms-inline-icon-description attribute.

    A G2 menu appears.

  3. Choose subtable

    The subtable of the gms-icon-specification appears.

  4. Edit subtable attributes as desired.

Attributes of a GMS Icon Specification

The attributes of a gms icon specification are shown in the following table:

Attribute Description
Gms-icon-subclasses-exist
Specifies if icon subclasses have been defined for use with the three font sizes which can be used in menus.
Allowable values:
true or false
Default value:
false
Notes:
For more information on subclassing icons see Providing Different Icons for Different Fonts.


Gms-maximize-icon
Controls font scaling by allowing GMS to enlarge an icon's size.
Allowable values:
true or false
Default value:
false


Gms-preserve-ratio
Controls font scaling by directing GMS to preserve the icon's aspect ratio when it scales the icon.
Allowable values:
true or false
Default value:
false


Gms-do-not-reduce-width
Controls font scaling by directing GMS to preserve the width of an icon that is too wide, and to make the menu entry wider as needed to contain the icon.
Allowable values:
true or false
Default value:
false


Gms-do-not-reduce-height
Controls font scaling by directing GMS to preserve the height of an icon that is too tall, and to make the menu entry taller as needed to contain the icon.
Allowable values:
true or false
Default value:
false


Gms-no-margin-for-check
Specifies if GMS should leave room on the left of the menu entry for a check mark, the default, or if that space can be used for the icon.
Allowable values:
true or false
Default value:
false
Notes:
For more information see Making Additional Room for an Icon.


Gms-icon-normal-color
Specifies the color of the icon's foreground layer in a menu entry that is enabled and not selected.
Allowable values:
Any G2 color
Default value:
none


Gms-icon-highlighted-color
Specifies the color of the icon's foreground layer in a selected menu entry.
Allowable values:
Any G2 color
Default value:
none


Gms-icon-disabled-color
Specifies the color of the icon's foreground layer in a disabled menu entry.
Allowable values:
Any G2 color
Default value:
none

The rest of this chapter refers to a gms-icon-specification as an icon configuration object, and assumes that such an object exists for each menu entry template for which icon configuration is needed.

Default Highlightable Icon Colors

If you use a highlightable icon in a menu entry, and do not do anything to specify the color(s) that its foreground layer(s) should have, GMS uses the text colors defined in the current User Preferences object.

When the menu entry is... GMS sets the foreground color to... Default...
Enabled but not selected
Gms-normal-text-color
black
Selected
Gms-highlighted-text-color
white
Disabled
Gms-disabled-text-color
gray

Specifying Highlightable Icon Colors

You can also specify foreground colors that differ from the text colors defined in the current User Preferences object.

To specify the color of the foreground layer(s) when an entry is enabled but not selected:

To specify the color of the foreground layer(s) when an entry is selected:

To specify the color of the foreground layer(s) when an entry is disabled:

Any or all of the colors you choose can be the same color. You can specify any icon color attribute as none (the default). GMS then defaults to the relevant text color, as listed in the previous table.

Other Uses for Highlightable Icons

You do not have to use the foreground color of a highlightable icon to indicate the menu entry state. For example, suppose you needed a menu that offered a choice of colors by showing examples of them. You could:

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (4 out of 6)

Copyright © 1997 Gensym Corporation, Inc.