]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: settings.cpp | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
6 | // Id: | |
7 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "settings.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/settings.h" | |
17 | ||
18 | /* | |
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 | |
40 | ||
41 | #define wxSYS_COLOUR_3DDKSHADOW 21 | |
42 | #define wxSYS_COLOUR_3DLIGHT 22 | |
43 | #define wxSYS_COLOUR_INFOTEXT 23 | |
44 | #define wxSYS_COLOUR_INFOBK 24 | |
45 | ||
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 | |
52 | */ | |
53 | ||
54 | #define SHIFT (8*(sizeof(short int)-sizeof(char))) | |
55 | ||
c67daf87 UR |
56 | wxColour *g_systemBtnFaceColour = (wxColour *) NULL; |
57 | wxColour *g_systemBtnShadowColour = (wxColour *) NULL; | |
58 | wxColour *g_systemBtnHighlightColour = (wxColour *) NULL; | |
59 | wxColour *g_systemHighlightColour = (wxColour *) NULL; | |
c801d85f | 60 | |
c67daf87 | 61 | wxFont *g_systemFont = (wxFont *) NULL; |
a3622daa VZ |
62 | |
63 | void wxSystemSettings::Done() { | |
64 | wxDELETE(g_systemBtnFaceColour); | |
65 | wxDELETE(g_systemBtnShadowColour); | |
66 | wxDELETE(g_systemBtnHighlightColour); | |
67 | wxDELETE(g_systemHighlightColour); | |
68 | wxDELETE(g_systemFont); | |
69 | } | |
70 | ||
c801d85f KB |
71 | wxColour wxSystemSettings::GetSystemColour( int index ) |
72 | { | |
73 | switch (index) | |
74 | { | |
75 | case wxSYS_COLOUR_SCROLLBAR: | |
76 | case wxSYS_COLOUR_BACKGROUND: | |
77 | case wxSYS_COLOUR_ACTIVECAPTION: | |
78 | case wxSYS_COLOUR_INACTIVECAPTION: | |
79 | case wxSYS_COLOUR_MENU: | |
80 | case wxSYS_COLOUR_WINDOW: | |
81 | case wxSYS_COLOUR_WINDOWFRAME: | |
82 | case wxSYS_COLOUR_ACTIVEBORDER: | |
83 | case wxSYS_COLOUR_INACTIVEBORDER: | |
84 | case wxSYS_COLOUR_BTNFACE: | |
85 | { | |
86 | GtkStyle *style = gtk_widget_get_default_style(); | |
87 | if (!g_systemBtnFaceColour) | |
88 | { | |
89 | g_systemBtnFaceColour = | |
90 | new wxColour( style->bg[0].red >> SHIFT, | |
91 | style->bg[0].green >> SHIFT, | |
92 | style->bg[0].blue >> SHIFT ); | |
ff7b1510 | 93 | } |
c801d85f | 94 | return *g_systemBtnFaceColour; |
ff7b1510 | 95 | } |
c801d85f KB |
96 | case wxSYS_COLOUR_BTNSHADOW: |
97 | { | |
98 | GtkStyle *style = gtk_widget_get_default_style(); | |
99 | if (!g_systemBtnShadowColour) | |
100 | { | |
101 | g_systemBtnShadowColour = | |
102 | new wxColour( style->dark[0].red >> SHIFT, | |
103 | style->dark[0].green >> SHIFT, | |
104 | style->dark[0].blue >> SHIFT ); | |
ff7b1510 | 105 | } |
c801d85f | 106 | return *g_systemBtnShadowColour; |
ff7b1510 | 107 | } |
c801d85f KB |
108 | case wxSYS_COLOUR_GRAYTEXT: |
109 | case wxSYS_COLOUR_BTNHIGHLIGHT: | |
110 | { | |
111 | GtkStyle *style = gtk_widget_get_default_style(); | |
112 | if (!g_systemBtnHighlightColour) | |
113 | { | |
114 | g_systemBtnHighlightColour = | |
115 | new wxColour( style->light[0].red >> SHIFT, | |
116 | style->light[0].green >> SHIFT, | |
117 | style->light[0].blue >> SHIFT ); | |
ff7b1510 | 118 | } |
c801d85f | 119 | return *g_systemBtnHighlightColour; |
ff7b1510 | 120 | } |
c801d85f KB |
121 | case wxSYS_COLOUR_HIGHLIGHT: |
122 | { | |
123 | GtkStyle *style = gtk_widget_get_default_style(); | |
124 | if (!g_systemHighlightColour) | |
125 | { | |
126 | g_systemHighlightColour = | |
127 | new wxColour( style->bg[GTK_STATE_SELECTED].red >> SHIFT, | |
128 | style->bg[GTK_STATE_SELECTED].green >> SHIFT, | |
129 | style->bg[GTK_STATE_SELECTED].blue >> SHIFT ); | |
ff7b1510 | 130 | } |
c801d85f | 131 | return *g_systemHighlightColour; |
ff7b1510 | 132 | } |
c801d85f KB |
133 | case wxSYS_COLOUR_MENUTEXT: |
134 | case wxSYS_COLOUR_WINDOWTEXT: | |
135 | case wxSYS_COLOUR_CAPTIONTEXT: | |
136 | case wxSYS_COLOUR_INACTIVECAPTIONTEXT: | |
137 | case wxSYS_COLOUR_INFOTEXT: | |
138 | { | |
139 | return *wxBLACK; | |
ff7b1510 | 140 | } |
c801d85f KB |
141 | case wxSYS_COLOUR_HIGHLIGHTTEXT: |
142 | { | |
143 | return *wxWHITE; | |
ff7b1510 | 144 | } |
c801d85f KB |
145 | case wxSYS_COLOUR_INFOBK: |
146 | case wxSYS_COLOUR_APPWORKSPACE: | |
147 | { | |
148 | return *wxWHITE; // ? | |
ff7b1510 RR |
149 | } |
150 | } | |
c801d85f | 151 | return *wxWHITE; |
ff7b1510 | 152 | } |
c801d85f | 153 | |
c801d85f KB |
154 | wxFont wxSystemSettings::GetSystemFont( int index ) |
155 | { | |
156 | switch (index) | |
157 | { | |
158 | case wxSYS_OEM_FIXED_FONT: | |
159 | case wxSYS_ANSI_FIXED_FONT: | |
160 | case wxSYS_SYSTEM_FIXED_FONT: | |
161 | { | |
162 | return *wxNORMAL_FONT; | |
ff7b1510 | 163 | } |
c801d85f KB |
164 | case wxSYS_ANSI_VAR_FONT: |
165 | case wxSYS_SYSTEM_FONT: | |
166 | case wxSYS_DEVICE_DEFAULT_FONT: | |
167 | case wxSYS_DEFAULT_GUI_FONT: | |
168 | { | |
169 | if (!g_systemFont) | |
170 | g_systemFont = new wxFont( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" ); | |
171 | return *g_systemFont; | |
ff7b1510 RR |
172 | } |
173 | } | |
c801d85f KB |
174 | |
175 | return wxNullFont; | |
176 | } | |
c801d85f KB |
177 | |
178 | int wxSystemSettings::GetSystemMetric( int index ) | |
179 | { | |
180 | switch (index) | |
181 | { | |
182 | case wxSYS_SCREEN_X: | |
183 | return gdk_screen_width(); | |
184 | case wxSYS_SCREEN_Y: | |
185 | return gdk_screen_height(); | |
ff7b1510 | 186 | } |
c801d85f | 187 | return 0; |
c67daf87 | 188 | } |