1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "settings.h"
15 #include "wx/settings.h"
18 #define wxSYS_COLOUR_SCROLLBAR 0
19 #define wxSYS_COLOUR_BACKGROUND 1
20 #define wxSYS_COLOUR_ACTIVECAPTION 2
21 #define wxSYS_COLOUR_INACTIVECAPTION 3
22 #define wxSYS_COLOUR_MENU 4
23 #define wxSYS_COLOUR_WINDOW 5
24 #define wxSYS_COLOUR_WINDOWFRAME 6
25 #define wxSYS_COLOUR_MENUTEXT 7
26 #define wxSYS_COLOUR_WINDOWTEXT 8
27 #define wxSYS_COLOUR_CAPTIONTEXT 9
28 #define wxSYS_COLOUR_ACTIVEBORDER 10
29 #define wxSYS_COLOUR_INACTIVEBORDER 11
30 #define wxSYS_COLOUR_APPWORKSPACE 12
31 #define wxSYS_COLOUR_HIGHLIGHT 13
32 #define wxSYS_COLOUR_HIGHLIGHTTEXT 14
33 #define wxSYS_COLOUR_BTNFACE 15
34 #define wxSYS_COLOUR_BTNSHADOW 16
35 #define wxSYS_COLOUR_GRAYTEXT 17
36 #define wxSYS_COLOUR_BTNTEXT 18
37 #define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19
38 #define wxSYS_COLOUR_BTNHIGHLIGHT 20
40 #define wxSYS_COLOUR_3DDKSHADOW 21
41 #define wxSYS_COLOUR_3DLIGHT 22
42 #define wxSYS_COLOUR_INFOTEXT 23
43 #define wxSYS_COLOUR_INFOBK 24
45 #define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND
46 #define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE
47 #define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW
48 #define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT
49 #define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
50 #define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
53 #define SHIFT (8*(sizeof(short int)-sizeof(char)))
55 wxColour
*g_systemBtnFaceColour
= (wxColour
*) NULL
;
56 wxColour
*g_systemBtnShadowColour
= (wxColour
*) NULL
;
57 wxColour
*g_systemBtnHighlightColour
= (wxColour
*) NULL
;
58 wxColour
*g_systemHighlightColour
= (wxColour
*) NULL
;
60 wxFont
*g_systemFont
= (wxFont
*) NULL
;
62 void wxSystemSettings::Done() {
63 wxDELETE(g_systemBtnFaceColour
);
64 wxDELETE(g_systemBtnShadowColour
);
65 wxDELETE(g_systemBtnHighlightColour
);
66 wxDELETE(g_systemHighlightColour
);
67 wxDELETE(g_systemFont
);
70 wxColour
wxSystemSettings::GetSystemColour( int index
)
74 case wxSYS_COLOUR_SCROLLBAR
:
75 case wxSYS_COLOUR_BACKGROUND
:
76 case wxSYS_COLOUR_ACTIVECAPTION
:
77 case wxSYS_COLOUR_INACTIVECAPTION
:
78 case wxSYS_COLOUR_MENU
:
79 case wxSYS_COLOUR_WINDOW
:
80 case wxSYS_COLOUR_WINDOWFRAME
:
81 case wxSYS_COLOUR_ACTIVEBORDER
:
82 case wxSYS_COLOUR_INACTIVEBORDER
:
83 case wxSYS_COLOUR_BTNFACE
:
85 GtkStyle
*style
= gtk_widget_get_default_style();
86 if (!g_systemBtnFaceColour
)
88 g_systemBtnFaceColour
=
89 new wxColour( style
->bg
[0].red
>> SHIFT
,
90 style
->bg
[0].green
>> SHIFT
,
91 style
->bg
[0].blue
>> SHIFT
);
93 return *g_systemBtnFaceColour
;
95 case wxSYS_COLOUR_BTNSHADOW
:
97 GtkStyle
*style
= gtk_widget_get_default_style();
98 if (!g_systemBtnShadowColour
)
100 g_systemBtnShadowColour
=
101 new wxColour( style
->dark
[0].red
>> SHIFT
,
102 style
->dark
[0].green
>> SHIFT
,
103 style
->dark
[0].blue
>> SHIFT
);
105 return *g_systemBtnShadowColour
;
107 case wxSYS_COLOUR_GRAYTEXT
:
108 case wxSYS_COLOUR_BTNHIGHLIGHT
:
110 GtkStyle
*style
= gtk_widget_get_default_style();
111 if (!g_systemBtnHighlightColour
)
113 g_systemBtnHighlightColour
=
114 new wxColour( style
->light
[0].red
>> SHIFT
,
115 style
->light
[0].green
>> SHIFT
,
116 style
->light
[0].blue
>> SHIFT
);
118 return *g_systemBtnHighlightColour
;
120 case wxSYS_COLOUR_HIGHLIGHT
:
122 GtkStyle
*style
= gtk_widget_get_default_style();
123 if (!g_systemHighlightColour
)
125 g_systemHighlightColour
=
126 new wxColour( style
->bg
[GTK_STATE_SELECTED
].red
>> SHIFT
,
127 style
->bg
[GTK_STATE_SELECTED
].green
>> SHIFT
,
128 style
->bg
[GTK_STATE_SELECTED
].blue
>> SHIFT
);
130 return *g_systemHighlightColour
;
132 case wxSYS_COLOUR_MENUTEXT
:
133 case wxSYS_COLOUR_WINDOWTEXT
:
134 case wxSYS_COLOUR_CAPTIONTEXT
:
135 case wxSYS_COLOUR_INACTIVECAPTIONTEXT
:
136 case wxSYS_COLOUR_INFOTEXT
:
140 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
144 case wxSYS_COLOUR_INFOBK
:
145 case wxSYS_COLOUR_APPWORKSPACE
:
147 return *wxWHITE
; // ?
153 wxFont
wxSystemSettings::GetSystemFont( int index
)
157 case wxSYS_OEM_FIXED_FONT
:
158 case wxSYS_ANSI_FIXED_FONT
:
159 case wxSYS_SYSTEM_FIXED_FONT
:
161 return *wxNORMAL_FONT
;
163 case wxSYS_ANSI_VAR_FONT
:
164 case wxSYS_SYSTEM_FONT
:
165 case wxSYS_DEVICE_DEFAULT_FONT
:
166 case wxSYS_DEFAULT_GUI_FONT
:
169 g_systemFont
= new wxFont( 12, wxSWISS
, wxNORMAL
, wxNORMAL
);
170 return *g_systemFont
;
177 int wxSystemSettings::GetSystemMetric( int index
)
182 return gdk_screen_width();
184 return gdk_screen_height();