2 Copyright (c) 1991-1999 Matra Datavision
3 Copyright (c) 1999-2014 OPEN CASCADE SAS
5 This file is part of Open CASCADE Technology software library.
7 This library is free software; you can redistribute it and/or modify it under
8 the terms of the GNU Lesser General Public License version 2.1 as published
9 by the Free Software Foundation, with special exception defined in the file
10 OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 distribution for complete text of the license and disclaimer of any warranty.
13 Alternatively, this file may be used under the terms of Open CASCADE
14 commercial license or contractual agreement.
19 int _a_horreur_du_vide_a_la_compilation;
26 #pragma comment( lib, "user32.lib" )
27 #pragma comment( lib, "gdi32.lib" )
30 # define NB_STATIC_COLORS ( COLOR_INFOBK - COLOR_SCROLLBAR + 1 )
32 # define NB_STATIC_COLORS ( COLOR_BTNHIGHLIGHT - COLOR_SCROLLBAR + 1 )
33 #endif /* WINVER . . . */
35 #define BLACK RGB( 0, 0, 0 )
36 #define WHITE RGB( 255, 255, 255 )
38 static int s_sysPalIdx[ NB_STATIC_COLORS ] = {
43 COLOR_INACTIVECAPTION,
59 COLOR_INACTIVECAPTIONTEXT,
66 #endif /* WINVER . . . */
69 static COLORREF s_sysPalBW[ NB_STATIC_COLORS ] = {
71 WHITE, /* COLOR_SCROLLBAR */
72 BLACK, /* COLOR_BACKGROUND */
73 BLACK, /* COLOR_ACTIVECAPTION */
74 WHITE, /* COLOR_INACTIVECAPTION */
75 WHITE, /* COLOR_MENU */
76 WHITE, /* COLOR_WINDOW */
77 BLACK, /* COLOR_WINDOWFRAME */
78 BLACK, /* COLOR_MENUTEXT */
79 BLACK, /* COLOR_WINDOWTEXT */
80 WHITE, /* COLOR_CAPTIONTEXT */
81 WHITE, /* COLOR_ACTIVEBORDER */
82 WHITE, /* COLOR_INACTIVEBORDER */
83 WHITE, /* COLOR_APPWORKSPACE */
84 BLACK, /* COLOR_HIGHLIGHT */
85 WHITE, /* COLOR_HIGHLIGHTTEXT */
86 WHITE, /* COLOR_BTNFACE */
87 BLACK, /* COLOR_BTNSHADOW */
88 BLACK, /* COLOR_GRAYTEXT */
89 BLACK, /* COLOR_BTNTEXT */
90 BLACK, /* COLOR_INACTIVECAPTIONTEXT */
91 BLACK /* COLOR_BTNHIGHLIGHT */
93 ,BLACK, /* BLACKCOLOR_3DDKSHADOW */
94 BLACK, /* COLOR_3DLIGHT */
95 BLACK, /* COLOR_INFOTEXT */
96 BLACK /* COLOR_INFOBK */
97 #endif /* WINVER . . . */
100 static BOOL s_sysUse;
101 static COLORREF s_sysPal[ NB_STATIC_COLORS ];
103 __declspec( dllexport ) long InterfaceGraphic_RealizePalette ( HDC hdc, HPALETTE hPal, BOOL fBkg, BOOL fUseStatic ) {
112 for ( i = 0; i < NB_STATIC_COLORS; ++i ) s_sysPal[ i ] = GetSysColor ( s_sysPalIdx[ i ] );
114 SetSystemPaletteUse ( hdc, fBkg ? SYSPAL_STATIC : SYSPAL_NOSTATIC );
116 if ( UnrealizeObject ( hPal ) && SelectPalette ( hdc, hPal, fBkg ) ) retVal = RealizePalette ( hdc );
120 SetSysColors ( NB_STATIC_COLORS, s_sysPalIdx, s_sysPal );
125 SetSysColors ( NB_STATIC_COLORS, s_sysPalIdx, s_sysPalBW );
130 #pragma warning(push)
131 #pragma warning(disable:4306) /* level 4 warning on cast of int to HWND in HWND_BROADCAST macro */
132 PostMessage ( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0 );
137 SelectPalette ( hdc, hPal, FALSE );
138 retVal = RealizePalette ( hdc );
143 } // end RealizePaletteNow