]> git.saurik.com Git - wxWidgets.git/blame - src/motif/settings.cpp
try to create smaller executables
[wxWidgets.git] / src / motif / settings.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
0af4b6e4 2// Name: motif/settings.cpp
4bb6408c
JS
3// Purpose: wxSettings
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
0af4b6e4 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
16c1f7f3
JS
12// TODO: these settings should probably be configurable from some central or
13// per-user file, which can be edited using a Windows-control-panel clone.
14// Also they should be documented better. Some are very MS Windows-ish.
15
4bb6408c
JS
16#ifdef __GNUG__
17#pragma implementation "settings.h"
18#endif
19
20#include "wx/settings.h"
e97f20a0 21#include "wx/gdicmn.h"
edc1cd8b
JS
22#include "wx/app.h"
23
24#ifdef __VMS__
25#pragma message disable nosimpint
26#endif
27#include <Xm/Xm.h>
28#include <Xm/PushB.h>
29#ifdef __VMS__
30#pragma message enable nosimpint
31#endif
32
33// To correctly read the resources from the database, we create a
34// sample widget. This has the application shell as the parent and
35// so will be destroyed when the applicaion is closed.
36static Widget but_setting_wid = NULL;
4bb6408c 37
a103111b 38wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
4bb6408c 39{
edc1cd8b
JS
40 if (NULL == but_setting_wid && wxTheApp && wxTheApp->GetTopLevelWidget())
41 {
42 but_setting_wid = XtVaCreateWidget("settings_button", xmPushButtonWidgetClass,
43 (Widget)wxTheApp->GetTopLevelWidget(), NULL);
44 }
45
e97f20a0
JS
46 switch (index)
47 {
3d1b4196
MB
48 case wxSYS_COLOUR_WINDOW:
49 {
50 return *wxWHITE;
51 }
e97f20a0
JS
52 case wxSYS_COLOUR_SCROLLBAR:
53 // case wxSYS_COLOUR_DESKTOP: // Same as wxSYS_COLOUR_BACKGROUND
54 case wxSYS_COLOUR_BACKGROUND:
55 case wxSYS_COLOUR_ACTIVECAPTION:
56 case wxSYS_COLOUR_INACTIVECAPTION:
57 case wxSYS_COLOUR_MENU:
edc1cd8b 58 case wxSYS_COLOUR_MENUBAR:
e97f20a0
JS
59 case wxSYS_COLOUR_WINDOWFRAME:
60 case wxSYS_COLOUR_ACTIVEBORDER:
61 case wxSYS_COLOUR_INACTIVEBORDER:
62 case wxSYS_COLOUR_BTNFACE:
63 // case wxSYS_COLOUR_3DFACE: // Same as wxSYS_COLOUR_BTNFACE
64 case wxSYS_COLOUR_GRAYTEXT:
65 {
edc1cd8b
JS
66 if (but_setting_wid)
67 {
68 XColor bg;
69 XtVaGetValues(but_setting_wid,
70 XtVaTypedArg, XmNbackground, XtRColor, &bg, sizeof(bg),
71 NULL);
72 return wxColor(bg.red >> 8, bg.green >> 8, bg.blue >> 8);
73 }
74 else
75 {
76 return wxColour("LIGHT GREY");
77 }
e97f20a0
JS
78 }
79 case wxSYS_COLOUR_BTNSHADOW:
80 // case wxSYS_COLOUR_3DSHADOW: // Same as wxSYS_COLOUR_BTNSHADOW
81 {
82 return wxColour("GREY");
83 }
84 case wxSYS_COLOUR_3DDKSHADOW:
85 {
86 return *wxBLACK;
87 }
88 case wxSYS_COLOUR_HIGHLIGHT:
3d1b4196
MB
89 {
90 return *wxBLUE;
91 }
e97f20a0 92 case wxSYS_COLOUR_BTNHIGHLIGHT:
a103111b
GD
93 case wxSYS_COLOUR_LISTBOX:
94 // case wxSYS_COLOUR_3DHIGHLIGHT: // Same as wxSYS_COLOUR_BTNHIGHLIGHT
e97f20a0
JS
95 {
96 return *wxWHITE;
97 }
98 case wxSYS_COLOUR_3DLIGHT:
99 {
100 return wxColour("LIGHT GREY");
101 }
102 case wxSYS_COLOUR_MENUTEXT:
103 case wxSYS_COLOUR_WINDOWTEXT:
104 case wxSYS_COLOUR_CAPTIONTEXT:
105 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
a103111b 106 case wxSYS_COLOUR_BTNTEXT:
e97f20a0
JS
107 case wxSYS_COLOUR_INFOTEXT:
108 {
edc1cd8b
JS
109 if (but_setting_wid)
110 {
111 XColor fg;
112 XtVaGetValues(but_setting_wid,
113 XtVaTypedArg, XmNforeground, XtRColor, &fg, sizeof(fg),
114 NULL);
115 return wxColor(fg.red >> 8, fg.green >> 8, fg.blue >> 8);
116 }
117 else
118 {
119 return *wxBLACK;
120 }
e97f20a0
JS
121 }
122 case wxSYS_COLOUR_HIGHLIGHTTEXT:
123 {
3d1b4196 124 return *wxWHITE;
e97f20a0
JS
125 }
126 case wxSYS_COLOUR_INFOBK:
127 case wxSYS_COLOUR_APPWORKSPACE:
128 {
edc1cd8b
JS
129 if (but_setting_wid)
130 {
131 XColor bg;
132 XtVaGetValues(but_setting_wid,
133 XtVaTypedArg, XmNbackground, XtRColor, &bg, sizeof(bg),
134 NULL);
135 return wxColor(bg.red >> 8, bg.green >> 8, bg.blue >> 8);
136 }
137 else
138 {
139 return wxColour("LIGHT GREY");
140 }
e97f20a0 141 }
1abfd7f3
VZ
142
143 case wxSYS_COLOUR_HOTLIGHT:
144 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
145 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
146 case wxSYS_COLOUR_MENUHILIGHT:
1abfd7f3
VZ
147 // TODO
148 return wxColour("LIGHT GREY");
149
150 default:
151 case wxSYS_COLOUR_MAX:
152 wxFAIL_MSG( _T("unknown colour") );
e97f20a0
JS
153 }
154 return *wxWHITE;
4bb6408c
JS
155}
156
a103111b 157wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
4bb6408c 158{
16c1f7f3
JS
159 switch (index)
160 {
16c1f7f3
JS
161 case wxSYS_SYSTEM_FIXED_FONT:
162 {
e97f20a0 163 return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, FALSE);
16c1f7f3
JS
164 break;
165 }
e97f20a0 166 case wxSYS_DEVICE_DEFAULT_FONT:
16c1f7f3 167 case wxSYS_SYSTEM_FONT:
16c1f7f3 168 case wxSYS_DEFAULT_GUI_FONT:
e97f20a0 169 default:
16c1f7f3 170 {
e97f20a0 171 return wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, FALSE);
16c1f7f3
JS
172 break;
173 }
174 }
175
4bb6408c
JS
176 return wxFont();
177}
178
179// Get a system metric, e.g. scrollbar size
a103111b 180int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
4bb6408c 181{
0af4b6e4
VZ
182 switch ( index)
183 {
4bb6408c
JS
184 case wxSYS_MOUSE_BUTTONS:
185 // TODO
4bb6408c
JS
186 case wxSYS_BORDER_X:
187 // TODO
4bb6408c
JS
188 case wxSYS_BORDER_Y:
189 // TODO
4bb6408c
JS
190 case wxSYS_CURSOR_X:
191 // TODO
4bb6408c
JS
192 case wxSYS_CURSOR_Y:
193 // TODO
4bb6408c
JS
194 case wxSYS_DCLICK_X:
195 // TODO
4bb6408c
JS
196 case wxSYS_DCLICK_Y:
197 // TODO
4bb6408c
JS
198 case wxSYS_DRAG_X:
199 // TODO
4bb6408c
JS
200 case wxSYS_DRAG_Y:
201 // TODO
4bb6408c
JS
202 case wxSYS_EDGE_X:
203 // TODO
4bb6408c
JS
204 case wxSYS_EDGE_Y:
205 // TODO
4bb6408c
JS
206 case wxSYS_HSCROLL_ARROW_X:
207 // TODO
4bb6408c
JS
208 case wxSYS_HSCROLL_ARROW_Y:
209 // TODO
4bb6408c
JS
210 case wxSYS_HTHUMB_X:
211 // TODO
4bb6408c
JS
212 case wxSYS_ICON_X:
213 // TODO
4bb6408c
JS
214 case wxSYS_ICON_Y:
215 // TODO
4bb6408c
JS
216 case wxSYS_ICONSPACING_X:
217 // TODO
4bb6408c
JS
218 case wxSYS_ICONSPACING_Y:
219 // TODO
4bb6408c
JS
220 case wxSYS_WINDOWMIN_X:
221 // TODO
4bb6408c
JS
222 case wxSYS_WINDOWMIN_Y:
223 // TODO
4bb6408c
JS
224 case wxSYS_SCREEN_X:
225 // TODO
4bb6408c
JS
226 case wxSYS_SCREEN_Y:
227 // TODO
4bb6408c
JS
228 case wxSYS_FRAMESIZE_X:
229 // TODO
4bb6408c
JS
230 case wxSYS_FRAMESIZE_Y:
231 // TODO
4bb6408c
JS
232 case wxSYS_SMALLICON_X:
233 // TODO
4bb6408c
JS
234 case wxSYS_SMALLICON_Y:
235 // TODO
4bb6408c
JS
236 case wxSYS_HSCROLL_Y:
237 // TODO
4bb6408c
JS
238 case wxSYS_VSCROLL_X:
239 // TODO
4bb6408c
JS
240 case wxSYS_VSCROLL_ARROW_X:
241 // TODO
4bb6408c
JS
242 case wxSYS_VSCROLL_ARROW_Y:
243 // TODO
4bb6408c
JS
244 case wxSYS_VTHUMB_Y:
245 // TODO
4bb6408c
JS
246 case wxSYS_CAPTION_Y:
247 // TODO
4bb6408c
JS
248 case wxSYS_MENU_Y:
249 // TODO
4bb6408c
JS
250 case wxSYS_NETWORK_PRESENT:
251 // TODO
4bb6408c
JS
252 case wxSYS_PENWINDOWS_PRESENT:
253 // TODO
4bb6408c
JS
254 case wxSYS_SHOW_SOUNDS:
255 // TODO
4bb6408c
JS
256 case wxSYS_SWAP_BUTTONS:
257 // TODO
a103111b 258 default:
0af4b6e4 259 ;
a103111b 260 }
0af4b6e4
VZ
261
262 return 0;
4bb6408c
JS
263}
264
a103111b 265bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
266{
267 switch (index)
268 {
0af4b6e4 269 case wxSYS_CAN_ICONIZE_FRAME:
253293c1 270 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
a103111b 271 return TRUE;
0af4b6e4 272
253293c1
VS
273 default:
274 return FALSE;
275 }
276}