2008-03-08 08:52:38 -05:00
/////////////////////////////////////////////////////////////////////////////
// Name: settings.h
2008-03-10 11:24:38 -04:00
// Purpose: interface of wxSystemSettings
2008-03-08 08:52:38 -05:00
// Author: wxWidgets team
2010-07-13 09:29:13 -04:00
// Licence: wxWindows licence
2008-03-08 08:52:38 -05:00
/////////////////////////////////////////////////////////////////////////////
2008-10-04 10:30:56 -04:00
/**
Possible values for wxSystemSettings : : GetFont ( ) parameter .
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
These values map 1 : 1 the native values supported by the Windows ' @ c GetStockObject
function . Note that other ports ( other than wxMSW ) will try to provide meaningful
fonts but they usually map the same font to various @ c wxSYS_ * _FONT values .
2008-10-04 10:30:56 -04:00
*/
enum wxSystemFont
{
2009-03-04 10:19:58 -05:00
/// Original equipment manufacturer dependent fixed-pitch font.
wxSYS_OEM_FIXED_FONT = 10 ,
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
/// Windows fixed-pitch (monospaced) font.
wxSYS_ANSI_FIXED_FONT ,
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
/// Windows variable-pitch (proportional) font.
wxSYS_ANSI_VAR_FONT ,
2009-03-04 10:53:55 -05:00
/// System font. By default, the system uses the system font to draw menus,
2009-03-04 10:19:58 -05:00
/// dialog box controls, and text.
wxSYS_SYSTEM_FONT ,
2009-03-04 10:53:55 -05:00
2015-08-31 03:57:53 -04:00
/// Device-dependent font.
2009-03-04 10:19:58 -05:00
wxSYS_DEVICE_DEFAULT_FONT ,
2008-10-04 10:30:56 -04:00
/**
Default font for user interface objects such as menus and dialog boxes .
Note that with modern GUIs nothing guarantees that the same font is used
for all GUI elements , so some controls might use a different font by default .
*/
wxSYS_DEFAULT_GUI_FONT
} ;
/**
Possible values for wxSystemSettings : : GetColour ( ) parameter .
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
These values map 1 : 1 the native values supported by the Windows ' @ c GetSysColor
function . Note that other ports ( other than wxMSW ) will try to provide meaningful
colours but they usually map the same colour to various @ c wxSYS_COLOUR_ * values .
2008-10-04 10:30:56 -04:00
*/
enum wxSystemColour
{
wxSYS_COLOUR_SCROLLBAR , //!< The scrollbar grey area.
2009-03-04 10:19:58 -05:00
wxSYS_COLOUR_DESKTOP , //!< The desktop colour.
wxSYS_COLOUR_ACTIVECAPTION , //!< Active window caption colour.
wxSYS_COLOUR_INACTIVECAPTION , //!< Inactive window caption colour.
wxSYS_COLOUR_MENU , //!< Menu background colour.
wxSYS_COLOUR_WINDOW , //!< Window background colour.
wxSYS_COLOUR_WINDOWFRAME , //!< Window frame colour.
wxSYS_COLOUR_MENUTEXT , //!< Colour of the text used in the menus.
wxSYS_COLOUR_WINDOWTEXT , //!< Colour of the text used in generic windows.
wxSYS_COLOUR_CAPTIONTEXT , //!< Colour of the text used in captions, size boxes and scrollbar arrow boxes.
wxSYS_COLOUR_ACTIVEBORDER , //!< Active window border colour.
wxSYS_COLOUR_INACTIVEBORDER , //!< Inactive window border colour.
wxSYS_COLOUR_APPWORKSPACE , //!< Background colour for MDI applications.
wxSYS_COLOUR_HIGHLIGHT , //!< Colour of item(s) selected in a control.
wxSYS_COLOUR_HIGHLIGHTTEXT , //!< Colour of the text of item(s) selected in a control.
wxSYS_COLOUR_BTNFACE , //!< Face shading colour on push buttons.
wxSYS_COLOUR_BTNSHADOW , //!< Edge shading colour on push buttons.
wxSYS_COLOUR_GRAYTEXT , //!< Colour of greyed (disabled) text.
wxSYS_COLOUR_BTNTEXT , //!< Colour of the text on push buttons.
wxSYS_COLOUR_INACTIVECAPTIONTEXT , //!< Colour of the text in active captions.
wxSYS_COLOUR_BTNHIGHLIGHT , //!< Highlight colour for buttons.
wxSYS_COLOUR_3DDKSHADOW , //!< Dark shadow colour for three-dimensional display elements.
2008-10-04 10:30:56 -04:00
wxSYS_COLOUR_3DLIGHT , //!< Light colour for three-dimensional display elements.
wxSYS_COLOUR_INFOTEXT , //!< Text colour for tooltip controls.
wxSYS_COLOUR_INFOBK , //!< Background colour for tooltip controls.
2011-04-03 16:31:32 -04:00
wxSYS_COLOUR_LISTBOX , //!< Background colour for list-like controls.
2009-03-04 10:19:58 -05:00
wxSYS_COLOUR_HOTLIGHT , //!< Colour for a hyperlink or hot-tracked item.
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
/**
2020-06-22 12:31:14 -04:00
Right side colour in the colour gradient of an active window ' s title
bar . @ c wxSYS_COLOUR_ACTIVECAPTION specifies the left side colour .
2009-03-04 10:19:58 -05:00
*/
2008-10-04 10:30:56 -04:00
wxSYS_COLOUR_GRADIENTACTIVECAPTION ,
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
/**
2020-06-22 12:31:14 -04:00
Right side colour in the colour gradient of an inactive window ' s title
bar . @ c wxSYS_COLOUR_INACTIVECAPTION specifies the left side colour .
2009-03-04 10:19:58 -05:00
*/
2008-10-04 10:30:56 -04:00
wxSYS_COLOUR_GRADIENTINACTIVECAPTION ,
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
/**
2009-03-04 10:53:55 -05:00
The colour used to highlight menu items when the menu appears as a flat menu .
2009-03-04 10:19:58 -05:00
The highlighted menu item is outlined with @ c wxSYS_COLOUR_HIGHLIGHT .
*/
2008-10-04 10:30:56 -04:00
wxSYS_COLOUR_MENUHILIGHT ,
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
/**
2009-03-04 10:53:55 -05:00
The background colour for the menu bar when menus appear as flat menus .
2020-06-22 12:31:14 -04:00
However , @ c wxSYS_COLOUR_MENU continues to specify the background colour of the menu popup .
2009-03-04 10:19:58 -05:00
*/
2008-10-04 10:30:56 -04:00
wxSYS_COLOUR_MENUBAR ,
2009-03-04 10:53:55 -05:00
2008-12-25 08:03:24 -05:00
/**
Text colour for list - like controls .
2009-03-04 10:53:55 -05:00
2008-12-25 08:03:24 -05:00
@ since 2.9 .0
*/
wxSYS_COLOUR_LISTBOXTEXT ,
2008-10-04 10:30:56 -04:00
2011-02-25 04:38:35 -05:00
/**
Text colour for the unfocused selection of list - like controls .
@ since 2.9 .1
*/
wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ,
2009-03-04 10:53:55 -05:00
wxSYS_COLOUR_MAX
2009-03-04 10:19:58 -05:00
// synonyms:
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP ,
//!< Synonym for @c wxSYS_COLOUR_DESKTOP.
wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE ,
//!< Synonym for @c wxSYS_COLOUR_BTNFACE.
wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW ,
//!< Synonym for @c wxSYS_COLOUR_BTNSHADOW.
wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT ,
//!< Synonym for @c wxSYS_COLOUR_BTNHIGHLIGHT.
wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT ,
//!< Synonym for @c wxSYS_COLOUR_BTNHIGHLIGHT.
wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT ,
//!< Synonym for @c wxSYS_COLOUR_BTNHIGHLIGHT.
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
/**
2011-04-03 16:31:32 -04:00
Synonym for @ c wxSYS_COLOUR_BTNFACE .
2009-03-04 10:53:55 -05:00
2009-03-04 10:19:58 -05:00
On wxMSW this colour should be used as the background colour of
wxFrames which are used as containers of controls ; this is in fact the
2009-03-04 10:53:55 -05:00
same colour used for the borders of controls like e . g . wxNotebook or
for the background of e . g . wxPanel .
2009-03-04 10:19:58 -05:00
@ since 2.9 .0
*/
2009-03-04 10:53:55 -05:00
wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE
2008-10-04 10:30:56 -04:00
} ;
/**
Possible values for wxSystemSettings : : GetMetric ( ) index parameter .
*/
enum wxSystemMetric
{
wxSYS_MOUSE_BUTTONS , //!< Number of buttons on mouse, or zero if no mouse was installed.
wxSYS_BORDER_X , //!< Width of single border.
wxSYS_BORDER_Y , //!< Height of single border.
wxSYS_CURSOR_X , //!< Width of cursor.
wxSYS_CURSOR_Y , //!< Height of cursor.
wxSYS_DCLICK_X , //!< Width in pixels of rectangle within which two successive mouse clicks must fall to generate a double-click.
wxSYS_DCLICK_Y , //!< Height in pixels of rectangle within which two successive mouse clicks must fall to generate a double-click.
wxSYS_DRAG_X , //!< Width in pixels of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins.
wxSYS_DRAG_Y , //!< Height in pixels of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins.
wxSYS_EDGE_X , //!< Width of a 3D border, in pixels.
wxSYS_EDGE_Y , //!< Height of a 3D border, in pixels.
wxSYS_HSCROLL_ARROW_X , //!< Width of arrow bitmap on horizontal scrollbar.
wxSYS_HSCROLL_ARROW_Y , //!< Height of arrow bitmap on horizontal scrollbar.
wxSYS_HTHUMB_X , //!< Width of horizontal scrollbar thumb.
wxSYS_ICON_X , //!< The default width of an icon.
wxSYS_ICON_Y , //!< The default height of an icon.
wxSYS_ICONSPACING_X , //!< Width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged.
wxSYS_ICONSPACING_Y , //!< Height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged.
wxSYS_WINDOWMIN_X , //!< Minimum width of a window.
wxSYS_WINDOWMIN_Y , //!< Minimum height of a window.
wxSYS_SCREEN_X , //!< Width of the screen in pixels.
wxSYS_SCREEN_Y , //!< Height of the screen in pixels.
wxSYS_FRAMESIZE_X , //!< Width of the window frame for a wxTHICK_FRAME window.
wxSYS_FRAMESIZE_Y , //!< Height of the window frame for a wxTHICK_FRAME window.
wxSYS_SMALLICON_X , //!< Recommended width of a small icon (in window captions, and small icon view).
wxSYS_SMALLICON_Y , //!< Recommended height of a small icon (in window captions, and small icon view).
wxSYS_HSCROLL_Y , //!< Height of horizontal scrollbar in pixels.
wxSYS_VSCROLL_X , //!< Width of vertical scrollbar in pixels.
wxSYS_VSCROLL_ARROW_X , //!< Width of arrow bitmap on a vertical scrollbar.
wxSYS_VSCROLL_ARROW_Y , //!< Height of arrow bitmap on a vertical scrollbar.
wxSYS_VTHUMB_Y , //!< Height of vertical scrollbar thumb.
wxSYS_CAPTION_Y , //!< Height of normal caption area.
wxSYS_MENU_Y , //!< Height of single-line menu bar.
wxSYS_NETWORK_PRESENT , //!< 1 if there is a network present, 0 otherwise.
wxSYS_PENWINDOWS_PRESENT , //!< 1 if PenWindows is installed, 0 otherwise.
wxSYS_SHOW_SOUNDS , //!< Non-zero if the user requires an application to present information
//!< visually in situations where it would otherwise present the information
//!< only in audible form; zero otherwise.
wxSYS_SWAP_BUTTONS , //!< Non-zero if the meanings of the left and right mouse buttons are swapped; zero otherwise.
2016-08-19 16:55:20 -04:00
wxSYS_DCLICK_MSEC , //!< Maximal time, in milliseconds, which may pass between subsequent clicks for a double click to be generated.
/**
Time , in milliseconds , for how long a blinking caret should
stay visible during a single blink cycle before it disappears .
2019-04-18 12:01:47 -04:00
If this value is zero , caret should be visible all the time
instead of blinking . If the value is negative , the platform
does not support the user setting .
2016-08-19 16:55:20 -04:00
@ since 3.1 .1
*/
wxSYS_CARET_ON_MSEC ,
/**
Time , in milliseconds , for how long a blinking caret should
stay invisible during a single blink cycle before it reappears .
2019-04-18 12:01:47 -04:00
If this value is zero , caret should be visible all the time
2016-08-19 16:55:20 -04:00
instead of blinking . If the value is negative , the platform
2019-04-09 10:13:39 -04:00
does not support the user setting .
2016-08-19 16:55:20 -04:00
@ since 3.1 .1
*/
wxSYS_CARET_OFF_MSEC ,
/**
Time , in milliseconds , for how long a caret should blink after
a user interaction . After this timeout has expired , the caret
should stay continuously visible until the user interacts with
the caret again ( for example by entering , deleting or cutting
text ) . If this value is negative , carets should blink forever ;
if it is zero , carets should not blink at all .
@ since 3.1 .1
*/
wxSYS_CARET_TIMEOUT_MSEC
2008-10-04 10:30:56 -04:00
} ;
/**
Possible values for wxSystemSettings : : HasFeature ( ) parameter .
*/
enum wxSystemFeature
{
wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1 ,
wxSYS_CAN_ICONIZE_FRAME ,
wxSYS_TABLET_PRESENT
} ;
/**
2009-03-04 10:53:55 -05:00
Values for different screen designs . See wxSystemSettings : : GetScreenType ( ) .
2008-10-04 10:30:56 -04:00
*/
enum wxSystemScreenType
{
wxSYS_SCREEN_NONE = 0 , //!< Undefined screen type.
wxSYS_SCREEN_TINY , //!< Tiny screen, less than 320x240
wxSYS_SCREEN_PDA , //!< PDA screen, 320x240 or more but less than 640x480
wxSYS_SCREEN_SMALL , //!< Small screen, 640x480 or more but less than 800x600
wxSYS_SCREEN_DESKTOP //!< Desktop screen, 800x600 or more
} ;
2019-04-15 19:50:41 -04:00
/**
Provides information about the current system appearance .
An object of this class can be retrieved using
wxSystemSettings : : GetAppearance ( ) and can then be queried for some aspects
of the current system appearance , notably whether the system is using a
dark theme , i . e . a theme with predominantly dark background .
This is useful for custom controls that don ' t use the standard system
colours , as they need to adjust the colours used for drawing them to fit in
the system look .
@ since 3.1 .3
*/
class wxSystemAppearance
{
public :
/**
Return the name if available or empty string otherwise .
2020-07-04 15:28:13 -04:00
This is currently only implemented for macOS and returns
2019-04-15 19:50:41 -04:00
a not necessarily user - readable string such as " NSAppearanceNameAqua "
there and an empty string under all the other platforms .
*/
wxString GetName ( ) const ;
/**
Return true if the current system there is explicitly recognized as
being a dark theme or if the default window background is dark .
This method should be used to check whether custom colours more
appropriate for the default ( light ) or dark appearance should be used .
*/
bool IsDark ( ) const ;
/**
Return true if the default window background is significantly darker
than foreground .
This is used by IsDark ( ) if there is no platform - specific way to
determine whether a dark mode is being used and is generally not very
useful to call directly .
@ see wxColour : : GetLuminance ( )
*/
bool IsUsingDarkBackground ( ) const ;
} ;
2008-03-08 08:52:38 -05:00
/**
@ class wxSystemSettings
2008-03-08 09:43:31 -05:00
2008-10-04 10:30:56 -04:00
wxSystemSettings allows the application to ask for details about the system .
2009-03-24 19:13:02 -04:00
2019-01-30 11:28:08 -05:00
This can include settings such as standard colours , fonts , and user interface
2009-03-24 19:13:02 -04:00
element sizes .
2008-03-08 09:43:31 -05:00
2008-03-08 08:52:38 -05:00
@ library { wxcore }
2009-02-20 06:34:52 -05:00
@ category { cfg }
2008-03-08 09:43:31 -05:00
2009-03-04 10:53:55 -05:00
@ see wxFont , wxColour , wxSystemOptions
2008-03-08 08:52:38 -05:00
*/
2017-01-21 21:06:03 -05:00
class wxSystemSettings
2008-03-08 08:52:38 -05:00
{
public :
/**
2008-10-04 10:30:56 -04:00
Default constructor .
You don ' t need to create an instance of wxSystemSettings
2008-03-08 08:52:38 -05:00
since all of its functions are static .
*/
wxSystemSettings ( ) ;
/**
Returns a system colour .
2009-03-24 19:13:02 -04:00
2019-01-30 11:28:08 -05:00
@ param index
2009-03-24 19:13:02 -04:00
Can be one of the : : wxSystemColour enum values .
2019-01-30 11:28:08 -05:00
2009-03-24 19:13:02 -04:00
@ return
The returned colour is always valid .
2008-03-08 08:52:38 -05:00
*/
static wxColour GetColour ( wxSystemColour index ) ;
/**
Returns a system font .
2009-03-24 19:13:02 -04:00
2019-01-30 11:28:08 -05:00
@ param index
2009-03-24 19:13:02 -04:00
Can be one of the : : wxSystemFont enum values .
2019-01-30 11:28:08 -05:00
2009-03-24 19:13:02 -04:00
@ return
The returned font is always valid .
2008-03-08 08:52:38 -05:00
*/
static wxFont GetFont ( wxSystemFont index ) ;
/**
Returns the value of a system metric , or - 1 if the metric is not supported on
the current system .
2008-10-04 10:30:56 -04:00
2008-03-09 08:33:59 -04:00
The value of @ a win determines if the metric returned is a global value or
2008-03-08 08:52:38 -05:00
a wxWindow based value , in which case it might determine the widget , the
display the window is on , or something similar . The window given should be as
2011-04-03 16:31:32 -04:00
close to the metric as possible ( e . g . a wxTopLevelWindow in case of the
2008-10-04 10:30:56 -04:00
wxSYS_CAPTION_Y metric ) .
2008-03-20 09:45:17 -04:00
2008-10-04 10:30:56 -04:00
@ a index can be one of the : : wxSystemMetric enum values .
2008-03-20 09:45:17 -04:00
2008-03-09 08:33:59 -04:00
@ a win is a pointer to the window for which the metric is requested .
Specifying the @ a win parameter is encouraged , because some metrics on some
2008-10-04 10:30:56 -04:00
ports are not supported without one , or they might be capable of reporting
better values if given one . If a window does not make sense for a metric ,
2008-03-08 08:52:38 -05:00
one should still be given , as for example it might determine which displays
2008-10-04 10:30:56 -04:00
cursor width is requested with wxSYS_CURSOR_X .
2008-03-08 08:52:38 -05:00
*/
2008-03-09 08:33:59 -04:00
static int GetMetric ( wxSystemMetric index , wxWindow * win = NULL ) ;
2008-03-08 08:52:38 -05:00
/**
2008-10-04 10:30:56 -04:00
Returns the screen type .
The return value is one of the : : wxSystemScreenType enum values .
2008-03-08 08:52:38 -05:00
*/
static wxSystemScreenType GetScreenType ( ) ;
2009-03-04 10:53:55 -05:00
2019-04-15 19:50:41 -04:00
/**
Returns the object describing the current system appearance .
@ since 3.1 .3
*/
static wxSystemAppearance GetAppearance ( ) ;
2009-03-04 10:53:55 -05:00
/**
Returns @ true if the port has certain feature .
See the : : wxSystemFeature enum values .
*/
static bool HasFeature ( wxSystemFeature index ) ;
2008-03-08 08:52:38 -05:00
} ;
2008-03-10 11:24:38 -04:00