Release 940405
[wine/gsoc-2012-control.git] / windows / syscolor.c
blob80b69d5f0c4b19a695b7617518ee3427f6f9317d
1 /*
2 * Support for system colors
4 * Copyright David W. Metcalfe, 1993
5 * Copyright Alexandre Julliard, 1994
7 */
9 static char Copyright[] = "Copyright David W. Metcalfe, 1993";
10 static char Copyright2[] = "Copyright Alexandre Julliard, 1994";
12 #include <stdlib.h>
14 #include "windows.h"
17 static char * DefSysColors[] =
19 "Scrollbar", "224 224 224", /* COLOR_SCROLLBAR */
20 "Background", "192 192 192", /* COLOR_BACKGROUND */
21 "ActiveTitle", "0 64 128", /* COLOR_ACTIVECAPTION */
22 "InactiveTitle", "255 255 255", /* COLOR_INACTIVECAPTION */
23 "Menu", "0 255 255", /* COLOR_MENU */
24 "Window", "255 255 255", /* COLOR_WINDOW */
25 "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
26 "MenuText", "0 0 0", /* COLOR_MENUTEXT */
27 "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
28 "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
29 "ActiveBorder", "128 128 128", /* COLOR_ACTIVEBORDER */
30 "InactiveBorder", "255 255 255", /* COLOR_INACTIVEBORDER */
31 "AppWorkspace", "255 255 232", /* COLOR_APPWORKSPACE */
32 "Hilight", "166 202 240", /* COLOR_HIGHLIGHT */
33 "HilightText", "0 0 0", /* COLOR_HIGHLIGHTTEXT */
34 "ButtonFace", "192 192 192", /* COLOR_BTNFACE */
35 "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
36 "GrayText", "192 192 192", /* COLOR_GRAYTEXT */
37 "ButtonText", "0 0 0", /* COLOR_BTNTEXT */
38 "InactiveTitleText", "0 0 0", /* COLOR_INACTIVECAPTIONTEXT */
39 "ButtonHilight", "255 255 255" /* COLOR_BTNHIGHLIGHT */
42 #define NUM_SYS_COLORS (COLOR_BTNHIGHLIGHT+1)
44 static COLORREF SysColors[NUM_SYS_COLORS];
47 /*************************************************************************
48 * SYSCOLOR_Init
50 void SYSCOLOR_Init()
52 int i, r, g, b;
53 char **p;
54 char buffer[100];
56 for (i = 0, p = DefSysColors; i < NUM_SYS_COLORS; i++, p += 2)
58 GetProfileString( "colors", p[0], p[1], buffer, 100 );
59 if (!sscanf( buffer, " %d %d %d", &r, &g, &b )) r = g = b = 0;
60 SysColors[i] = RGB( r, g, b );
65 /*************************************************************************
66 * GetSysColor (USER.180)
69 COLORREF GetSysColor(short nIndex)
71 #ifdef DEBUG_SYSCOLOR
72 printf("System Color %d = %6x\n", nIndex, SysColors[nIndex]);
73 #endif
74 return SysColors[nIndex];
78 /*************************************************************************
79 * SetSysColors (USER.181)
82 void SetSysColors(int nChanges, LPINT lpSysColor, COLORREF *lpColorValues)
84 int i;
86 for (i = 0; i < nChanges; i++)
88 SysColors[lpSysColor[i]] = lpColorValues[i];
91 /* Send WM_SYSCOLORCHANGE message to all windows */
93 /* ................ */
95 /* Repaint affected portions of all visible windows */
97 /* ................ */