Class: Wx::DarkModeSettings
- Inherits:
-
Object
- Object
- Wx::DarkModeSettings
- Defined in:
- lib/wx/doc/gen/app.rb
Overview
Allows to customize some of the settings used in MSW dark mode.
An object of this class may be passed to App#msw_enable_dark_mode 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:
wxColour GetColour(wxSystemColour index) override
{
switch ( index )
{
case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_APPWORKSPACE:
case wxSYS_COLOUR_INFOBK:
case wxSYS_COLOUR_LISTBOX:
case wxSYS_COLOUR_WINDOW:
case wxSYS_COLOUR_BTNFACE:
// Default colour used here is 0x202020.
return wxColour(0x402020);
default:
return wxDarkModeSettings::GetColour(index);
}
}
};
wxTheApp->MSWEnableDarkMode(wxApp::DarkMode_Always, new MySettings());
Instance Method Summary collapse
-
#get_border_pen ⇒ Wx::Pen
(also: #border_pen)
Get the pen to use for drawing StaticBox border in dark mode.
-
#get_colour(index) ⇒ Wx::Colour
(also: #colour)
Get the colour to use for the given system colour when dark mode is on.
-
#get_menu_colour(which) ⇒ Wx::Colour
(also: #menu_colour)
Get the colour to use for the menu bar in the given state.
-
#initialize ⇒ Wx::DarkModeSettings
constructor
Default constructor does nothing.
Constructor Details
#initialize ⇒ Wx::DarkModeSettings
Default constructor does nothing.
560 |
# File 'lib/wx/doc/gen/app.rb', line 560 def initialize; end |
Instance Method Details
#get_border_pen ⇒ Wx::Pen Also known as: border_pen
Get the pen to use for drawing StaticBox 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.
586 |
# File 'lib/wx/doc/gen/app.rb', line 586 def get_border_pen; end |
#get_colour(index) ⇒ Wx::Colour Also known as: colour
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.
568 |
# File 'lib/wx/doc/gen/app.rb', line 568 def get_colour(index) end |
#get_menu_colour(which) ⇒ Wx::Colour Also known as:
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 SystemColour values and this separate function is used for customizing them instead of #get_colour. 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 Wx::OwnerDrawn#set_text_colour. The returned colour must be valid.
578 |
# File 'lib/wx/doc/gen/app.rb', line 578 def (which) end |