]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/settings.cpp
Hotkey fix for submenus.
[wxWidgets.git] / src / gtk / 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"
1ecc4d80 16#include "wx/debug.h"
c801d85f 17
83624f79
RR
18#include "gdk/gdk.h"
19#include "gtk/gtk.h"
20
c801d85f
KB
21/*
22#define wxSYS_COLOUR_SCROLLBAR 0
23#define wxSYS_COLOUR_BACKGROUND 1
24#define wxSYS_COLOUR_ACTIVECAPTION 2
25#define wxSYS_COLOUR_INACTIVECAPTION 3
26#define wxSYS_COLOUR_MENU 4
27#define wxSYS_COLOUR_WINDOW 5
28#define wxSYS_COLOUR_WINDOWFRAME 6
29#define wxSYS_COLOUR_MENUTEXT 7
30#define wxSYS_COLOUR_WINDOWTEXT 8
31#define wxSYS_COLOUR_CAPTIONTEXT 9
32#define wxSYS_COLOUR_ACTIVEBORDER 10
33#define wxSYS_COLOUR_INACTIVEBORDER 11
34#define wxSYS_COLOUR_APPWORKSPACE 12
35#define wxSYS_COLOUR_HIGHLIGHT 13
36#define wxSYS_COLOUR_HIGHLIGHTTEXT 14
37#define wxSYS_COLOUR_BTNFACE 15
38#define wxSYS_COLOUR_BTNSHADOW 16
39#define wxSYS_COLOUR_GRAYTEXT 17
40#define wxSYS_COLOUR_BTNTEXT 18
41#define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19
42#define wxSYS_COLOUR_BTNHIGHLIGHT 20
43
44#define wxSYS_COLOUR_3DDKSHADOW 21
45#define wxSYS_COLOUR_3DLIGHT 22
46#define wxSYS_COLOUR_INFOTEXT 23
47#define wxSYS_COLOUR_INFOBK 24
48
49#define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND
50#define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE
51#define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW
52#define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT
53#define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
54#define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
55*/
56
57#define SHIFT (8*(sizeof(short int)-sizeof(char)))
58
94129723 59//wxColour *g_systemWinColour = (wxColour *) NULL;
c67daf87
UR
60wxColour *g_systemBtnFaceColour = (wxColour *) NULL;
61wxColour *g_systemBtnShadowColour = (wxColour *) NULL;
62wxColour *g_systemBtnHighlightColour = (wxColour *) NULL;
63wxColour *g_systemHighlightColour = (wxColour *) NULL;
c801d85f 64
c67daf87 65wxFont *g_systemFont = (wxFont *) NULL;
a3622daa 66
1ecc4d80
RR
67void wxSystemSettings::Done()
68{
94129723 69// delete g_systemWinColour;
72a16063
RR
70 delete g_systemBtnFaceColour;
71 delete g_systemBtnShadowColour;
72 delete g_systemBtnHighlightColour;
73 delete g_systemHighlightColour;
74 delete g_systemFont;
a3622daa
VZ
75}
76
c801d85f
KB
77wxColour wxSystemSettings::GetSystemColour( int index )
78{
79 switch (index)
80 {
81 case wxSYS_COLOUR_SCROLLBAR:
82 case wxSYS_COLOUR_BACKGROUND:
83 case wxSYS_COLOUR_ACTIVECAPTION:
84 case wxSYS_COLOUR_INACTIVECAPTION:
85 case wxSYS_COLOUR_MENU:
c801d85f
KB
86 case wxSYS_COLOUR_WINDOWFRAME:
87 case wxSYS_COLOUR_ACTIVEBORDER:
88 case wxSYS_COLOUR_INACTIVEBORDER:
89 case wxSYS_COLOUR_BTNFACE:
90 {
c801d85f
KB
91 if (!g_systemBtnFaceColour)
92 {
93 g_systemBtnFaceColour =
94129723
RR
94 new wxColour( 0xd6d6 >> SHIFT,
95 0xd6d6 >> SHIFT,
96 0xd6d6 >> SHIFT );
ff7b1510 97 }
c801d85f 98 return *g_systemBtnFaceColour;
ff7b1510 99 }
72a16063
RR
100 case wxSYS_COLOUR_WINDOW:
101 {
94129723 102 return *wxWHITE;
72a16063 103 }
da7b3583 104 case wxSYS_COLOUR_GRAYTEXT:
c801d85f
KB
105 case wxSYS_COLOUR_BTNSHADOW:
106 {
c801d85f
KB
107 if (!g_systemBtnShadowColour)
108 {
109 g_systemBtnShadowColour =
94129723
RR
110 new wxColour( 0x7530 >> SHIFT,
111 0x7530 >> SHIFT,
112 0x7530 >> SHIFT );
ff7b1510 113 }
c801d85f 114 return *g_systemBtnShadowColour;
ff7b1510 115 }
c801d85f
KB
116 case wxSYS_COLOUR_BTNHIGHLIGHT:
117 {
c801d85f
KB
118 if (!g_systemBtnHighlightColour)
119 {
120 g_systemBtnHighlightColour =
94129723
RR
121 new wxColour( 0xea60 >> SHIFT,
122 0xea60 >> SHIFT,
123 0xea60 >> SHIFT );
ff7b1510 124 }
c801d85f 125 return *g_systemBtnHighlightColour;
ff7b1510 126 }
c801d85f
KB
127 case wxSYS_COLOUR_HIGHLIGHT:
128 {
c801d85f
KB
129 if (!g_systemHighlightColour)
130 {
131 g_systemHighlightColour =
94129723
RR
132 new wxColour( 0 >> SHIFT,
133 0 >> SHIFT,
134 0x9c40 >> SHIFT );
ff7b1510 135 }
c801d85f 136 return *g_systemHighlightColour;
ff7b1510 137 }
c801d85f
KB
138 case wxSYS_COLOUR_MENUTEXT:
139 case wxSYS_COLOUR_WINDOWTEXT:
140 case wxSYS_COLOUR_CAPTIONTEXT:
141 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
cb0f2f54 142 case wxSYS_COLOUR_BTNTEXT:
c801d85f
KB
143 case wxSYS_COLOUR_INFOTEXT:
144 {
145 return *wxBLACK;
ff7b1510 146 }
c801d85f
KB
147 case wxSYS_COLOUR_HIGHLIGHTTEXT:
148 {
149 return *wxWHITE;
ff7b1510 150 }
c801d85f
KB
151 case wxSYS_COLOUR_INFOBK:
152 case wxSYS_COLOUR_APPWORKSPACE:
153 {
154 return *wxWHITE; // ?
ff7b1510
RR
155 }
156 }
c801d85f 157 return *wxWHITE;
ff7b1510 158}
c801d85f 159
c801d85f
KB
160wxFont wxSystemSettings::GetSystemFont( int index )
161{
2d17d68f 162 switch (index)
c801d85f 163 {
2d17d68f
RR
164 case wxSYS_OEM_FIXED_FONT:
165 case wxSYS_ANSI_FIXED_FONT:
166 case wxSYS_SYSTEM_FIXED_FONT:
167 {
168 return *wxNORMAL_FONT;
169 }
170 case wxSYS_ANSI_VAR_FONT:
171 case wxSYS_SYSTEM_FONT:
172 case wxSYS_DEVICE_DEFAULT_FONT:
173 case wxSYS_DEFAULT_GUI_FONT:
174 {
175 if (!g_systemFont)
176 g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
177 return *g_systemFont;
178 }
ff7b1510 179 }
c801d85f 180
2d17d68f 181 return wxNullFont;
c801d85f 182}
c801d85f
KB
183
184int wxSystemSettings::GetSystemMetric( int index )
185{
1ecc4d80
RR
186 switch (index)
187 {
188 case wxSYS_SCREEN_X: return gdk_screen_width();
189 case wxSYS_SCREEN_Y: return gdk_screen_height();
190 case wxSYS_HSCROLL_Y: return 15;
191 case wxSYS_VSCROLL_X: return 15;
192 }
193
b019151f 194 wxCHECK_MSG( index, 0, _T("wxSystemSettings::GetSystemMetric not fully implemented") );
1ecc4d80
RR
195
196 return 0;
c67daf87 197}