Previous Page Table of Contents Index Next Page

Palm OS SDK Reference


Palm Logo 20 UI Color List

This chapter provides information about the UI color list by discussing the following topics:

The header file UIColor.h declares the API that this chapter describes. For more information on the color list, see "Color and Grayscale Support" in the Palm OS Programmer's Companion.

UI Color Data Types

UIColorTableEntries

The UIColorTableEntries enum declares symbolic color constants for the various UI elements.

Do not confuse the UI color list with the system color table. The system color table (or system palette) defines all available colors for the display or draw window, whether they are in use or not. The UI color list defines the colors used to draw the interface objects.

typedef enum UIColorTableEntries {
    UIObjectFrame = 0,
    UIObjectFill,
    UIObjectForeground,
    UIObjectSelectedFill,
    UIObjectSelectedForeground,

    UIMenuFrame,
    UIMenuFill,
    UIMenuForeground,
    UIMenuSelectedFill,
    UIMenuSelectedForeground,

    UIFieldBackground,
    UIFieldText,
    UIFieldTextLines,
    UIFieldCaret,
    UIFieldTextHighlightBackground,
    UIFieldTextHighlightForeground,
    UIFieldFepRawText,
    UIFieldFepRawBackground,
    UIFieldFepConvertedText,
    UIFieldFepConvertedBackground,
    UIFieldFepUnderline,

    UIFormFrame,
    UIFormFill,

    UIDialogFrame,
    UIDialogFill,

    UIAlertFrame,
    UIAlertFill,

    UIOK,
    UICaution,
    UIWarning,

    UILastColorTableEntry
} UIColorTableEntries;

Field Descriptions

UIObjectFrame Color for the border of user interface objects (such as command buttons, push buttons, selector triggers, menus, arrows checkboxes, and other controls).
UIObjectFill The background color for a solid or "filled" user interface object.

Note that UI objects in tables use the UIField... colors instead of the UIObject... colors.
UIObjectForeground The color for foreground items (such as labels or graphics) in a user interface object.
UIObjectSelectedFill The background color of the currently selected user interface object, whether that object is solid or not.
UIObjectSelectedForeground The color of foreground items in a selected user interface object.
UIMenuFrame The color of the border around the menu.
UIMenuFill The background color of a menu item.
UIMenuForeground The color of the menu's text.
UIMenuSelectedFill The background color of a selected menu item.
UIMenuSelectedForeground The color of the text of a selected menu item.
UIFieldBackground The background color of an editable text field.
UIFieldText The color of the text in the editable field.
UIFieldTextLines The color of underlines in an editable field.
UIFieldCaret The color of the cursor in an editable text field.
UIFieldTextHighlightBackground The background color for selected text in an editable text field.
UIFieldTextHighlightForeground The color of the selected text in an editable text field.
UIFieldFepRawText Color used for unconverted text in the inline conversion area when a FEP is used as a text input method (for example, on Japanese devices).

If the FEP colors are identical to field colors, unconverted text has a solid underline.
UIFieldFepRawBackground The background color for unconverted text in the inline conversion area when a FEP is used as a text input method.

If the FEP colors are identical to field colors, unconverted text has a solid underline.
UIFieldFepConvertedText Color used for converted text in the inline conversion area when a FEP is used as a text input method (for example, on Japanese devices).

If the FEP colors are identical to field colors, converted text has a double-thick underline.
UIFieldFepConvertedBackground The background color used for converted text in the inline conversion area.

If the FEP colors are identical to field colors, converted text has a double-thick underline.
UIFieldFepUnderline The color used for underlines in the inline conversion area.
UIFormFrame The color of the border and titlebar on a form.
UIFormFill The background color of a form. White is recommended for this value.
UIDialogFrame The color of a border and titlebar on a modal form.
UIDialogFill The background color of a modal form.
UIAlertFrame The color of the border and titlebar on an alert panel.
UIAlertFill The background color of an alert panel.
UIOK The color for an informational icon.
UICaution The color for a caution icon.
UIWarning The color for a warning icon.

Palm OS® does not currently use the UIOK, UICaution, and UIWarning constants.
UILastColorTableEntry Placeholder to indicate end of enum.

Compatibility

Implemented only if 3.5 New Feature Set is present.

UI Color Functions




UIColorGetTableEntryIndex

Purpose

Return the index value for a UI color for the current system palette.

Prototype

IndexedColorType UIColorGetTableEntryIndex (UIColorTableEntries which)

Parameters

  -> which
One of the symbolic color constants. See UIColorTableEntries.

Result

Returns the system color table index of the color used for the specified symbolic color.

Comments

One way to find out the indexes of all the colors that the OS is using is to loop through the UI color list, calling UIColorGetTableEntryIndex for each slot, and keep a list (excluding duplicates).

IndexedColorType
    colorsUsed[UILastColorTableEntry];
UInt16 numColors = 0;
...
for (i = 0; i < UILastColorTableEntry; i++) {
    IndexedColorType currentColor;
    Boolean isNew = true;

    currentColor = UIColorGetTableEntryIndex(i);

    for (j = 0; ((j < numColors) && isNew); j++)
    if (colorsUsed[j] == currentColor)
    isNew = false; /* exit loop */
    if (isNew) {
    numColors++;
    colorsUsed[j] = currentColor;
    }

To get the RGB values of the colors, do the same thing but call UIColorGetTableEntryRGB.

Compatibility

Implemented only if 3.5 New Feature Set is present.

See Also

IndexedColorType, WinIndexToRGB



UIColorGetTableEntryRGB

Purpose

Return the RGB value for the UI color.

Prototype

void UIColorGetTableEntryRGB (UIColorTableEntries which, RGBColorType *rgbP)

Parameters

  -> which
One of the symbolic color constants. See UIColorTableEntries.
  <- rgbP
Pointer to an RGB color value corresponding to the current color used for the symbolic color. (See RGBColorType.)

Result

Returns nothing.

Comments

In general, it is more efficient to work with indexed color entries instead of RGB color entries.

Compatibility

Implemented only if 3.5 New Feature Set is present.

See Also

UIColorGetTableEntryIndex, WinRGBToIndex



UIColorSetTableEntry

Purpose

Change a value in the UI color list.

Prototype

Err UIColorSetTableEntry (UIColorTableEntries which, const RGBColorType *rgbP)

Parameters

  -> which
One of the symbolic color constants. See UIColorTableEntries.
  -> rgbP
The RGB value of the color that should be used for the specified UI object. (See RGBColorType.)

Result

Returns 0 upon success.

Comments

Sets the value of a UI color entry to the passed RGB value. Updates the index for that UI color entry to the current best fit for that RGB value according to the palette used by the current draw window.

It is best to use this function only if the draw window is currently onscreen. Otherwise, the best-fit algorithm may choose a color that is not available on the current screen.

See Also

WinIndexToRGB, UIColorGetTableEntryIndex, UIColorGetTableEntryRGB
 



Palm OS SDK Reference

  Previous Page Table of Contents Index Next Page  

This is page 22 of 85 in this book

Palm Computing Platform Development Zone
Copyright © 2000, Palm, Inc. All rights reserved.