1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/settings.h
3 // Purpose:     wxSystemSettings class
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     01/02/97
7 // Copyright:   (c) Julian Smart
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_SETTINGS_H_BASE_
12 #define _WX_SETTINGS_H_BASE_
13 
14 #include "wx/colour.h"
15 #include "wx/font.h"
16 
17 class WXDLLIMPEXP_FWD_CORE wxWindow;
18 
19 // possible values for wxSystemSettings::GetFont() parameter
20 //
21 // NB: wxMSW assumes that they have the same values as the parameters of
22 //     Windows GetStockObject() API, don't change the values!
23 enum wxSystemFont
24 {
25     wxSYS_OEM_FIXED_FONT = 10,
26     wxSYS_ANSI_FIXED_FONT,
27     wxSYS_ANSI_VAR_FONT,
28     wxSYS_SYSTEM_FONT,
29     wxSYS_DEVICE_DEFAULT_FONT,
30 
31     // don't use: this is here just to make the values of enum elements
32     // coincide with the corresponding MSW constants
33     wxSYS_DEFAULT_PALETTE,
34 
35     // don't use: MSDN says that this is a stock object provided only
36     // for compatibility with 16-bit Windows versions earlier than 3.0!
37     wxSYS_SYSTEM_FIXED_FONT,
38 
39     wxSYS_DEFAULT_GUI_FONT,
40 
41     // this was just a temporary aberration, do not use it any more
42     wxSYS_ICONTITLE_FONT = wxSYS_DEFAULT_GUI_FONT
43 };
44 
45 // possible values for wxSystemSettings::GetColour() parameter
46 //
47 // NB: wxMSW assumes that they have the same values as the parameters of
48 //     Windows GetSysColor() API, don't change the values!
49 enum wxSystemColour
50 {
51     wxSYS_COLOUR_SCROLLBAR,
52     wxSYS_COLOUR_DESKTOP,
53     wxSYS_COLOUR_ACTIVECAPTION,
54     wxSYS_COLOUR_INACTIVECAPTION,
55     wxSYS_COLOUR_MENU,
56     wxSYS_COLOUR_WINDOW,
57     wxSYS_COLOUR_WINDOWFRAME,
58     wxSYS_COLOUR_MENUTEXT,
59     wxSYS_COLOUR_WINDOWTEXT,
60     wxSYS_COLOUR_CAPTIONTEXT,
61     wxSYS_COLOUR_ACTIVEBORDER,
62     wxSYS_COLOUR_INACTIVEBORDER,
63     wxSYS_COLOUR_APPWORKSPACE,
64     wxSYS_COLOUR_HIGHLIGHT,
65     wxSYS_COLOUR_HIGHLIGHTTEXT,
66     wxSYS_COLOUR_BTNFACE,
67     wxSYS_COLOUR_BTNSHADOW,
68     wxSYS_COLOUR_GRAYTEXT,
69     wxSYS_COLOUR_BTNTEXT,
70     wxSYS_COLOUR_INACTIVECAPTIONTEXT,
71     wxSYS_COLOUR_BTNHIGHLIGHT,
72     wxSYS_COLOUR_3DDKSHADOW,
73     wxSYS_COLOUR_3DLIGHT,
74     wxSYS_COLOUR_INFOTEXT,
75     wxSYS_COLOUR_INFOBK,
76     wxSYS_COLOUR_LISTBOX,
77     wxSYS_COLOUR_HOTLIGHT,
78     wxSYS_COLOUR_GRADIENTACTIVECAPTION,
79     wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
80     wxSYS_COLOUR_MENUHILIGHT,
81     wxSYS_COLOUR_MENUBAR,
82     wxSYS_COLOUR_LISTBOXTEXT,
83     wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT,
84 
85     wxSYS_COLOUR_MAX,
86 
87     // synonyms
88     wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP,
89     wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
90     wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
91     wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
92     wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
93     wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
94     wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE
95 };
96 
97 // possible values for wxSystemSettings::GetMetric() index parameter
98 //
99 // NB: update the conversion table in msw/settings.cpp if you change the values
100 //     of the elements of this enum
101 enum wxSystemMetric
102 {
103     wxSYS_MOUSE_BUTTONS = 1,
104     wxSYS_BORDER_X,
105     wxSYS_BORDER_Y,
106     wxSYS_CURSOR_X,
107     wxSYS_CURSOR_Y,
108     wxSYS_DCLICK_X,
109     wxSYS_DCLICK_Y,
110     wxSYS_DRAG_X,
111     wxSYS_DRAG_Y,
112     wxSYS_EDGE_X,
113     wxSYS_EDGE_Y,
114     wxSYS_HSCROLL_ARROW_X,
115     wxSYS_HSCROLL_ARROW_Y,
116     wxSYS_HTHUMB_X,
117     wxSYS_ICON_X,
118     wxSYS_ICON_Y,
119     wxSYS_ICONSPACING_X,
120     wxSYS_ICONSPACING_Y,
121     wxSYS_WINDOWMIN_X,
122     wxSYS_WINDOWMIN_Y,
123     wxSYS_SCREEN_X,
124     wxSYS_SCREEN_Y,
125     wxSYS_FRAMESIZE_X,
126     wxSYS_FRAMESIZE_Y,
127     wxSYS_SMALLICON_X,
128     wxSYS_SMALLICON_Y,
129     wxSYS_HSCROLL_Y,
130     wxSYS_VSCROLL_X,
131     wxSYS_VSCROLL_ARROW_X,
132     wxSYS_VSCROLL_ARROW_Y,
133     wxSYS_VTHUMB_Y,
134     wxSYS_CAPTION_Y,
135     wxSYS_MENU_Y,
136     wxSYS_NETWORK_PRESENT,
137     wxSYS_PENWINDOWS_PRESENT,
138     wxSYS_SHOW_SOUNDS,
139     wxSYS_SWAP_BUTTONS,
140     wxSYS_DCLICK_MSEC,
141     wxSYS_CARET_ON_MSEC,
142     wxSYS_CARET_OFF_MSEC,
143     wxSYS_CARET_TIMEOUT_MSEC
144 };
145 
146 // possible values for wxSystemSettings::HasFeature() parameter
147 enum wxSystemFeature
148 {
149     wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
150     wxSYS_CAN_ICONIZE_FRAME,
151     wxSYS_TABLET_PRESENT
152 };
153 
154 // values for different screen designs
155 enum wxSystemScreenType
156 {
157     wxSYS_SCREEN_NONE = 0,  //   not yet defined
158 
159     wxSYS_SCREEN_TINY,      //   <
160     wxSYS_SCREEN_PDA,       //   >= 320x240
161     wxSYS_SCREEN_SMALL,     //   >= 640x480
162     wxSYS_SCREEN_DESKTOP    //   >= 800x600
163 };
164 
165 // ----------------------------------------------------------------------------
166 // wxSystemAppearance: describes the global appearance used for the UI
167 // ----------------------------------------------------------------------------
168 
169 class WXDLLIMPEXP_CORE wxSystemAppearance
170 {
171 public:
172     // Return the name if available or empty string otherwise.
173     wxString GetName() const;
174 
175     // Return true if the current system there is explicitly recognized as
176     // being a dark theme or if the default window background is dark.
177     bool IsDark() const;
178 
179     // Return true if the background is darker than foreground. This is used by
180     // IsDark() if there is no platform-specific way to determine whether a
181     // dark mode is being used.
182     bool IsUsingDarkBackground() const;
183 
184 private:
185     friend class wxSystemSettingsNative;
186 
187     // Ctor is private, even though it's trivial, because objects of this type
188     // are only supposed to be created by wxSystemSettingsNative.
wxSystemAppearance()189     wxSystemAppearance() { }
190 
191     // Currently this class doesn't have any internal state because the only
192     // available implementation doesn't need it. If we do need it later, we
193     // could add some "wxSystemAppearanceImpl* const m_impl" here, which we'd
194     // forward our public functions to (we'd also need to add the copy ctor and
195     // dtor to clone/free it).
196 };
197 
198 // ----------------------------------------------------------------------------
199 // wxSystemSettingsNative: defines the API for wxSystemSettings class
200 // ----------------------------------------------------------------------------
201 
202 // this is a namespace rather than a class: it has only non virtual static
203 // functions
204 //
205 // also note that the methods are implemented in the platform-specific source
206 // files (i.e. this is not a real base class as we can't override its virtual
207 // functions because it doesn't have any)
208 
209 class WXDLLIMPEXP_CORE wxSystemSettingsNative
210 {
211 public:
212     // get a standard system colour
213     static wxColour GetColour(wxSystemColour index);
214 
215     // get a standard system font
216     static wxFont GetFont(wxSystemFont index);
217 
218     // get a system-dependent metric
219     static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL);
220 
221     // get the object describing the current system appearance
222     static wxSystemAppearance GetAppearance();
223 
224     // return true if the port has certain feature
225     static bool HasFeature(wxSystemFeature index);
226 };
227 
228 // ----------------------------------------------------------------------------
229 // include the declaration of the real platform-dependent class
230 // ----------------------------------------------------------------------------
231 
232 class WXDLLIMPEXP_CORE wxSystemSettings : public wxSystemSettingsNative
233 {
234 public:
235 #ifdef __WXUNIVERSAL__
236     // in wxUniversal we want to use the theme standard colours instead of the
237     // system ones, otherwise wxSystemSettings is just the same as
238     // wxSystemSettingsNative
239     static wxColour GetColour(wxSystemColour index);
240 
241     // some metrics are toolkit-dependent and provided by wxUniv, some are
242     // lowlevel
243     static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL);
244 #endif // __WXUNIVERSAL__
245 
246     // Get system screen design (desktop, pda, ..) used for
247     // laying out various dialogs.
248     static wxSystemScreenType GetScreenType();
249 
250     // Override default.
251     static void SetScreenType( wxSystemScreenType screen );
252 
253     // Value
254     static wxSystemScreenType ms_screen;
255 
256 };
257 
258 #endif
259     // _WX_SETTINGS_H_BASE_
260 
261