gi-adwaita-1.0.3: Adwaita bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Adw.Objects.StyleManager

Description

A class for managing application-wide styling.

AdwStyleManager provides a way to query and influence the application styles, such as whether to use dark or high contrast appearance.

It allows to set the color scheme via the [propertystyleManager:color-scheme] property, and to query the current appearance, as well as whether a system-wide color scheme preference exists.

Since: 1.0

Synopsis

Exported types

newtype StyleManager Source #

Memory-managed wrapper type.

Constructors

StyleManager (ManagedPtr StyleManager) 

Instances

Instances details
Eq StyleManager Source # 
Instance details

Defined in GI.Adw.Objects.StyleManager

GObject StyleManager Source # 
Instance details

Defined in GI.Adw.Objects.StyleManager

ManagedPtrNewtype StyleManager Source # 
Instance details

Defined in GI.Adw.Objects.StyleManager

Methods

toManagedPtr :: StyleManager -> ManagedPtr StyleManager

TypedObject StyleManager Source # 
Instance details

Defined in GI.Adw.Objects.StyleManager

Methods

glibType :: IO GType

HasParentTypes StyleManager Source # 
Instance details

Defined in GI.Adw.Objects.StyleManager

IsGValue (Maybe StyleManager) Source #

Convert StyleManager to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Adw.Objects.StyleManager

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe StyleManager -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe StyleManager)

type ParentTypes StyleManager Source # 
Instance details

Defined in GI.Adw.Objects.StyleManager

type ParentTypes StyleManager = '[Object]

class (GObject o, IsDescendantOf StyleManager o) => IsStyleManager o Source #

Type class for types which can be safely cast to StyleManager, for instance with toStyleManager.

Instances

Instances details
(GObject o, IsDescendantOf StyleManager o) => IsStyleManager o Source # 
Instance details

Defined in GI.Adw.Objects.StyleManager

toStyleManager :: (MonadIO m, IsStyleManager o) => o -> m StyleManager Source #

Cast to StyleManager, for types for which this is known to be safe. For general casts, use castTo.

Methods

getColorScheme

styleManagerGetColorScheme Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleManager a) 
=> a

self: a style manager

-> m ColorScheme

Returns: the color scheme

Gets the requested application color scheme.

Since: 1.0

getDark

styleManagerGetDark Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleManager a) 
=> a

self: a style manager

-> m Bool

Returns: whether the application is using dark appearance

Gets whether the application is using dark appearance.

This can be used to query the current appearance, as requested via [propertystyleManager:color-scheme].

Since: 1.0

getDefault

styleManagerGetDefault Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m StyleManager

Returns: the default style manager

Gets the default AdwStyleManager instance.

It manages all Display instances unless the style manager for that display has an override.

See StyleManager.get_for_display.

Since: 1.0

getDisplay

styleManagerGetDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleManager a) 
=> a

self: a style manager

-> m Display

Returns: (nullable): the display

Gets the display the style manager is associated with.

The display will be NULL for the style manager returned by StyleManager.get_default.

Since: 1.0

getForDisplay

styleManagerGetForDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a) 
=> a

display: a GdkDisplay

-> m StyleManager

Returns: the style manager for display

Gets the AdwStyleManager instance managing display.

It can be used to override styles for that specific display instead of the whole application.

Most applications should use StyleManager.get_default instead.

Since: 1.0

getHighContrast

styleManagerGetHighContrast Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleManager a) 
=> a

self: a style manager

-> m Bool

Returns: whether the application is using high contrast appearance

Gets whether the application is using high contrast appearance.

This cannot be overridden by applications.

Since: 1.0

getSystemSupportsColorSchemes

styleManagerGetSystemSupportsColorSchemes Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleManager a) 
=> a

self: a style manager

-> m Bool

Returns: whether the system supports color schemes

Gets whether the system supports color schemes.

This can be used to check if the current environment provides a color scheme preference. For example, applications might want to show a separate appearance switcher if it's set to FALSE.

Since: 1.0

setColorScheme

styleManagerSetColorScheme Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleManager a) 
=> a

self: a style manager

-> ColorScheme

colorScheme: the color scheme

-> m () 

Sets the requested application color scheme.

The effective appearance will be decided based on the application color scheme and the system preferred color scheme. The [propertystyleManager:dark] property can be used to query the current effective appearance.

The ADW_COLOR_SCHEME_PREFER_LIGHT color scheme results in the application using light appearance unless the system prefers dark colors. This is the default value.

The ADW_COLOR_SCHEME_PREFER_DARK color scheme results in the application using dark appearance, but can still switch to the light appearance if the system can prefers it, for example, when the high contrast preference is enabled.

The ADW_COLOR_SCHEME_FORCE_LIGHT and ADW_COLOR_SCHEME_FORCE_DARK values ignore the system preference entirely. They are useful if the application wants to match its UI to its content or to provide a separate color scheme switcher.

If a per-tDisplay style manager has its color scheme set to ADW_COLOR_SCHEME_DEFAULT, it will inherit the color scheme from the default style manager.

For the default style manager, ADW_COLOR_SCHEME_DEFAULT is equivalent to ADW_COLOR_SCHEME_PREFER_LIGHT.

The [propertystyleManager:system-supports-color-schemes] property can be used to check if the current environment provides a color scheme preference.

Since: 1.0

Properties

colorScheme

The requested application color scheme.

The effective appearance will be decided based on the application color scheme and the system preferred color scheme. The [propertystyleManager:dark] property can be used to query the current effective appearance.

The ADW_COLOR_SCHEME_PREFER_LIGHT color scheme results in the application using light appearance unless the system prefers dark colors. This is the default value.

The ADW_COLOR_SCHEME_PREFER_DARK color scheme results in the application using dark appearance, but can still switch to the light appearance if the system can prefers it, for example, when the high contrast preference is enabled.

The ADW_COLOR_SCHEME_FORCE_LIGHT and ADW_COLOR_SCHEME_FORCE_DARK values ignore the system preference entirely. They are useful if the application wants to match its UI to its content or to provide a separate color scheme switcher.

If a per-tDisplay style manager has its color scheme set to ADW_COLOR_SCHEME_DEFAULT, it will inherit the color scheme from the default style manager.

For the default style manager, ADW_COLOR_SCHEME_DEFAULT is equivalent to ADW_COLOR_SCHEME_PREFER_LIGHT.

The [propertystyleManager:system-supports-color-schemes] property can be used to check if the current environment provides a color scheme preference.

Since: 1.0

constructStyleManagerColorScheme :: (IsStyleManager o, MonadIO m) => ColorScheme -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “color-scheme” property. This is rarely needed directly, but it is used by new.

getStyleManagerColorScheme :: (MonadIO m, IsStyleManager o) => o -> m ColorScheme Source #

Get the value of the “color-scheme” property. When overloading is enabled, this is equivalent to

get styleManager #colorScheme

setStyleManagerColorScheme :: (MonadIO m, IsStyleManager o) => o -> ColorScheme -> m () Source #

Set the value of the “color-scheme” property. When overloading is enabled, this is equivalent to

set styleManager [ #colorScheme := value ]

dark

Whether the application is using dark appearance.

This property can be used to query the current appearance, as requested via [propertystyleManager:color-scheme].

Since: 1.0

getStyleManagerDark :: (MonadIO m, IsStyleManager o) => o -> m Bool Source #

Get the value of the “dark” property. When overloading is enabled, this is equivalent to

get styleManager #dark

display

The display the style manager is associated with.

The display will be NULL for the style manager returned by StyleManager.get_default.

Since: 1.0

constructStyleManagerDisplay :: (IsStyleManager o, MonadIO m, IsDisplay a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “display” property. This is rarely needed directly, but it is used by new.

getStyleManagerDisplay :: (MonadIO m, IsStyleManager o) => o -> m Display Source #

Get the value of the “display” property. When overloading is enabled, this is equivalent to

get styleManager #display

highContrast

Whether the application is using high contrast appearance.

This cannot be overridden by applications.

Since: 1.0

getStyleManagerHighContrast :: (MonadIO m, IsStyleManager o) => o -> m Bool Source #

Get the value of the “high-contrast” property. When overloading is enabled, this is equivalent to

get styleManager #highContrast

systemSupportsColorSchemes

Whether the system supports color schemes.

This property can be used to check if the current environment provides a color scheme preference. For example, applications might want to show a separate appearance switcher if it's set to FALSE.

See [propertystyleManager:color-scheme].

Since: 1.0

getStyleManagerSystemSupportsColorSchemes :: (MonadIO m, IsStyleManager o) => o -> m Bool Source #

Get the value of the “system-supports-color-schemes” property. When overloading is enabled, this is equivalent to

get styleManager #systemSupportsColorSchemes