]> git.saurik.com Git - wxWidgets.git/blob - src/univ/colschem.cpp
memory leak fixed
[wxWidgets.git] / src / univ / colschem.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: 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 license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ===========================================================================
13 // declarations
14 // ===========================================================================
15
16 // ---------------------------------------------------------------------------
17 // headers
18 // ---------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "colschem.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #endif // WX_PRECOMP
33
34 #include "wx/settings.h"
35
36 #include "wx/univ/colschem.h"
37 #include "wx/univ/theme.h"
38
39 // ============================================================================
40 // implementation
41 // ============================================================================
42
43 // ----------------------------------------------------------------------------
44 // wxColourScheme
45 // ----------------------------------------------------------------------------
46
47 wxColourScheme::~wxColourScheme()
48 {
49 }
50
51 #ifdef wxHAS_SS_NATIVE
52
53 // ----------------------------------------------------------------------------
54 // wxSystemSettings
55 // ----------------------------------------------------------------------------
56
57 wxColour wxSystemSettings::GetColour(wxSystemColour index)
58 {
59 // the elements of this enum must be kept in sync with wxSystemColour
60 static const wxColourScheme::StdColour s_mapSysToThemeCol[] =
61 {
62 wxColourScheme::SCROLLBAR /* wxSYS_COLOUR_SCROLLBAR */,
63 wxColourScheme::WINDOW /* wxSYS_COLOUR_BACKGROUND */,
64 wxColourScheme::TITLEBAR_ACTIVE_TEXT /* wxSYS_COLOUR_ACTIVECAPTION */,
65 wxColourScheme::TITLEBAR_TEXT /* wxSYS_COLOUR_INACTIVECAPTION */,
66 wxColourScheme::MAX /* wxSYS_COLOUR_MENU */,
67 wxColourScheme::MAX /* wxSYS_COLOUR_WINDOW */,
68 wxColourScheme::MAX /* wxSYS_COLOUR_WINDOWFRAME */,
69 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_MENUTEXT */,
70 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_WINDOWTEXT */,
71 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_CAPTIONTEXT */,
72 wxColourScheme::MAX /* wxSYS_COLOUR_ACTIVEBORDER */,
73 wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVEBORDER */,
74 wxColourScheme::MAX /* wxSYS_COLOUR_APPWORKSPACE */,
75 wxColourScheme::HIGHLIGHT /* wxSYS_COLOUR_HIGHLIGHT */,
76 wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_HIGHLIGHTTEXT */,
77 wxColourScheme::SCROLLBAR /* wxSYS_COLOUR_BTNFACE */,
78 wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_BTNSHADOW */,
79 wxColourScheme::CONTROL_TEXT_DISABLED /* wxSYS_COLOUR_GRAYTEXT */,
80 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_BTNTEXT */,
81 wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVECAPTIONTEXT */,
82 wxColourScheme::SHADOW_HIGHLIGHT /* wxSYS_COLOUR_BTNHIGHLIGHT */,
83 wxColourScheme::SHADOW_IN /* wxSYS_COLOUR_3DDKSHADOW */,
84 wxColourScheme::SHADOW_OUT /* wxSYS_COLOUR_3DLIGHT */,
85 wxColourScheme::MAX /* wxSYS_COLOUR_INFOTEXT */,
86 wxColourScheme::MAX /* wxSYS_COLOUR_INFOBK */,
87 wxColourScheme::CONTROL /* wxSYS_COLOUR_LISTBOX */,
88 };
89
90 wxCHECK_MSG( index < (int)WXSIZEOF(s_mapSysToThemeCol), wxNullColour,
91 _T("invalid wxSystemColour") );
92
93 wxColourScheme::StdColour col = s_mapSysToThemeCol[index];
94 if ( col == wxColourScheme::MAX )
95 {
96 // we don't have theme-equivalent for this colour
97 return wxSystemSettingsNative::GetColour(index);
98 }
99
100 return wxTheme::Get()->GetColourScheme()->Get(col);
101 }
102
103 #endif // wxHAS_SS_NATIVE
104