]> git.saurik.com Git - wxWidgets.git/blame - src/univ/settingsuniv.cpp
wxMessageBox off the main thread lost result code.
[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
442b35b5 7// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 8// Licence: wxWindows licence
1e6feb95
VZ
9///////////////////////////////////////////////////////////////////////////////
10
11// ===========================================================================
12// declarations
13// ===========================================================================
14
15// ---------------------------------------------------------------------------
16// headers
17// ---------------------------------------------------------------------------
18
1e6feb95
VZ
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
9eddec69 27 #include "wx/settings.h"
123343b3 28 #include "wx/gdicmn.h"
1e6feb95
VZ
29#endif // WX_PRECOMP
30
31#include "wx/univ/colschem.h"
c7261948 32#include "wx/univ/theme.h"
d2f3b085 33#include "wx/univ/renderer.h"
1e6feb95
VZ
34
35// ============================================================================
36// implementation
37// ============================================================================
38
7516ed26
VZ
39// ----------------------------------------------------------------------------
40// wxSystemSettings
41// ----------------------------------------------------------------------------
42
43wxColour 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 */,
9c6d8b7c 60 wxColourScheme::FRAME /* wxSYS_COLOUR_APPWORKSPACE */,
7516ed26
VZ
61 wxColourScheme::HIGHLIGHT /* wxSYS_COLOUR_HIGHLIGHT */,
62 wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_HIGHLIGHTTEXT */,
1483041d 63 wxColourScheme::CONTROL /* wxSYS_COLOUR_BTNFACE */,
7516ed26
VZ
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 */,
1483041d 69 wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_3DDKSHADOW */,
7516ed26
VZ
70 wxColourScheme::SHADOW_OUT /* wxSYS_COLOUR_3DLIGHT */,
71 wxColourScheme::MAX /* wxSYS_COLOUR_INFOTEXT */,
72 wxColourScheme::MAX /* wxSYS_COLOUR_INFOBK */,
1483041d 73 wxColourScheme::WINDOW /* wxSYS_COLOUR_LISTBOX */,
81214330
VZ
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 */,
887b919b 80 wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT */
7516ed26
VZ
81 };
82
81214330
VZ
83 wxCOMPILE_TIME_ASSERT( WXSIZEOF(s_mapSysToThemeCol) == wxSYS_COLOUR_MAX,
84 StdColDefsMismatch );
85
c7261948 86 wxCHECK_MSG( index < (int)WXSIZEOF(s_mapSysToThemeCol), wxNullColour,
9a83f860 87 wxT("invalid wxSystemColour") );
7516ed26
VZ
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}
d2f3b085
VS
98
99int 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}