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