Home Contents Index Summary Previous Next

B.4 Accessing Windows Colours

Colours may be created from their X11 names. The X11 name-table is in <pcehome>/lib/rgb.txt. In the Windows API, all colours described as RGB (Red, Green, Blue) tuples. This is no problem as XPCE also provides RGB colours. Note however that Win32 intensity is ranged 0..255, where the XPCE intensity is ranged 0..65535. This is true on all XPCE's platforms.

To provide access to the window-system colours as they can be obtained using the Win32 API function GetSysColor(), XPCE binds these colours to named colour objects. These colour objects are normally used in the XPCE resource file (<pcehome>/Defaults) to colour XPCE's controller objects according to the user's preferences.

If the name of the Windows API colours are COLOR_SOMETHING, the XPCE name is win_something. The full list is in table 10.

win_activeborder Active window border.
win_activecaption Active window caption.
win_appworkspace Background colour of (MDI) applications.
win_background Desktop.
win_btnface Face shading on push buttons.
win_btnshadow Edge shading on push buttons.
win_btntext Text on push buttons.
win_captiontext Text in caption and size box
win_graytext Grayed (disabled) text.
win_highlight Item(s) selected in a control.
win_highlighttext Text of item(s) selected in a control.
win_inactiveborder Inactive window border.
win_inactivecaption Inactive window caption.
win_inactivecaptiontext Color of text in an inactive caption.
win_menu Menu background.
win_menutext Text in menus.
win_scrollbar Scroll bar gray area.
win_shadow Color of automatic window shadows.
win_window Window background.
win_windowframe Window frame.
win_windowtext Text in windows.
Table 10 : Windows colour name mapping