]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/settings.cpp
Changed event type ids to constants instead of enum, for extensibility.
[wxWidgets.git] / src / gtk1 / settings.cpp
CommitLineData
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
56wxColour *g_systemBtnFaceColour = NULL;
57wxColour *g_systemBtnShadowColour = NULL;
58wxColour *g_systemBtnHighlightColour = NULL;
59wxColour *g_systemHighlightColour = NULL;
60
61wxColour wxSystemSettings::GetSystemColour( int index )
62{
63 switch (index)
64 {
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:
75 {
76 GtkStyle *style = gtk_widget_get_default_style();
77 if (!g_systemBtnFaceColour)
78 {
79 g_systemBtnFaceColour =
80 new wxColour( style->bg[0].red >> SHIFT,
81 style->bg[0].green >> SHIFT,
82 style->bg[0].blue >> SHIFT );
83 };
84 return *g_systemBtnFaceColour;
85 };
86 case wxSYS_COLOUR_BTNSHADOW:
87 {
88 GtkStyle *style = gtk_widget_get_default_style();
89 if (!g_systemBtnShadowColour)
90 {
91 g_systemBtnShadowColour =
92 new wxColour( style->dark[0].red >> SHIFT,
93 style->dark[0].green >> SHIFT,
94 style->dark[0].blue >> SHIFT );
95 };
96 return *g_systemBtnShadowColour;
97 };
98 case wxSYS_COLOUR_GRAYTEXT:
99 case wxSYS_COLOUR_BTNHIGHLIGHT:
100 {
101 GtkStyle *style = gtk_widget_get_default_style();
102 if (!g_systemBtnHighlightColour)
103 {
104 g_systemBtnHighlightColour =
105 new wxColour( style->light[0].red >> SHIFT,
106 style->light[0].green >> SHIFT,
107 style->light[0].blue >> SHIFT );
108 };
109 return *g_systemBtnHighlightColour;
110 };
111 case wxSYS_COLOUR_HIGHLIGHT:
112 {
113 GtkStyle *style = gtk_widget_get_default_style();
114 if (!g_systemHighlightColour)
115 {
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 );
120 };
121 return *g_systemHighlightColour;
122 };
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:
128 {
129 return *wxBLACK;
130 };
131 case wxSYS_COLOUR_HIGHLIGHTTEXT:
132 {
133 return *wxWHITE;
134 };
135 case wxSYS_COLOUR_INFOBK:
136 case wxSYS_COLOUR_APPWORKSPACE:
137 {
138 return *wxWHITE; // ?
139 };
140 };
141 return *wxWHITE;
142};
143
144wxFont *g_systemFont = NULL;
145
146wxFont wxSystemSettings::GetSystemFont( int index )
147{
148 switch (index)
149 {
150 case wxSYS_OEM_FIXED_FONT:
151 case wxSYS_ANSI_FIXED_FONT:
152 case wxSYS_SYSTEM_FIXED_FONT:
153 {
154 return *wxNORMAL_FONT;
155 };
156 case wxSYS_ANSI_VAR_FONT:
157 case wxSYS_SYSTEM_FONT:
158 case wxSYS_DEVICE_DEFAULT_FONT:
159 case wxSYS_DEFAULT_GUI_FONT:
160 {
161 if (!g_systemFont)
162 g_systemFont = new wxFont( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
163 return *g_systemFont;
164 };
165 };
166
167 return wxNullFont;
168}
169;
170
171int wxSystemSettings::GetSystemMetric( int index )
172{
173 switch (index)
174 {
175 case wxSYS_SCREEN_X:
176 return gdk_screen_width();
177 case wxSYS_SCREEN_Y:
178 return gdk_screen_height();
179 };
180 return 0;
181}
182;
183