1 /////////////////////////////////////////////////////////////////////////////
2 // Name: motif/settings.cpp
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
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.
16 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma implementation "settings.h"
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
23 #include "wx/settings.h"
24 #include "wx/gdicmn.h"
28 #pragma message disable nosimpint
33 #pragma message enable nosimpint
36 #include "wx/x11/privx.h"
38 // To correctly read the resources from the database, we create a
39 // sample widget. This has the application shell as the parent and
40 // so will be destroyed when the applicaion is closed.
41 static Widget but_setting_wid
= NULL
;
43 wxColour
wxSystemSettingsNative::GetColour(wxSystemColour index
)
45 if (NULL
== but_setting_wid
&& wxTheApp
&& wxTheApp
->GetTopLevelWidget())
47 but_setting_wid
= XtVaCreateWidget("settings_button", xmPushButtonWidgetClass
,
48 (Widget
)wxTheApp
->GetTopLevelWidget(), NULL
);
53 case wxSYS_COLOUR_WINDOW
:
57 case wxSYS_COLOUR_SCROLLBAR
:
58 // case wxSYS_COLOUR_DESKTOP: // Same as wxSYS_COLOUR_BACKGROUND
59 case wxSYS_COLOUR_BACKGROUND
:
60 case wxSYS_COLOUR_ACTIVECAPTION
:
61 case wxSYS_COLOUR_INACTIVECAPTION
:
62 case wxSYS_COLOUR_MENU
:
63 case wxSYS_COLOUR_MENUBAR
:
64 case wxSYS_COLOUR_WINDOWFRAME
:
65 case wxSYS_COLOUR_ACTIVEBORDER
:
66 case wxSYS_COLOUR_INACTIVEBORDER
:
67 case wxSYS_COLOUR_BTNFACE
:
68 // case wxSYS_COLOUR_3DFACE: // Same as wxSYS_COLOUR_BTNFACE
69 case wxSYS_COLOUR_GRAYTEXT
:
74 XtVaGetValues(but_setting_wid
,
75 XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
),
77 return wxColor(bg
.red
>> 8, bg
.green
>> 8, bg
.blue
>> 8);
81 return wxColour("LIGHT GREY");
84 case wxSYS_COLOUR_BTNSHADOW
:
85 // case wxSYS_COLOUR_3DSHADOW: // Same as wxSYS_COLOUR_BTNSHADOW
87 return wxColour("GREY");
89 case wxSYS_COLOUR_3DDKSHADOW
:
93 case wxSYS_COLOUR_HIGHLIGHT
:
97 case wxSYS_COLOUR_BTNHIGHLIGHT
:
98 case wxSYS_COLOUR_LISTBOX
:
99 // case wxSYS_COLOUR_3DHIGHLIGHT: // Same as wxSYS_COLOUR_BTNHIGHLIGHT
103 case wxSYS_COLOUR_3DLIGHT
:
105 return wxColour("LIGHT GREY");
107 case wxSYS_COLOUR_MENUTEXT
:
108 case wxSYS_COLOUR_WINDOWTEXT
:
109 case wxSYS_COLOUR_CAPTIONTEXT
:
110 case wxSYS_COLOUR_INACTIVECAPTIONTEXT
:
111 case wxSYS_COLOUR_BTNTEXT
:
112 case wxSYS_COLOUR_INFOTEXT
:
117 XtVaGetValues(but_setting_wid
,
118 XtVaTypedArg
, XmNforeground
, XtRColor
, &fg
, sizeof(fg
),
120 return wxColor(fg
.red
>> 8, fg
.green
>> 8, fg
.blue
>> 8);
127 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
131 case wxSYS_COLOUR_INFOBK
:
132 case wxSYS_COLOUR_APPWORKSPACE
:
137 XtVaGetValues(but_setting_wid
,
138 XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
),
140 return wxColor(bg
.red
>> 8, bg
.green
>> 8, bg
.blue
>> 8);
144 return wxColour("LIGHT GREY");
148 case wxSYS_COLOUR_HOTLIGHT
:
149 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
150 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
151 case wxSYS_COLOUR_MENUHILIGHT
:
153 return wxColour("LIGHT GREY");
156 case wxSYS_COLOUR_MAX
:
157 wxFAIL_MSG( _T("unknown colour") );
162 wxFont
wxSystemSettingsNative::GetFont(wxSystemFont index
)
166 case wxSYS_SYSTEM_FIXED_FONT
:
168 return wxFont(12, wxMODERN
, wxNORMAL
, wxNORMAL
, FALSE
);
171 case wxSYS_DEVICE_DEFAULT_FONT
:
172 case wxSYS_SYSTEM_FONT
:
173 case wxSYS_DEFAULT_GUI_FONT
:
176 return wxFont(12, wxSWISS
, wxNORMAL
, wxNORMAL
, FALSE
);
184 // Get a system metric, e.g. scrollbar size
185 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
)
187 int return_value
= 0;
191 case wxSYS_HSCROLL_Y
:
192 case wxSYS_VSCROLL_X
:
194 case wxSYS_MOUSE_BUTTONS
:
216 case wxSYS_HSCROLL_ARROW_X
:
218 case wxSYS_HSCROLL_ARROW_Y
:
226 case wxSYS_ICONSPACING_X
:
228 case wxSYS_ICONSPACING_Y
:
230 case wxSYS_WINDOWMIN_X
:
232 case wxSYS_WINDOWMIN_Y
:
235 return_value
= DisplayWidth( wxGlobalDisplay(), 0 );
238 return_value
= DisplayHeight( wxGlobalDisplay(), 0 );
240 case wxSYS_FRAMESIZE_X
:
242 case wxSYS_FRAMESIZE_Y
:
244 case wxSYS_SMALLICON_X
:
246 case wxSYS_SMALLICON_Y
:
248 case wxSYS_VSCROLL_ARROW_X
:
250 case wxSYS_VSCROLL_ARROW_Y
:
254 case wxSYS_CAPTION_Y
:
258 case wxSYS_NETWORK_PRESENT
:
260 case wxSYS_PENWINDOWS_PRESENT
:
262 case wxSYS_SHOW_SOUNDS
:
264 case wxSYS_SWAP_BUTTONS
:
273 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
)
277 case wxSYS_CAN_ICONIZE_FRAME
:
278 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: