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