]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: settings.cpp | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
f96aa4d9 RR |
5 | // Id: $Id$ |
6 | // Copyright: (c) 1998 Robert Roebling | |
c801d85f KB |
7 | // Licence: wxWindows licence |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | ||
11 | #ifdef __GNUG__ | |
12 | #pragma implementation "settings.h" | |
13 | #endif | |
14 | ||
15 | #include "wx/settings.h" | |
1ecc4d80 | 16 | #include "wx/debug.h" |
c801d85f KB |
17 | |
18 | /* | |
19 | #define wxSYS_COLOUR_SCROLLBAR 0 | |
20 | #define wxSYS_COLOUR_BACKGROUND 1 | |
21 | #define wxSYS_COLOUR_ACTIVECAPTION 2 | |
22 | #define wxSYS_COLOUR_INACTIVECAPTION 3 | |
23 | #define wxSYS_COLOUR_MENU 4 | |
24 | #define wxSYS_COLOUR_WINDOW 5 | |
25 | #define wxSYS_COLOUR_WINDOWFRAME 6 | |
26 | #define wxSYS_COLOUR_MENUTEXT 7 | |
27 | #define wxSYS_COLOUR_WINDOWTEXT 8 | |
28 | #define wxSYS_COLOUR_CAPTIONTEXT 9 | |
29 | #define wxSYS_COLOUR_ACTIVEBORDER 10 | |
30 | #define wxSYS_COLOUR_INACTIVEBORDER 11 | |
31 | #define wxSYS_COLOUR_APPWORKSPACE 12 | |
32 | #define wxSYS_COLOUR_HIGHLIGHT 13 | |
33 | #define wxSYS_COLOUR_HIGHLIGHTTEXT 14 | |
34 | #define wxSYS_COLOUR_BTNFACE 15 | |
35 | #define wxSYS_COLOUR_BTNSHADOW 16 | |
36 | #define wxSYS_COLOUR_GRAYTEXT 17 | |
37 | #define wxSYS_COLOUR_BTNTEXT 18 | |
38 | #define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19 | |
39 | #define wxSYS_COLOUR_BTNHIGHLIGHT 20 | |
40 | ||
41 | #define wxSYS_COLOUR_3DDKSHADOW 21 | |
42 | #define wxSYS_COLOUR_3DLIGHT 22 | |
43 | #define wxSYS_COLOUR_INFOTEXT 23 | |
44 | #define wxSYS_COLOUR_INFOBK 24 | |
45 | ||
46 | #define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND | |
47 | #define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE | |
48 | #define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW | |
49 | #define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT | |
50 | #define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT | |
51 | #define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT | |
52 | */ | |
53 | ||
54 | #define SHIFT (8*(sizeof(short int)-sizeof(char))) | |
55 | ||
c67daf87 UR |
56 | wxColour *g_systemBtnFaceColour = (wxColour *) NULL; |
57 | wxColour *g_systemBtnShadowColour = (wxColour *) NULL; | |
58 | wxColour *g_systemBtnHighlightColour = (wxColour *) NULL; | |
59 | wxColour *g_systemHighlightColour = (wxColour *) NULL; | |
c801d85f | 60 | |
c67daf87 | 61 | wxFont *g_systemFont = (wxFont *) NULL; |
a3622daa | 62 | |
1ecc4d80 RR |
63 | void wxSystemSettings::Done() |
64 | { | |
65 | wxDELETE(g_systemBtnFaceColour); | |
66 | wxDELETE(g_systemBtnShadowColour); | |
67 | wxDELETE(g_systemBtnHighlightColour); | |
68 | wxDELETE(g_systemHighlightColour); | |
69 | wxDELETE(g_systemFont); | |
a3622daa VZ |
70 | } |
71 | ||
c801d85f KB |
72 | wxColour wxSystemSettings::GetSystemColour( int index ) |
73 | { | |
74 | switch (index) | |
75 | { | |
76 | case wxSYS_COLOUR_SCROLLBAR: | |
77 | case wxSYS_COLOUR_BACKGROUND: | |
78 | case wxSYS_COLOUR_ACTIVECAPTION: | |
79 | case wxSYS_COLOUR_INACTIVECAPTION: | |
80 | case wxSYS_COLOUR_MENU: | |
81 | case wxSYS_COLOUR_WINDOW: | |
82 | case wxSYS_COLOUR_WINDOWFRAME: | |
83 | case wxSYS_COLOUR_ACTIVEBORDER: | |
84 | case wxSYS_COLOUR_INACTIVEBORDER: | |
85 | case wxSYS_COLOUR_BTNFACE: | |
86 | { | |
87 | GtkStyle *style = gtk_widget_get_default_style(); | |
88 | if (!g_systemBtnFaceColour) | |
89 | { | |
90 | g_systemBtnFaceColour = | |
91 | new wxColour( style->bg[0].red >> SHIFT, | |
92 | style->bg[0].green >> SHIFT, | |
93 | style->bg[0].blue >> SHIFT ); | |
ff7b1510 | 94 | } |
c801d85f | 95 | return *g_systemBtnFaceColour; |
ff7b1510 | 96 | } |
c801d85f KB |
97 | case wxSYS_COLOUR_BTNSHADOW: |
98 | { | |
99 | GtkStyle *style = gtk_widget_get_default_style(); | |
100 | if (!g_systemBtnShadowColour) | |
101 | { | |
102 | g_systemBtnShadowColour = | |
103 | new wxColour( style->dark[0].red >> SHIFT, | |
104 | style->dark[0].green >> SHIFT, | |
105 | style->dark[0].blue >> SHIFT ); | |
ff7b1510 | 106 | } |
c801d85f | 107 | return *g_systemBtnShadowColour; |
ff7b1510 | 108 | } |
c801d85f KB |
109 | case wxSYS_COLOUR_GRAYTEXT: |
110 | case wxSYS_COLOUR_BTNHIGHLIGHT: | |
111 | { | |
112 | GtkStyle *style = gtk_widget_get_default_style(); | |
113 | if (!g_systemBtnHighlightColour) | |
114 | { | |
115 | g_systemBtnHighlightColour = | |
116 | new wxColour( style->light[0].red >> SHIFT, | |
117 | style->light[0].green >> SHIFT, | |
118 | style->light[0].blue >> SHIFT ); | |
ff7b1510 | 119 | } |
c801d85f | 120 | return *g_systemBtnHighlightColour; |
ff7b1510 | 121 | } |
c801d85f KB |
122 | case wxSYS_COLOUR_HIGHLIGHT: |
123 | { | |
124 | GtkStyle *style = gtk_widget_get_default_style(); | |
125 | if (!g_systemHighlightColour) | |
126 | { | |
127 | g_systemHighlightColour = | |
128 | new wxColour( style->bg[GTK_STATE_SELECTED].red >> SHIFT, | |
129 | style->bg[GTK_STATE_SELECTED].green >> SHIFT, | |
130 | style->bg[GTK_STATE_SELECTED].blue >> SHIFT ); | |
ff7b1510 | 131 | } |
c801d85f | 132 | return *g_systemHighlightColour; |
ff7b1510 | 133 | } |
c801d85f KB |
134 | case wxSYS_COLOUR_MENUTEXT: |
135 | case wxSYS_COLOUR_WINDOWTEXT: | |
136 | case wxSYS_COLOUR_CAPTIONTEXT: | |
137 | case wxSYS_COLOUR_INACTIVECAPTIONTEXT: | |
138 | case wxSYS_COLOUR_INFOTEXT: | |
139 | { | |
140 | return *wxBLACK; | |
ff7b1510 | 141 | } |
c801d85f KB |
142 | case wxSYS_COLOUR_HIGHLIGHTTEXT: |
143 | { | |
144 | return *wxWHITE; | |
ff7b1510 | 145 | } |
c801d85f KB |
146 | case wxSYS_COLOUR_INFOBK: |
147 | case wxSYS_COLOUR_APPWORKSPACE: | |
148 | { | |
149 | return *wxWHITE; // ? | |
ff7b1510 RR |
150 | } |
151 | } | |
c801d85f | 152 | return *wxWHITE; |
ff7b1510 | 153 | } |
c801d85f | 154 | |
c801d85f KB |
155 | wxFont wxSystemSettings::GetSystemFont( int index ) |
156 | { | |
157 | switch (index) | |
158 | { | |
159 | case wxSYS_OEM_FIXED_FONT: | |
160 | case wxSYS_ANSI_FIXED_FONT: | |
161 | case wxSYS_SYSTEM_FIXED_FONT: | |
162 | { | |
163 | return *wxNORMAL_FONT; | |
ff7b1510 | 164 | } |
c801d85f KB |
165 | case wxSYS_ANSI_VAR_FONT: |
166 | case wxSYS_SYSTEM_FONT: | |
167 | case wxSYS_DEVICE_DEFAULT_FONT: | |
168 | case wxSYS_DEFAULT_GUI_FONT: | |
169 | { | |
170 | if (!g_systemFont) | |
0208334d | 171 | g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); |
c801d85f | 172 | return *g_systemFont; |
ff7b1510 RR |
173 | } |
174 | } | |
c801d85f KB |
175 | |
176 | return wxNullFont; | |
177 | } | |
c801d85f KB |
178 | |
179 | int wxSystemSettings::GetSystemMetric( int index ) | |
180 | { | |
1ecc4d80 RR |
181 | switch (index) |
182 | { | |
183 | case wxSYS_SCREEN_X: return gdk_screen_width(); | |
184 | case wxSYS_SCREEN_Y: return gdk_screen_height(); | |
185 | case wxSYS_HSCROLL_Y: return 15; | |
186 | case wxSYS_VSCROLL_X: return 15; | |
187 | } | |
188 | ||
189 | wxCHECK_MSG( index, 0, "wxSystemSettings::GetSystemMetric not fully implemented" ); | |
190 | ||
191 | return 0; | |
c67daf87 | 192 | } |