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 // 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
;
38 wxColour
wxSystemSettingsNative::GetColour(wxSystemColour index
)
40 if (NULL
== but_setting_wid
&& wxTheApp
&& wxTheApp
->GetTopLevelWidget())
42 but_setting_wid
= XtVaCreateWidget("settings_button", xmPushButtonWidgetClass
,
43 (Widget
)wxTheApp
->GetTopLevelWidget(), NULL
);
48 case wxSYS_COLOUR_WINDOW
:
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
:
69 XtVaGetValues(but_setting_wid
,
70 XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
),
72 return wxColor(bg
.red
>> 8, bg
.green
>> 8, bg
.blue
>> 8);
76 return wxColour("LIGHT GREY");
79 case wxSYS_COLOUR_BTNSHADOW
:
80 // case wxSYS_COLOUR_3DSHADOW: // Same as wxSYS_COLOUR_BTNSHADOW
82 return wxColour("GREY");
84 case wxSYS_COLOUR_3DDKSHADOW
:
88 case wxSYS_COLOUR_HIGHLIGHT
:
92 case wxSYS_COLOUR_BTNHIGHLIGHT
:
93 case wxSYS_COLOUR_LISTBOX
:
94 // case wxSYS_COLOUR_3DHIGHLIGHT: // Same as wxSYS_COLOUR_BTNHIGHLIGHT
98 case wxSYS_COLOUR_3DLIGHT
:
100 return wxColour("LIGHT GREY");
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
:
112 XtVaGetValues(but_setting_wid
,
113 XtVaTypedArg
, XmNforeground
, XtRColor
, &fg
, sizeof(fg
),
115 return wxColor(fg
.red
>> 8, fg
.green
>> 8, fg
.blue
>> 8);
122 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
126 case wxSYS_COLOUR_INFOBK
:
127 case wxSYS_COLOUR_APPWORKSPACE
:
132 XtVaGetValues(but_setting_wid
,
133 XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
),
135 return wxColor(bg
.red
>> 8, bg
.green
>> 8, bg
.blue
>> 8);
139 return wxColour("LIGHT GREY");
143 case wxSYS_COLOUR_HOTLIGHT
:
144 case wxSYS_COLOUR_GRADIENTACTIVECAPTION
:
145 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
:
146 case wxSYS_COLOUR_MENUHILIGHT
:
148 return wxColour("LIGHT GREY");
151 case wxSYS_COLOUR_MAX
:
152 wxFAIL_MSG( _T("unknown colour") );
157 wxFont
wxSystemSettingsNative::GetFont(wxSystemFont index
)
161 case wxSYS_SYSTEM_FIXED_FONT
:
163 return wxFont(12, wxMODERN
, wxNORMAL
, wxNORMAL
, FALSE
);
166 case wxSYS_DEVICE_DEFAULT_FONT
:
167 case wxSYS_SYSTEM_FONT
:
168 case wxSYS_DEFAULT_GUI_FONT
:
171 return wxFont(12, wxSWISS
, wxNORMAL
, wxNORMAL
, FALSE
);
179 // Get a system metric, e.g. scrollbar size
180 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
)
182 int return_value
= 0;
186 case wxSYS_HSCROLL_Y
:
187 case wxSYS_VSCROLL_X
:
189 case wxSYS_MOUSE_BUTTONS
:
211 case wxSYS_HSCROLL_ARROW_X
:
213 case wxSYS_HSCROLL_ARROW_Y
:
221 case wxSYS_ICONSPACING_X
:
223 case wxSYS_ICONSPACING_Y
:
225 case wxSYS_WINDOWMIN_X
:
227 case wxSYS_WINDOWMIN_Y
:
230 return_value
= DisplayWidth( wxGlobalDisplay(), 0 );
233 return_value
= DisplayHeight( wxGlobalDisplay(), 0 );
235 case wxSYS_FRAMESIZE_X
:
237 case wxSYS_FRAMESIZE_Y
:
239 case wxSYS_SMALLICON_X
:
241 case wxSYS_SMALLICON_Y
:
243 case wxSYS_VSCROLL_ARROW_X
:
245 case wxSYS_VSCROLL_ARROW_Y
:
249 case wxSYS_CAPTION_Y
:
253 case wxSYS_NETWORK_PRESENT
:
255 case wxSYS_PENWINDOWS_PRESENT
:
257 case wxSYS_SHOW_SOUNDS
:
259 case wxSYS_SWAP_BUTTONS
:
268 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
)
272 case wxSYS_CAN_ICONIZE_FRAME
:
273 case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: