1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/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 // For compilers that support precompilation, includes "wx.h". 
  17 #include "wx/wxprec.h" 
  19 #include "wx/settings.h" 
  23     #include "wx/gdicmn.h" 
  27 #pragma message disable nosimpint 
  32 #pragma message enable nosimpint 
  35 #include "wx/x11/privx.h" 
  37 // To correctly read the resources from the database, we create a 
  38 // sample widget. This has the application shell as the parent and 
  39 // so will be destroyed when the applicaion is closed. 
  40 static Widget but_setting_wid 
= NULL
; 
  42 wxColour 
wxSystemSettingsNative::GetColour(wxSystemColour index
) 
  44   if (NULL 
== but_setting_wid 
&& wxTheApp 
&& wxTheApp
->GetTopLevelWidget()) 
  46     but_setting_wid 
= XtVaCreateWidget("settings_button", xmPushButtonWidgetClass
, 
  47                                        (Widget
)wxTheApp
->GetTopLevelWidget(), NULL
); 
  52     case wxSYS_COLOUR_WINDOW
: 
  56     case wxSYS_COLOUR_SCROLLBAR
: 
  57       //    case wxSYS_COLOUR_DESKTOP:          // Same as wxSYS_COLOUR_BACKGROUND 
  58     case wxSYS_COLOUR_BACKGROUND
: 
  59     case wxSYS_COLOUR_ACTIVECAPTION
: 
  60     case wxSYS_COLOUR_INACTIVECAPTION
: 
  61     case wxSYS_COLOUR_MENU
: 
  62     case wxSYS_COLOUR_MENUBAR
: 
  63     case wxSYS_COLOUR_WINDOWFRAME
: 
  64     case wxSYS_COLOUR_ACTIVEBORDER
: 
  65     case wxSYS_COLOUR_INACTIVEBORDER
: 
  66     case wxSYS_COLOUR_BTNFACE
: 
  67       //    case wxSYS_COLOUR_3DFACE:           // Same as wxSYS_COLOUR_BTNFACE 
  68     case wxSYS_COLOUR_GRAYTEXT
: 
  73             XtVaGetValues(but_setting_wid
, 
  74                         XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
), 
  76             return wxColor((unsigned char)(bg
.red 
>> 8), 
  77                            (unsigned char)(bg
.green 
>> 8), 
  78                            (unsigned char)(bg
.blue 
>> 8)); 
  82             return wxColour("LIGHT GREY"); 
  85     case wxSYS_COLOUR_BTNSHADOW
: 
  86       //    case wxSYS_COLOUR_3DSHADOW:         // Same as wxSYS_COLOUR_BTNSHADOW 
  88         return wxColour("GREY"); 
  90     case wxSYS_COLOUR_3DDKSHADOW
: 
  94     case wxSYS_COLOUR_HIGHLIGHT
: 
  98     case wxSYS_COLOUR_BTNHIGHLIGHT
: 
  99     case wxSYS_COLOUR_LISTBOX
: 
 100        //    case wxSYS_COLOUR_3DHIGHLIGHT:      // Same as wxSYS_COLOUR_BTNHIGHLIGHT 
 104     case wxSYS_COLOUR_3DLIGHT
: 
 106         return wxColour("LIGHT GREY"); 
 108     case wxSYS_COLOUR_MENUTEXT
: 
 109     case wxSYS_COLOUR_WINDOWTEXT
: 
 110     case wxSYS_COLOUR_CAPTIONTEXT
: 
 111     case wxSYS_COLOUR_INACTIVECAPTIONTEXT
: 
 112     case wxSYS_COLOUR_BTNTEXT
: 
 113     case wxSYS_COLOUR_INFOTEXT
: 
 118             XtVaGetValues(but_setting_wid
, 
 119                         XtVaTypedArg
, XmNforeground
, XtRColor
, &fg
, sizeof(fg
), 
 121             return wxColor((unsigned char)(fg
.red 
>> 8), 
 122                            (unsigned char)(fg
.green 
>> 8), 
 123                            (unsigned char)(fg
.blue 
>> 8)); 
 130     case wxSYS_COLOUR_HIGHLIGHTTEXT
: 
 134     case wxSYS_COLOUR_INFOBK
: 
 135     case wxSYS_COLOUR_APPWORKSPACE
: 
 140             XtVaGetValues(but_setting_wid
, 
 141                         XtVaTypedArg
, XmNbackground
, XtRColor
, &bg
, sizeof(bg
), 
 143             return wxColor((unsigned char)(bg
.red 
>> 8), 
 144                            (unsigned char)(bg
.green 
>> 8), 
 145                            (unsigned char)(bg
.blue 
>> 8)); 
 149             return wxColour("LIGHT GREY"); 
 153     case wxSYS_COLOUR_HOTLIGHT
: 
 154     case wxSYS_COLOUR_GRADIENTACTIVECAPTION
: 
 155     case wxSYS_COLOUR_GRADIENTINACTIVECAPTION
: 
 156     case wxSYS_COLOUR_MENUHILIGHT
: 
 158         return wxColour("LIGHT GREY"); 
 161     case wxSYS_COLOUR_MAX
: 
 162         wxFAIL_MSG( _T("unknown colour") ); 
 167 wxFont 
wxSystemSettingsNative::GetFont(wxSystemFont index
) 
 171     if (   wxFont::GetDefaultEncoding() == wxFONTENCODING_SHIFT_JIS
 
 172         || wxFont::GetDefaultEncoding() == wxFONTENCODING_EUC_JP
) 
 179         case wxSYS_SYSTEM_FIXED_FONT
: 
 181             font 
= wxFont(pointSize
, wxMODERN
, wxNORMAL
, wxNORMAL
, false); 
 184         case wxSYS_DEVICE_DEFAULT_FONT
: 
 185         case wxSYS_SYSTEM_FONT
: 
 186         case wxSYS_DEFAULT_GUI_FONT
: 
 189             font 
= wxFont(pointSize
, wxSWISS
, wxNORMAL
, wxNORMAL
, false); 
 197 // Get a system metric, e.g. scrollbar size 
 198 int wxSystemSettingsNative::GetMetric(wxSystemMetric index
, wxWindow
* WXUNUSED(win
)) 
 200     int return_value 
= 0; 
 204         case wxSYS_HSCROLL_Y
: 
 205         case wxSYS_VSCROLL_X
: 
 209             return_value 
= DisplayWidth( wxGlobalDisplay(), 0 ); 
 212             return_value 
= DisplayHeight( wxGlobalDisplay(), 0 ); 
 215         // TODO case wxSYS_MOUSE_BUTTONS: 
 216         // TODO case wxSYS_BORDER_X: 
 217         // TODO case wxSYS_BORDER_Y: 
 218         // TODO case wxSYS_CURSOR_X: 
 219         // TODO case wxSYS_CURSOR_Y: 
 220         // TODO case wxSYS_DCLICK_X: 
 221         // TODO case wxSYS_DCLICK_Y: 
 222         // TODO case wxSYS_DRAG_X: 
 223         // TODO case wxSYS_DRAG_Y: 
 224         // TODO case wxSYS_EDGE_X: 
 225         // TODO case wxSYS_EDGE_Y: 
 226         // TODO case wxSYS_HSCROLL_ARROW_X: 
 227         // TODO case wxSYS_HSCROLL_ARROW_Y: 
 228         // TODO case wxSYS_HTHUMB_X: 
 229         // TODO case wxSYS_ICON_X: 
 230         // TODO case wxSYS_ICON_Y: 
 231         // TODO case wxSYS_ICONSPACING_X: 
 232         // TODO case wxSYS_ICONSPACING_Y: 
 233         // TODO case wxSYS_WINDOWMIN_X: 
 234         // TODO case wxSYS_WINDOWMIN_Y: 
 235         // TODO case wxSYS_FRAMESIZE_X: 
 236         // TODO case wxSYS_FRAMESIZE_Y: 
 237         // TODO case wxSYS_SMALLICON_X: 
 238         // TODO case wxSYS_SMALLICON_Y: 
 239         // TODO case wxSYS_VSCROLL_ARROW_X: 
 240         // TODO case wxSYS_VSCROLL_ARROW_Y: 
 241         // TODO case wxSYS_VTHUMB_Y: 
 242         // TODO case wxSYS_CAPTION_Y: 
 243         // TODO case wxSYS_MENU_Y: 
 244         // TODO case wxSYS_NETWORK_PRESENT: 
 245         // TODO case wxSYS_PENWINDOWS_PRESENT: 
 246         // TODO case wxSYS_SHOW_SOUNDS: 
 247         // TODO case wxSYS_SWAP_BUTTONS: 
 250             return_value 
= -1; // unsuported metric 
 256 bool wxSystemSettingsNative::HasFeature(wxSystemFeature index
) 
 260         case wxSYS_CAN_ICONIZE_FRAME
: 
 261         case wxSYS_CAN_DRAW_FRAME_DECORATIONS
: