Version: 3.3.0
wxDarkModeSettings Class Reference

#include <wx/msw/darkmode.h>

Detailed Description

Allows to customize some of the settings used in MSW dark mode.

An object of this class may be passed to wxApp::MSWEnableDarkMode() to customize some aspects of the dark mode when it is used under MSW systems.

For example, to customize the background colour to use a reddish black instead of normal black used by default, you could do the following:

class MySettings : public wxDarkModeSettings
{
public:
{
switch ( index )
{
// Default colour used here is 0x202020.
return wxColour(0x402020);
default:
}
}
};
wxTheApp->MSWEnableDarkMode(wxApp::DarkMode_Always, new MySettings());
bool MSWEnableDarkMode(int flags=0, wxDarkModeSettings *settings=nullptr)
Enable experimental dark mode support for MSW applications.
A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values and a...
Definition: colour.h:69
Allows to customize some of the settings used in MSW dark mode.
Definition: darkmode.h:67
virtual wxColour GetColour(wxSystemColour index)
Get the colour to use for the given system colour when dark mode is on.
wxApp * wxTheApp
The global pointer to the singleton wxApp object.
Definition: app.h:1430
wxSystemColour
Possible values for wxSystemSettings::GetColour() parameter.
Definition: settings.h:51
@ wxSYS_COLOUR_INFOBK
Background colour for tooltip controls.
Definition: settings.h:76
@ wxSYS_COLOUR_WINDOW
Window background colour.
Definition: settings.h:57
@ wxSYS_COLOUR_APPWORKSPACE
Background colour for MDI applications.
Definition: settings.h:64
@ wxSYS_COLOUR_LISTBOX
Background colour for list-like controls.
Definition: settings.h:77
@ wxSYS_COLOUR_ACTIVECAPTION
Active window caption colour.
Definition: settings.h:54
@ wxSYS_COLOUR_BTNFACE
Face shading colour on push buttons.
Definition: settings.h:67
Since
3.3.0

Public Member Functions

 wxDarkModeSettings ()=default
 Default constructor does nothing. More...
 
virtual wxColour GetColour (wxSystemColour index)
 Get the colour to use for the given system colour when dark mode is on. More...
 
virtual wxColour GetMenuColour (wxMenuColour which)
 Get the colour to use for the menu bar in the given state. More...
 
virtual wxPen GetBorderPen ()
 Get the pen to use for drawing wxStaticBox border in dark mode. More...
 

Constructor & Destructor Documentation

◆ wxDarkModeSettings()

wxDarkModeSettings::wxDarkModeSettings ( )
default

Default constructor does nothing.

Member Function Documentation

◆ GetBorderPen()

virtual wxPen wxDarkModeSettings::GetBorderPen ( )
virtual

Get the pen to use for drawing wxStaticBox border in dark mode.

Returning an invalid pen indicates that the default border drawn by the system should be used, which doesn't look very well in dark mode but shouldn't result in any problems worse than cosmetic ones.

The base class version returns a grey pen, which looks better than the default white one.

◆ GetColour()

virtual wxColour wxDarkModeSettings::GetColour ( wxSystemColour  index)
virtual

Get the colour to use for the given system colour when dark mode is on.

The base class version of this function returns the colours commonly used in dark mode. As the rest of dark mode support, their exact values are not documented and are subject to change in the future Windows or wxWidgets versions.

See also
GetMenuColour()

◆ GetMenuColour()

virtual wxColour wxDarkModeSettings::GetMenuColour ( wxMenuColour  which)
virtual

Get the colour to use for the menu bar in the given state.

Currently the colours used by the menus in the menu bar in dark mode don't correspond to any of wxSystemColour values and this separate function is used for customizing them instead of GetColour().

Note that the colours returned by this function only affect the top level menus, the colours of the menu items inside them can be customized in the usual way using wxOwnerDrawn::SetTextColour().

The returned colour must be valid.