]> git.saurik.com Git - wxWidgets.git/blob - src/univ/colschem.cpp
Don't unselect if setting string that's not found
[wxWidgets.git] / src / univ / colschem.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/colschem.cpp
3 // Purpose: (trivial) wxColourScheme implementation
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 20.08.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ===========================================================================
13 // declarations
14 // ===========================================================================
15
16 // ---------------------------------------------------------------------------
17 // headers
18 // ---------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #ifndef WX_PRECOMP
28 #include "wx/settings.h"
29 #endif // WX_PRECOMP
30
31 #include "wx/univ/colschem.h"
32 #include "wx/univ/theme.h"
33
34 // ============================================================================
35 // implementation
36 // ============================================================================
37
38 // ----------------------------------------------------------------------------
39 // wxColourScheme
40 // ----------------------------------------------------------------------------
41
42 wxColourScheme::~wxColourScheme()
43 {
44 }
45
46 // ----------------------------------------------------------------------------
47 // wxSystemSettings
48 // ----------------------------------------------------------------------------
49
50 wxColour wxSystemSettings::GetColour(wxSystemColour index)
51 {
52 // the elements of this enum must be kept in sync with wxSystemColour
53 static const wxColourScheme::StdColour s_mapSysToThemeCol[] =
54 {
55 wxColourScheme::SCROLLBAR /* wxSYS_COLOUR_SCROLLBAR */,
56 wxColourScheme::WINDOW /* wxSYS_COLOUR_BACKGROUND */,
57 wxColourScheme::TITLEBAR_ACTIVE_TEXT /* wxSYS_COLOUR_ACTIVECAPTION */,
58 wxColourScheme::TITLEBAR_TEXT /* wxSYS_COLOUR_INACTIVECAPTION */,
59 wxColourScheme::MAX /* wxSYS_COLOUR_MENU */,
60 wxColourScheme::MAX /* wxSYS_COLOUR_WINDOW */,
61 wxColourScheme::MAX /* wxSYS_COLOUR_WINDOWFRAME */,
62 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_MENUTEXT */,
63 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_WINDOWTEXT */,
64 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_CAPTIONTEXT */,
65 wxColourScheme::MAX /* wxSYS_COLOUR_ACTIVEBORDER */,
66 wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVEBORDER */,
67 wxColourScheme::MAX /* wxSYS_COLOUR_APPWORKSPACE */,
68 wxColourScheme::HIGHLIGHT /* wxSYS_COLOUR_HIGHLIGHT */,
69 wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_HIGHLIGHTTEXT */,
70 wxColourScheme::CONTROL /* wxSYS_COLOUR_BTNFACE */,
71 wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_BTNSHADOW */,
72 wxColourScheme::CONTROL_TEXT_DISABLED /* wxSYS_COLOUR_GRAYTEXT */,
73 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_BTNTEXT */,
74 wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVECAPTIONTEXT */,
75 wxColourScheme::SHADOW_HIGHLIGHT /* wxSYS_COLOUR_BTNHIGHLIGHT */,
76 wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_3DDKSHADOW */,
77 wxColourScheme::SHADOW_OUT /* wxSYS_COLOUR_3DLIGHT */,
78 wxColourScheme::MAX /* wxSYS_COLOUR_INFOTEXT */,
79 wxColourScheme::MAX /* wxSYS_COLOUR_INFOBK */,
80 wxColourScheme::WINDOW /* wxSYS_COLOUR_LISTBOX */,
81 };
82
83 wxCHECK_MSG( index < (int)WXSIZEOF(s_mapSysToThemeCol), wxNullColour,
84 _T("invalid wxSystemColour") );
85
86 wxColourScheme::StdColour col = s_mapSysToThemeCol[index];
87 if ( col == wxColourScheme::MAX )
88 {
89 // we don't have theme-equivalent for this colour
90 return wxSystemSettingsNative::GetColour(index);
91 }
92
93 return wxTheme::Get()->GetColourScheme()->Get(col);
94 }