1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "settings.h"
16 #include "wx/settings.h"
19 #define wxSYS_COLOUR_SCROLLBAR 0
20 #define wxSYS_COLOUR_BACKGROUND 1
21 #define wxSYS_COLOUR_ACTIVECAPTION 2
22 #define wxSYS_COLOUR_INACTIVECAPTION 3
23 #define wxSYS_COLOUR_MENU 4
24 #define wxSYS_COLOUR_WINDOW 5
25 #define wxSYS_COLOUR_WINDOWFRAME 6
26 #define wxSYS_COLOUR_MENUTEXT 7
27 #define wxSYS_COLOUR_WINDOWTEXT 8
28 #define wxSYS_COLOUR_CAPTIONTEXT 9
29 #define wxSYS_COLOUR_ACTIVEBORDER 10
30 #define wxSYS_COLOUR_INACTIVEBORDER 11
31 #define wxSYS_COLOUR_APPWORKSPACE 12
32 #define wxSYS_COLOUR_HIGHLIGHT 13
33 #define wxSYS_COLOUR_HIGHLIGHTTEXT 14
34 #define wxSYS_COLOUR_BTNFACE 15
35 #define wxSYS_COLOUR_BTNSHADOW 16
36 #define wxSYS_COLOUR_GRAYTEXT 17
37 #define wxSYS_COLOUR_BTNTEXT 18
38 #define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19
39 #define wxSYS_COLOUR_BTNHIGHLIGHT 20
41 #define wxSYS_COLOUR_3DDKSHADOW 21
42 #define wxSYS_COLOUR_3DLIGHT 22
43 #define wxSYS_COLOUR_INFOTEXT 23
44 #define wxSYS_COLOUR_INFOBK 24
46 #define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND
47 #define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE
48 #define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW
49 #define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT
50 #define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
51 #define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
54 #define SHIFT (8*(sizeof(short int)-sizeof(char)))
56 wxColour
*g_systemBtnFaceColour
= NULL
;
57 wxColour
*g_systemBtnShadowColour
= NULL
;
58 wxColour
*g_systemBtnHighlightColour
= NULL
;
59 wxColour
*g_systemHighlightColour
= NULL
;
61 wxColour
wxSystemSettings::GetSystemColour( int index
)
65 case wxSYS_COLOUR_SCROLLBAR
:
66 case wxSYS_COLOUR_BACKGROUND
:
67 case wxSYS_COLOUR_ACTIVECAPTION
:
68 case wxSYS_COLOUR_INACTIVECAPTION
:
69 case wxSYS_COLOUR_MENU
:
70 case wxSYS_COLOUR_WINDOW
:
71 case wxSYS_COLOUR_WINDOWFRAME
:
72 case wxSYS_COLOUR_ACTIVEBORDER
:
73 case wxSYS_COLOUR_INACTIVEBORDER
:
74 case wxSYS_COLOUR_BTNFACE
:
76 GtkStyle
*style
= gtk_widget_get_default_style();
77 if (!g_systemBtnFaceColour
)
79 g_systemBtnFaceColour
=
80 new wxColour( style
->bg
[0].red
>> SHIFT
,
81 style
->bg
[0].green
>> SHIFT
,
82 style
->bg
[0].blue
>> SHIFT
);
84 return *g_systemBtnFaceColour
;
86 case wxSYS_COLOUR_BTNSHADOW
:
88 GtkStyle
*style
= gtk_widget_get_default_style();
89 if (!g_systemBtnShadowColour
)
91 g_systemBtnShadowColour
=
92 new wxColour( style
->dark
[0].red
>> SHIFT
,
93 style
->dark
[0].green
>> SHIFT
,
94 style
->dark
[0].blue
>> SHIFT
);
96 return *g_systemBtnShadowColour
;
98 case wxSYS_COLOUR_GRAYTEXT
:
99 case wxSYS_COLOUR_BTNHIGHLIGHT
:
101 GtkStyle
*style
= gtk_widget_get_default_style();
102 if (!g_systemBtnHighlightColour
)
104 g_systemBtnHighlightColour
=
105 new wxColour( style
->light
[0].red
>> SHIFT
,
106 style
->light
[0].green
>> SHIFT
,
107 style
->light
[0].blue
>> SHIFT
);
109 return *g_systemBtnHighlightColour
;
111 case wxSYS_COLOUR_HIGHLIGHT
:
113 GtkStyle
*style
= gtk_widget_get_default_style();
114 if (!g_systemHighlightColour
)
116 g_systemHighlightColour
=
117 new wxColour( style
->bg
[GTK_STATE_SELECTED
].red
>> SHIFT
,
118 style
->bg
[GTK_STATE_SELECTED
].green
>> SHIFT
,
119 style
->bg
[GTK_STATE_SELECTED
].blue
>> SHIFT
);
121 return *g_systemHighlightColour
;
123 case wxSYS_COLOUR_MENUTEXT
:
124 case wxSYS_COLOUR_WINDOWTEXT
:
125 case wxSYS_COLOUR_CAPTIONTEXT
:
126 case wxSYS_COLOUR_INACTIVECAPTIONTEXT
:
127 case wxSYS_COLOUR_INFOTEXT
:
131 case wxSYS_COLOUR_HIGHLIGHTTEXT
:
135 case wxSYS_COLOUR_INFOBK
:
136 case wxSYS_COLOUR_APPWORKSPACE
:
138 return *wxWHITE
; // ?
144 wxFont
*g_systemFont
= NULL
;
146 wxFont
wxSystemSettings::GetSystemFont( int index
)
150 case wxSYS_OEM_FIXED_FONT
:
151 case wxSYS_ANSI_FIXED_FONT
:
152 case wxSYS_SYSTEM_FIXED_FONT
:
154 return *wxNORMAL_FONT
;
156 case wxSYS_ANSI_VAR_FONT
:
157 case wxSYS_SYSTEM_FONT
:
158 case wxSYS_DEVICE_DEFAULT_FONT
:
159 case wxSYS_DEFAULT_GUI_FONT
:
162 g_systemFont
= new wxFont( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
163 return *g_systemFont
;
171 int wxSystemSettings::GetSystemMetric( int index
)
176 return gdk_screen_width();
178 return gdk_screen_height();