]> git.saurik.com Git - wxWidgets.git/blob - src/univ/settingsuniv.cpp
Don't check for tr1/type_traits in configure if type_traits was found.
[wxWidgets.git] / src / univ / settingsuniv.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/settingsuniv.cpp
3 // Purpose: wxSystemSettings wxUniv-specific parts
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 20.08.00
7 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // ===========================================================================
12 // declarations
13 // ===========================================================================
14
15 // ---------------------------------------------------------------------------
16 // headers
17 // ---------------------------------------------------------------------------
18
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #ifndef WX_PRECOMP
27 #include "wx/settings.h"
28 #include "wx/gdicmn.h"
29 #endif // WX_PRECOMP
30
31 #include "wx/univ/colschem.h"
32 #include "wx/univ/theme.h"
33 #include "wx/univ/renderer.h"
34
35 // ============================================================================
36 // implementation
37 // ============================================================================
38
39 // ----------------------------------------------------------------------------
40 // wxSystemSettings
41 // ----------------------------------------------------------------------------
42
43 wxColour wxSystemSettings::GetColour(wxSystemColour index)
44 {
45 // the elements of this enum must be kept in sync with wxSystemColour
46 static const wxColourScheme::StdColour s_mapSysToThemeCol[] =
47 {
48 wxColourScheme::SCROLLBAR /* wxSYS_COLOUR_SCROLLBAR */,
49 wxColourScheme::WINDOW /* wxSYS_COLOUR_BACKGROUND */,
50 wxColourScheme::TITLEBAR_ACTIVE_TEXT /* wxSYS_COLOUR_ACTIVECAPTION */,
51 wxColourScheme::TITLEBAR_TEXT /* wxSYS_COLOUR_INACTIVECAPTION */,
52 wxColourScheme::MAX /* wxSYS_COLOUR_MENU */,
53 wxColourScheme::MAX /* wxSYS_COLOUR_WINDOW */,
54 wxColourScheme::MAX /* wxSYS_COLOUR_WINDOWFRAME */,
55 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_MENUTEXT */,
56 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_WINDOWTEXT */,
57 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_CAPTIONTEXT */,
58 wxColourScheme::MAX /* wxSYS_COLOUR_ACTIVEBORDER */,
59 wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVEBORDER */,
60 wxColourScheme::FRAME /* wxSYS_COLOUR_APPWORKSPACE */,
61 wxColourScheme::HIGHLIGHT /* wxSYS_COLOUR_HIGHLIGHT */,
62 wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_HIGHLIGHTTEXT */,
63 wxColourScheme::CONTROL /* wxSYS_COLOUR_BTNFACE */,
64 wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_BTNSHADOW */,
65 wxColourScheme::CONTROL_TEXT_DISABLED /* wxSYS_COLOUR_GRAYTEXT */,
66 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_BTNTEXT */,
67 wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVECAPTIONTEXT */,
68 wxColourScheme::SHADOW_HIGHLIGHT /* wxSYS_COLOUR_BTNHIGHLIGHT */,
69 wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_3DDKSHADOW */,
70 wxColourScheme::SHADOW_OUT /* wxSYS_COLOUR_3DLIGHT */,
71 wxColourScheme::MAX /* wxSYS_COLOUR_INFOTEXT */,
72 wxColourScheme::MAX /* wxSYS_COLOUR_INFOBK */,
73 wxColourScheme::WINDOW /* wxSYS_COLOUR_LISTBOX */,
74 wxColourScheme::MAX /* wxSYS_COLOUR_HOTLIGHT */,
75 wxColourScheme::TITLEBAR_ACTIVE_TEXT /* wxSYS_COLOUR_GRADIENTACTIVECAPTION */,
76 wxColourScheme::TITLEBAR_TEXT /* wxSYS_COLOUR_GRADIENTINACTIVECAPTION */,
77 wxColourScheme::MAX /* wxSYS_COLOUR_MENUHILIGHT */,
78 wxColourScheme::MAX /* wxSYS_COLOUR_MENUBAR */,
79 wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_LISTBOXTEXT */,
80 wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT */
81 };
82
83 wxCOMPILE_TIME_ASSERT( WXSIZEOF(s_mapSysToThemeCol) == wxSYS_COLOUR_MAX,
84 StdColDefsMismatch );
85
86 wxCHECK_MSG( index < (int)WXSIZEOF(s_mapSysToThemeCol), wxNullColour,
87 wxT("invalid wxSystemColour") );
88
89 wxColourScheme::StdColour col = s_mapSysToThemeCol[index];
90 if ( col == wxColourScheme::MAX )
91 {
92 // we don't have theme-equivalent for this colour
93 return wxSystemSettingsNative::GetColour(index);
94 }
95
96 return wxTheme::Get()->GetColourScheme()->Get(col);
97 }
98
99 int wxSystemSettings::GetMetric(wxSystemMetric index, wxWindow *win)
100 {
101 switch ( index )
102 {
103 case wxSYS_VSCROLL_X:
104 return wxTheme::Get()->GetRenderer()->GetScrollbarArrowSize().x;
105 case wxSYS_HSCROLL_Y:
106 return wxTheme::Get()->GetRenderer()->GetScrollbarArrowSize().y;
107
108 default:
109 return wxSystemSettingsNative::GetMetric(index, win);
110 }
111 }