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 #include "wx/settings.h"
21 #include "wx/gdicmn.h"
25 #pragma message disable nosimpint
30 #pragma message enable nosimpint
33 #include "wx/x11/privx.h"
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
;
40 wxColour
wxSystemSettingsNative::GetColour(wxSystemColour index
)
42 if (NULL
== but_setting_wid
&& wxTheApp
&& wxTheApp
->GetTopLevelWidget())
44 but_setting_wid
= XtVaCreateWidget("settings_button", xmPushButtonWidgetClass
,
45 (Widget
)wxTheApp
->GetTopLevelWidget(), NULL
);
50 case wxSYS_COLOUR_WINDOW
:
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
:
71 XtVaGetValues(but_setting_wid
,
72 XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
),
74 return wxColor(bg
.red
>> 8, bg
.green
>> 8, bg
.blue
>> 8);
78 return wxColour("LIGHT GREY");
81 case wxSYS_COLOUR_BTNSHADOW
:
82 // case wxSYS_COLOUR_3DSHADOW: // Same as wxSYS_COLOUR_BTNSHADOW
84 return wxColour("GREY");
86 case wxSYS_COLOUR_3DDKSHADOW
:
90 case wxSYS_COLOUR_HIGHLIGHT
:
94 case wxSYS_COLOUR_BTNHIGHLIGHT
:
95 case wxSYS_COLOUR_LISTBOX
:
96 // case wxSYS_COLOUR_3DHIGHLIGHT: // Same as wxSYS_COLOUR_BTNHIGHLIGHT
100 case wxSYS_COLOUR_3DLIGHT
:
102 return wxColour("LIGHT GREY");
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
:
114 XtVaGetValues(but_setting_wid
,
115 XtVaTypedArg
, XmNforeground
, XtRColor
, &fg
, sizeof(fg
),
117 return wxColor(fg
.red
>> 8, fg
.green
>> 8, fg
.blue
>> 8);
124 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
128 case wxSYS_COLOUR_INFOBK
:
129 case wxSYS_COLOUR_APPWORKSPACE
:
134 XtVaGetValues(but_setting_wid
,
135 XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
),
137 return wxColor(bg
.red
>> 8, bg
.green
>> 8, bg
.blue
>> 8);
141 return wxColour("LIGHT GREY");
145 case wxSYS_COLOUR_HOTLIGHT
:
146 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
147 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
148 case wxSYS_COLOUR_MENUHILIGHT
:
150 return wxColour("LIGHT GREY");
153 case wxSYS_COLOUR_MAX
:
154 wxFAIL_MSG( _T("unknown colour") );
159 wxFont
wxSystemSettingsNative::GetFont(wxSystemFont index
)
163 case wxSYS_SYSTEM_FIXED_FONT
:
165 return wxFont(12, wxMODERN
, wxNORMAL
, wxNORMAL
, FALSE
);
168 case wxSYS_DEVICE_DEFAULT_FONT
:
169 case wxSYS_SYSTEM_FONT
:
170 case wxSYS_DEFAULT_GUI_FONT
:
173 return wxFont(12, wxSWISS
, wxNORMAL
, wxNORMAL
, FALSE
);
181 // Get a system metric, e.g. scrollbar size
182 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
)
184 int return_value
= 0;
188 case wxSYS_HSCROLL_Y
:
189 case wxSYS_VSCROLL_X
:
191 case wxSYS_MOUSE_BUTTONS
:
213 case wxSYS_HSCROLL_ARROW_X
:
215 case wxSYS_HSCROLL_ARROW_Y
:
223 case wxSYS_ICONSPACING_X
:
225 case wxSYS_ICONSPACING_Y
:
227 case wxSYS_WINDOWMIN_X
:
229 case wxSYS_WINDOWMIN_Y
:
232 return_value
= DisplayWidth( wxGlobalDisplay(), 0 );
235 return_value
= DisplayHeight( wxGlobalDisplay(), 0 );
237 case wxSYS_FRAMESIZE_X
:
239 case wxSYS_FRAMESIZE_Y
:
241 case wxSYS_SMALLICON_X
:
243 case wxSYS_SMALLICON_Y
:
245 case wxSYS_VSCROLL_ARROW_X
:
247 case wxSYS_VSCROLL_ARROW_Y
:
251 case wxSYS_CAPTION_Y
:
255 case wxSYS_NETWORK_PRESENT
:
257 case wxSYS_PENWINDOWS_PRESENT
:
259 case wxSYS_SHOW_SOUNDS
:
261 case wxSYS_SWAP_BUTTONS
:
270 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
)
274 case wxSYS_CAN_ICONIZE_FRAME
:
275 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: