Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype StyleManager = StyleManager (ManagedPtr StyleManager)
- class (GObject o, IsDescendantOf StyleManager o) => IsStyleManager o
- toStyleManager :: (MonadIO m, IsStyleManager o) => o -> m StyleManager
- styleManagerGetColorScheme :: (HasCallStack, MonadIO m, IsStyleManager a) => a -> m ColorScheme
- styleManagerGetDark :: (HasCallStack, MonadIO m, IsStyleManager a) => a -> m Bool
- styleManagerGetDefault :: (HasCallStack, MonadIO m) => m StyleManager
- styleManagerGetDisplay :: (HasCallStack, MonadIO m, IsStyleManager a) => a -> m Display
- styleManagerGetForDisplay :: (HasCallStack, MonadIO m, IsDisplay a) => a -> m StyleManager
- styleManagerGetHighContrast :: (HasCallStack, MonadIO m, IsStyleManager a) => a -> m Bool
- styleManagerGetSystemSupportsColorSchemes :: (HasCallStack, MonadIO m, IsStyleManager a) => a -> m Bool
- styleManagerSetColorScheme :: (HasCallStack, MonadIO m, IsStyleManager a) => a -> ColorScheme -> m ()
- constructStyleManagerColorScheme :: (IsStyleManager o, MonadIO m) => ColorScheme -> m (GValueConstruct o)
- getStyleManagerColorScheme :: (MonadIO m, IsStyleManager o) => o -> m ColorScheme
- setStyleManagerColorScheme :: (MonadIO m, IsStyleManager o) => o -> ColorScheme -> m ()
- getStyleManagerDark :: (MonadIO m, IsStyleManager o) => o -> m Bool
- constructStyleManagerDisplay :: (IsStyleManager o, MonadIO m, IsDisplay a) => a -> m (GValueConstruct o)
- getStyleManagerDisplay :: (MonadIO m, IsStyleManager o) => o -> m Display
- getStyleManagerHighContrast :: (MonadIO m, IsStyleManager o) => o -> m Bool
- getStyleManagerSystemSupportsColorSchemes :: (MonadIO m, IsStyleManager o) => o -> m Bool
Exported types
newtype StyleManager Source #
Memory-managed wrapper type.
StyleManager (ManagedPtr StyleManager) |
Instances
Eq StyleManager Source # | |
Defined in GI.Adw.Objects.StyleManager (==) :: StyleManager -> StyleManager -> Bool # (/=) :: StyleManager -> StyleManager -> Bool # | |
GObject StyleManager Source # | |
Defined in GI.Adw.Objects.StyleManager | |
ManagedPtrNewtype StyleManager Source # | |
Defined in GI.Adw.Objects.StyleManager toManagedPtr :: StyleManager -> ManagedPtr StyleManager | |
TypedObject StyleManager Source # | |
Defined in GI.Adw.Objects.StyleManager | |
HasParentTypes StyleManager Source # | |
Defined in GI.Adw.Objects.StyleManager | |
IsGValue (Maybe StyleManager) Source # | Convert |
Defined in GI.Adw.Objects.StyleManager gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe StyleManager -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe StyleManager) | |
type ParentTypes StyleManager Source # | |
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
(GObject o, IsDescendantOf StyleManager o) => IsStyleManager o Source # | |
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
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getColorScheme, getDark, getData, getDisplay, getHighContrast, getProperty, getQdata, getSystemSupportsColorSchemes.
Setters
getColorScheme
styleManagerGetColorScheme Source #
:: (HasCallStack, MonadIO m, IsStyleManager a) | |
=> a |
|
-> m ColorScheme | Returns: the color scheme |
Gets the requested application color scheme.
Since: 1.0
getDark
:: (HasCallStack, MonadIO m, IsStyleManager a) | |
=> a |
|
-> m Bool | Returns: whether the application is using dark appearance |
Gets whether the application is using dark appearance.
Since: 1.0
getDefault
styleManagerGetDefault Source #
:: (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 #
:: (HasCallStack, MonadIO m, IsStyleManager a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsDisplay a) | |
=> a |
|
-> m StyleManager | Returns: the style manager for |
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 #
:: (HasCallStack, MonadIO m, IsStyleManager a) | |
=> a |
|
-> m Bool | Returns: whether the application is using high contrast appearance |
Gets whether the application is using high contrast appearance.
Since: 1.0
getSystemSupportsColorSchemes
styleManagerGetSystemSupportsColorSchemes Source #
:: (HasCallStack, MonadIO m, IsStyleManager a) | |
=> a |
|
-> m Bool | Returns: whether the system supports color schemes |
Gets whether the system supports color schemes.
Since: 1.0
setColorScheme
styleManagerSetColorScheme Source #
:: (HasCallStack, MonadIO m, IsStyleManager a) | |
=> a |
|
-> ColorScheme |
|
-> 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.
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