]> git.saurik.com Git - wxWidgets.git/blob - src/motif/settings.cpp
Wait() doesn't cancel the thread any longer
[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 #ifdef __GNUG__
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 // 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.
36 static Widget but_setting_wid = NULL;
37
38 wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
39 {
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
46 switch (index)
47 {
48 case wxSYS_COLOUR_WINDOW:
49 {
50 return *wxWHITE;
51 }
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:
58 case wxSYS_COLOUR_MENUBAR:
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 {
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 }
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:
89 {
90 return *wxBLUE;
91 }
92 case wxSYS_COLOUR_BTNHIGHLIGHT:
93 case wxSYS_COLOUR_LISTBOX:
94 // case wxSYS_COLOUR_3DHIGHLIGHT: // Same as wxSYS_COLOUR_BTNHIGHLIGHT
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:
106 case wxSYS_COLOUR_BTNTEXT:
107 case wxSYS_COLOUR_INFOTEXT:
108 {
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 }
121 }
122 case wxSYS_COLOUR_HIGHLIGHTTEXT:
123 {
124 return *wxWHITE;
125 }
126 case wxSYS_COLOUR_INFOBK:
127 case wxSYS_COLOUR_APPWORKSPACE:
128 {
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 }
141 }
142
143 case wxSYS_COLOUR_HOTLIGHT:
144 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
145 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
146 case wxSYS_COLOUR_MENUHILIGHT:
147 // TODO
148 return wxColour("LIGHT GREY");
149
150 default:
151 case wxSYS_COLOUR_MAX:
152 wxFAIL_MSG( _T("unknown colour") );
153 }
154 return *wxWHITE;
155 }
156
157 wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
158 {
159 switch (index)
160 {
161 case wxSYS_SYSTEM_FIXED_FONT:
162 {
163 return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, FALSE);
164 break;
165 }
166 case wxSYS_DEVICE_DEFAULT_FONT:
167 case wxSYS_SYSTEM_FONT:
168 case wxSYS_DEFAULT_GUI_FONT:
169 default:
170 {
171 return wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, FALSE);
172 break;
173 }
174 }
175
176 return wxFont();
177 }
178
179 // Get a system metric, e.g. scrollbar size
180 int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
181 {
182 switch ( index)
183 {
184 case wxSYS_HSCROLL_Y:
185 case wxSYS_VSCROLL_X:
186 return 15;
187 case wxSYS_MOUSE_BUTTONS:
188 // TODO
189 case wxSYS_BORDER_X:
190 // TODO
191 case wxSYS_BORDER_Y:
192 // TODO
193 case wxSYS_CURSOR_X:
194 // TODO
195 case wxSYS_CURSOR_Y:
196 // TODO
197 case wxSYS_DCLICK_X:
198 // TODO
199 case wxSYS_DCLICK_Y:
200 // TODO
201 case wxSYS_DRAG_X:
202 // TODO
203 case wxSYS_DRAG_Y:
204 // TODO
205 case wxSYS_EDGE_X:
206 // TODO
207 case wxSYS_EDGE_Y:
208 // TODO
209 case wxSYS_HSCROLL_ARROW_X:
210 // TODO
211 case wxSYS_HSCROLL_ARROW_Y:
212 // TODO
213 case wxSYS_HTHUMB_X:
214 // TODO
215 case wxSYS_ICON_X:
216 // TODO
217 case wxSYS_ICON_Y:
218 // TODO
219 case wxSYS_ICONSPACING_X:
220 // TODO
221 case wxSYS_ICONSPACING_Y:
222 // TODO
223 case wxSYS_WINDOWMIN_X:
224 // TODO
225 case wxSYS_WINDOWMIN_Y:
226 // TODO
227 case wxSYS_SCREEN_X:
228 // TODO
229 case wxSYS_SCREEN_Y:
230 // TODO
231 case wxSYS_FRAMESIZE_X:
232 // TODO
233 case wxSYS_FRAMESIZE_Y:
234 // TODO
235 case wxSYS_SMALLICON_X:
236 // TODO
237 case wxSYS_SMALLICON_Y:
238 // TODO
239 case wxSYS_VSCROLL_ARROW_X:
240 // TODO
241 case wxSYS_VSCROLL_ARROW_Y:
242 // TODO
243 case wxSYS_VTHUMB_Y:
244 // TODO
245 case wxSYS_CAPTION_Y:
246 // TODO
247 case wxSYS_MENU_Y:
248 // TODO
249 case wxSYS_NETWORK_PRESENT:
250 // TODO
251 case wxSYS_PENWINDOWS_PRESENT:
252 // TODO
253 case wxSYS_SHOW_SOUNDS:
254 // TODO
255 case wxSYS_SWAP_BUTTONS:
256 // TODO
257 default:
258 ;
259 }
260
261 return 0;
262 }
263
264 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
265 {
266 switch (index)
267 {
268 case wxSYS_CAN_ICONIZE_FRAME:
269 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
270 return TRUE;
271
272 default:
273 return FALSE;
274 }
275 }