Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 4 - Window Manager / Window Manager Reference
Data Structures


The Window Color Table Record

The user controls the colors used for the window frame and text highlighting through the Color control panel. Ordinarily, your application doesn't override the user's color choices, which are stored in a default window color table. If you have some extraordinary need to control window colors, you can do so by defining window color tables for your application's windows.

The Window Manager maintains window color information tables in a data structure of type WinCTab.

You can define your own window color table and apply it to an existing window through the SetWinColor procedure.

To establish the window color table for a window when you create it, you provide
a window color table ('wctb') resource with the same resource ID as the 'WIND' resource that defines the window.

The WCTabPtr data type is a pointer to a window color table record, and the WTabHandle is a handle to a window color table record.

TYPE  WCTabPtr = ^WinCTab;
      WCTabHandle = ^WCTabPtr;
The WinCTab data type defines a window color table record.

TYPE  WinCTab = 
      RECORD
         wCSeed:     LongInt;    {reserved}
         wCReserved: Integer;    {reserved}
         ctSize:     Integer;    {number of entries in table -1}
         ctTable:    ARRAY[0..4] OF ColorSpec;
                                 {array of color specification }
                                 { records}
      END;
Field Description
wCSeed
Reserved.
wCReserved
Reserved.
ctSize
The number of entries in the table, minus 1. If you're building a color table for use with the standard window definition function, the maximum value of this field is 12. Custom window definition functions can use color tables of any size.
ctTable
An array of colorSpec records.
In a window color table, each colorSpec record specifies a window part in the first word and an RGB value in the other
three words:
               TYPE  ColorSpec =
                     RECORD
                        value:   Integer;    {part identifier}
                        rgb:     RGBColor;   {RGB value}
                     END;
The value field of a colorSpec record specifies a constant that defines which part of the window the color controls. For the window color table used by the standard window definition function, you can specify these values with these meanings:
               CONST
               wContentColor     = 0;  {content region background}
               wFrameColor       = 1;  {window outline}
               wTextColor        = 2;  {window title and button }
                                       { text}
               wHiliteColor      = 3;  {reserved}
               wTitleBarColor    = 4;  {reserved}
               wHiliteColorLight = 5;  {lightest stripes in }
                                       { title bar and lightest }
                                       { dimmed text}
               wHiliteColorDark  = 6;  {darkest stripes in }
                                       { title bar and }
                                       { darkest dimmed }
                                       { text}
               wTitleBarLight    = 7;  {lightest parts of }
                                       { title bar background}
               wTitleBarDark     = 8;  {darkest parts of }
                                       { title bar background}
               wDialogLight      = 9;  {lightest element }
                                       { of dialog box frame}
               wDialogDark       = 10; {darkest element of }
                                       { dialog box frame}
               wTingeLight       = 11; {lightest window tinging}
               wTingeDark        = 12; {darkest window tinging}
Note
The part codes in System 5 and System 6 are significantly different from the part codes described here, which apply only to System 7.
The window parts can appear in any order in the table.
The rgb field of a ColorSpec record contains three words of data that specify the red, green, and blue values of the color to be used. The RGBColor data type is defined in Inside Macintosh: Imaging.
When your application creates a window, the Window Manager first looks for a resource of type 'wctb' with the same resource ID as the 'WIND' resource used for the window. If it finds one, it creates a window color table for the window from the information in that resource, and then displays the window in those colors. If it doesn't find a window color table resource with the same resource ID as your window resource, the Window Manager uses the default system window color table, read into the heap during application startup.

After creating a window, you can change the entries in a window's window color table with the SetWinColor procedure, described on page 4-106.

See "The Window Color Table Resource" on page 4-119 for a description of the window color table resource.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996