]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/settings.cpp
wxIMage accessors
[wxWidgets.git] / src / gtk1 / settings.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: settings.cpp
3// Purpose:
4// Author: Robert Roebling
f96aa4d9
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
c801d85f
KB
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10
11#ifdef __GNUG__
12#pragma implementation "settings.h"
13#endif
14
15#include "wx/settings.h"
16
17/*
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
39
40#define wxSYS_COLOUR_3DDKSHADOW 21
41#define wxSYS_COLOUR_3DLIGHT 22
42#define wxSYS_COLOUR_INFOTEXT 23
43#define wxSYS_COLOUR_INFOBK 24
44
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
51*/
52
53#define SHIFT (8*(sizeof(short int)-sizeof(char)))
54
c67daf87
UR
55wxColour *g_systemBtnFaceColour = (wxColour *) NULL;
56wxColour *g_systemBtnShadowColour = (wxColour *) NULL;
57wxColour *g_systemBtnHighlightColour = (wxColour *) NULL;
58wxColour *g_systemHighlightColour = (wxColour *) NULL;
c801d85f 59
c67daf87 60wxFont *g_systemFont = (wxFont *) NULL;
a3622daa
VZ
61
62void wxSystemSettings::Done() {
63 wxDELETE(g_systemBtnFaceColour);
64 wxDELETE(g_systemBtnShadowColour);
65 wxDELETE(g_systemBtnHighlightColour);
66 wxDELETE(g_systemHighlightColour);
67 wxDELETE(g_systemFont);
68}
69
c801d85f
KB
70wxColour wxSystemSettings::GetSystemColour( int index )
71{
72 switch (index)
73 {
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:
84 {
85 GtkStyle *style = gtk_widget_get_default_style();
86 if (!g_systemBtnFaceColour)
87 {
88 g_systemBtnFaceColour =
89 new wxColour( style->bg[0].red >> SHIFT,
90 style->bg[0].green >> SHIFT,
91 style->bg[0].blue >> SHIFT );
ff7b1510 92 }
c801d85f 93 return *g_systemBtnFaceColour;
ff7b1510 94 }
c801d85f
KB
95 case wxSYS_COLOUR_BTNSHADOW:
96 {
97 GtkStyle *style = gtk_widget_get_default_style();
98 if (!g_systemBtnShadowColour)
99 {
100 g_systemBtnShadowColour =
101 new wxColour( style->dark[0].red >> SHIFT,
102 style->dark[0].green >> SHIFT,
103 style->dark[0].blue >> SHIFT );
ff7b1510 104 }
c801d85f 105 return *g_systemBtnShadowColour;
ff7b1510 106 }
c801d85f
KB
107 case wxSYS_COLOUR_GRAYTEXT:
108 case wxSYS_COLOUR_BTNHIGHLIGHT:
109 {
110 GtkStyle *style = gtk_widget_get_default_style();
111 if (!g_systemBtnHighlightColour)
112 {
113 g_systemBtnHighlightColour =
114 new wxColour( style->light[0].red >> SHIFT,
115 style->light[0].green >> SHIFT,
116 style->light[0].blue >> SHIFT );
ff7b1510 117 }
c801d85f 118 return *g_systemBtnHighlightColour;
ff7b1510 119 }
c801d85f
KB
120 case wxSYS_COLOUR_HIGHLIGHT:
121 {
122 GtkStyle *style = gtk_widget_get_default_style();
123 if (!g_systemHighlightColour)
124 {
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 );
ff7b1510 129 }
c801d85f 130 return *g_systemHighlightColour;
ff7b1510 131 }
c801d85f
KB
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:
137 {
138 return *wxBLACK;
ff7b1510 139 }
c801d85f
KB
140 case wxSYS_COLOUR_HIGHLIGHTTEXT:
141 {
142 return *wxWHITE;
ff7b1510 143 }
c801d85f
KB
144 case wxSYS_COLOUR_INFOBK:
145 case wxSYS_COLOUR_APPWORKSPACE:
146 {
147 return *wxWHITE; // ?
ff7b1510
RR
148 }
149 }
c801d85f 150 return *wxWHITE;
ff7b1510 151}
c801d85f 152
c801d85f
KB
153wxFont wxSystemSettings::GetSystemFont( int index )
154{
155 switch (index)
156 {
157 case wxSYS_OEM_FIXED_FONT:
158 case wxSYS_ANSI_FIXED_FONT:
159 case wxSYS_SYSTEM_FIXED_FONT:
160 {
161 return *wxNORMAL_FONT;
ff7b1510 162 }
c801d85f
KB
163 case wxSYS_ANSI_VAR_FONT:
164 case wxSYS_SYSTEM_FONT:
165 case wxSYS_DEVICE_DEFAULT_FONT:
166 case wxSYS_DEFAULT_GUI_FONT:
167 {
168 if (!g_systemFont)
0208334d 169 g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
c801d85f 170 return *g_systemFont;
ff7b1510
RR
171 }
172 }
c801d85f
KB
173
174 return wxNullFont;
175}
c801d85f
KB
176
177int wxSystemSettings::GetSystemMetric( int index )
178{
179 switch (index)
180 {
181 case wxSYS_SCREEN_X:
182 return gdk_screen_width();
183 case wxSYS_SCREEN_Y:
184 return gdk_screen_height();
ff7b1510 185 }
c801d85f 186 return 0;
c67daf87 187}