gi-gtk-3.0.32: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.StyleContext

Description

StyleContext is an object that stores styling information affecting a widget defined by WidgetPath.

In order to construct the final style information, StyleContext queries information from all attached GtkStyleProviders. Style providers can be either attached explicitly to the context through styleContextAddProvider, or to the screen through styleContextAddProviderForScreen. The resulting style is a combination of all providers’ information in priority order.

For GTK+ widgets, any StyleContext returned by widgetGetStyleContext will already have a WidgetPath, a Screen and RTL/LTR information set. The style context will also be updated automatically if any of these settings change on the widget.

If you are using the theming layer standalone, you will need to set a widget path and a screen yourself to the created style context through styleContextSetPath and possibly styleContextSetScreen. See the “Foreign drawing“ example in gtk3-demo.

{gtkstylecontext-classes}

Widgets can add style classes to their context, which can be used to associate different styles by class. The documentation for individual widgets lists which style classes it uses itself, and which style classes may be added by applications to affect their appearance.

GTK+ defines macros for a number of style classes.

Style Regions

Widgets can also add regions with flags to their context. This feature is deprecated and will be removed in a future GTK+ update. Please use style classes instead.

GTK+ defines macros for a number of style regions.

Custom styling in UI libraries and applications

If you are developing a library with custom GtkWidgets that render differently than standard components, you may need to add a StyleProvider yourself with the STYLE_PROVIDER_PRIORITY_FALLBACK priority, either a CssProvider or a custom object implementing the StyleProvider interface. This way themes may still attempt to style your UI elements in a different way if needed so.

If you are using custom styling on an applications, you probably want then to make your style information prevail to the theme’s, so you must use a StyleProvider with the STYLE_PROVIDER_PRIORITY_APPLICATION priority, keep in mind that the user settings in XDG_CONFIG_HOME/gtk-3.0/gtk.css will still take precedence over your changes, as it uses the STYLE_PROVIDER_PRIORITY_USER priority.

Synopsis

Exported types

newtype StyleContext Source #

Memory-managed wrapper type.

class (GObject o, IsDescendantOf StyleContext o) => IsStyleContext o Source #

Type class for types which can be safely cast to StyleContext, for instance with toStyleContext.

Instances

Instances details
(GObject o, IsDescendantOf StyleContext o) => IsStyleContext o Source # 
Instance details

Defined in GI.Gtk.Objects.StyleContext

toStyleContext :: (MonadIO m, IsStyleContext o) => o -> m StyleContext Source #

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

Methods

Overloaded methods

addClass

styleContextAddClass Source #

Arguments

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

context: a StyleContext

-> Text

className: class name to use in styling

-> m () 

Adds a style class to context, so posterior calls to gtk_style_context_get() or any of the gtk_render_*() functions will make use of this new class for styling.

In the CSS file format, a Entry defining a “search” class, would be matched by:

 <!-- language="CSS" -->
entry.search { ... }

While any widget defining a “search” class would be matched by: > language="CSS" -- >.search { ... }

Since: 3.0

addProvider

styleContextAddProvider Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsStyleProvider b) 
=> a

context: a StyleContext

-> b

provider: a StyleProvider

-> Word32

priority: the priority of the style provider. The lower it is, the earlier it will be used in the style construction. Typically this will be in the range between STYLE_PROVIDER_PRIORITY_FALLBACK and STYLE_PROVIDER_PRIORITY_USER

-> m () 

Adds a style provider to context, to be used in style construction. Note that a style provider added by this function only affects the style of the widget to which context belongs. If you want to affect the style of all widgets, use styleContextAddProviderForScreen.

Note: If both priorities are the same, a StyleProvider added through this function takes precedence over another added through styleContextAddProviderForScreen.

Since: 3.0

addProviderForScreen

styleContextAddProviderForScreen Source #

Arguments

:: (HasCallStack, MonadIO m, IsScreen a, IsStyleProvider b) 
=> a

screen: a Screen

-> b

provider: a StyleProvider

-> Word32

priority: the priority of the style provider. The lower it is, the earlier it will be used in the style construction. Typically this will be in the range between STYLE_PROVIDER_PRIORITY_FALLBACK and STYLE_PROVIDER_PRIORITY_USER

-> m () 

Adds a global style provider to screen, which will be used in style construction for all GtkStyleContexts under screen.

GTK+ uses this to make styling information from Settings available.

Note: If both priorities are the same, A StyleProvider added through styleContextAddProvider takes precedence over another added through this function.

Since: 3.0

addRegion

styleContextAddRegion Source #

Arguments

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

context: a StyleContext

-> Text

regionName: region name to use in styling

-> [RegionFlags]

flags: flags that apply to the region

-> m () 

Deprecated: (Since version 3.14)

Adds a region to context, so posterior calls to gtk_style_context_get() or any of the gtk_render_*() functions will make use of this new region for styling.

In the CSS file format, a TreeView defining a “row” region, would be matched by:

 <!-- language="CSS" -->
treeview row { ... }

Pseudo-classes are used for matching flags, so the two following rules: > language="CSS" -- >treeview row:nth-child(even) { ... } >treeview row:nth-child(odd) { ... }

would apply to even and odd rows, respectively.

Region names must only contain lowercase letters and “-”, starting always with a lowercase letter.

Since: 3.0

cancelAnimations

styleContextCancelAnimations Source #

Arguments

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

context: a StyleContext

-> Ptr ()

regionId: animatable region to stop, or Nothing. See styleContextPushAnimatableRegion

-> m () 

Deprecated: (Since version 3.6)This function does nothing.

Stops all running animations for regionId and all animatable regions underneath.

A Nothing regionId will stop all ongoing animations in context, when dealing with a StyleContext obtained through widgetGetStyleContext, this is normally done for you in all circumstances you would expect all widget to be stopped, so this should be only used in complex widgets with different animatable regions.

Since: 3.0

getBackgroundColor

styleContextGetBackgroundColor Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

state: state to retrieve the color for

-> m RGBA 

Deprecated: (Since version 3.16)Use renderBackground instead.

Gets the background color for a given state.

This function is far less useful than it seems, and it should not be used in newly written code. CSS has no concept of "background color", as a background can be an image, or a gradient, or any other pattern including solid colors.

The only reason why you would call styleContextGetBackgroundColor is to use the returned value to draw the background with it; the correct way to achieve this result is to use renderBackground instead, along with CSS style classes to modify the color to be rendered.

Since: 3.0

getBorder

styleContextGetBorder Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

state: state to retrieve the border for

-> m Border 

Gets the border for a given state as a Border.

See styleContextGetProperty and STYLE_PROPERTY_BORDER_WIDTH for details.

Since: 3.0

getBorderColor

styleContextGetBorderColor Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

state: state to retrieve the color for

-> m RGBA 

Deprecated: (Since version 3.16)Use renderFrame instead.

Gets the border color for a given state.

Since: 3.0

getColor

styleContextGetColor Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

state: state to retrieve the color for

-> m RGBA 

Gets the foreground color for a given state.

See styleContextGetProperty and STYLE_PROPERTY_COLOR for details.

Since: 3.0

getDirection

styleContextGetDirection Source #

Arguments

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

context: a StyleContext

-> m TextDirection

Returns: the widget direction

Deprecated: (Since version 3.8)Use styleContextGetState and check for GTK_STATE_FLAG_DIR_LTR and GTK_STATE_FLAG_DIR_RTL instead.

Returns the widget direction used for rendering.

Since: 3.0

getFont

styleContextGetFont Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

state: state to retrieve the font for

-> m FontDescription

Returns: the FontDescription for the given state. This object is owned by GTK+ and should not be freed.

Deprecated: (Since version 3.8)Use gtk_style_context_get() for "font" or subproperties instead.

Returns the font description for a given state. The returned object is const and will remain valid until the changed signal happens.

Since: 3.0

getFrameClock

styleContextGetFrameClock Source #

Arguments

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

context: a StyleContext

-> m (Maybe FrameClock)

Returns: a FrameClock, or Nothing if context does not have an attached frame clock.

Returns the FrameClock to which context is attached.

Since: 3.8

getJunctionSides

styleContextGetJunctionSides Source #

Arguments

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

context: a StyleContext

-> m [JunctionSides]

Returns: the junction sides

Returns the sides where rendered elements connect visually with others.

Since: 3.0

getMargin

styleContextGetMargin Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

state: state to retrieve the border for

-> m Border 

Gets the margin for a given state as a Border. See gtk_style_property_get() and STYLE_PROPERTY_MARGIN for details.

Since: 3.0

getPadding

styleContextGetPadding Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

state: state to retrieve the padding for

-> m Border 

Gets the padding for a given state as a Border. See gtk_style_context_get() and STYLE_PROPERTY_PADDING for details.

Since: 3.0

getParent

styleContextGetParent Source #

Arguments

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

context: a StyleContext

-> m (Maybe StyleContext)

Returns: the parent context or Nothing

Gets the parent context set via styleContextSetParent. See that function for details.

Since: 3.4

getPath

styleContextGetPath Source #

Arguments

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

context: a StyleContext

-> m WidgetPath

Returns: A WidgetPath

Returns the widget path used for style matching.

Since: 3.0

getProperty

styleContextGetProperty Source #

Arguments

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

context: a StyleContext

-> Text

property: style property name

-> [StateFlags]

state: state to retrieve the property value for

-> m GValue 

Gets a style property from context for the given state.

Note that not all CSS properties that are supported by GTK+ can be retrieved in this way, since they may not be representable as Value. GTK+ defines macros for a number of properties that can be used with this function.

Note that passing a state other than the current state of context is not recommended unless the style context has been saved with styleContextSave.

When value is no longer needed, valueUnset must be called to free any allocated memory.

Since: 3.0

getScale

styleContextGetScale Source #

Arguments

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

context: a StyleContext

-> m Int32

Returns: the scale

Returns the scale used for assets.

Since: 3.10

getScreen

styleContextGetScreen Source #

Arguments

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

context: a StyleContext

-> m Screen

Returns: a Screen.

Returns the Screen to which context is attached.

getSection

styleContextGetSection Source #

Arguments

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

context: a StyleContext

-> Text

property: style property name

-> m (Maybe CssSection)

Returns: Nothing or the section where a value for property was defined

Queries the location in the CSS where property was defined for the current context. Note that the state to be queried is taken from styleContextGetState.

If the location is not available, Nothing will be returned. The location might not be available for various reasons, such as the property being overridden, property not naming a supported CSS property or tracking of definitions being disabled for performance reasons.

Shorthand CSS properties cannot be queried for a location and will always return Nothing.

getState

styleContextGetState Source #

Arguments

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

context: a StyleContext

-> m [StateFlags]

Returns: the state flags

Returns the state used for style matching.

This method should only be used to retrieve the StateFlags to pass to StyleContext methods, like styleContextGetPadding. If you need to retrieve the current state of a Widget, use widgetGetStateFlags.

Since: 3.0

getStyleProperty

styleContextGetStyleProperty Source #

Arguments

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

context: a StyleContext

-> Text

propertyName: the name of the widget style property

-> GValue

value: Return location for the property value

-> m () 

Gets the value for a widget style property.

When value is no longer needed, valueUnset must be called to free any allocated memory.

hasClass

styleContextHasClass Source #

Arguments

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

context: a StyleContext

-> Text

className: a class name

-> m Bool

Returns: True if context has className defined

Returns True if context currently has defined the given class name.

Since: 3.0

hasRegion

styleContextHasRegion Source #

Arguments

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

context: a StyleContext

-> Text

regionName: a region name

-> m (Bool, [RegionFlags])

Returns: True if region is defined

Deprecated: (Since version 3.14)

Returns True if context has the region defined. If flagsReturn is not Nothing, it is set to the flags affecting the region.

Since: 3.0

invalidate

styleContextInvalidate Source #

Arguments

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

context: a StyleContext.

-> m () 

Deprecated: (Since version 3.12)Style contexts are invalidated automatically.

Invalidates context style information, so it will be reconstructed again. It is useful if you modify the context and need the new information immediately.

Since: 3.0

listClasses

styleContextListClasses Source #

Arguments

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

context: a StyleContext

-> m [Text]

Returns: a List of strings with the currently defined classes. The contents of the list are owned by GTK+, but you must free the list itself with g_list_free() when you are done with it.

Returns the list of classes currently defined in context.

Since: 3.0

listRegions

styleContextListRegions Source #

Arguments

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

context: a StyleContext

-> m [Text]

Returns: a List of strings with the currently defined regions. The contents of the list are owned by GTK+, but you must free the list itself with g_list_free() when you are done with it.

Deprecated: (Since version 3.14)

Returns the list of regions currently defined in context.

Since: 3.0

lookupColor

styleContextLookupColor Source #

Arguments

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

context: a StyleContext

-> Text

colorName: color name to lookup

-> m (Bool, RGBA)

Returns: True if colorName was found and resolved, False otherwise

Looks up and resolves a color name in the context color map.

lookupIconSet

styleContextLookupIconSet Source #

Arguments

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

context: a StyleContext

-> Text

stockId: an icon name

-> m (Maybe IconSet)

Returns: The looked up GtkIconSet, or Nothing

Deprecated: (Since version 3.10)Use iconThemeLookupIcon instead.

Looks up stockId in the icon factories associated to context and the default icon factory, returning an icon set if found, otherwise Nothing.

new

styleContextNew Source #

Arguments

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

Returns: A newly created StyleContext.

Creates a standalone StyleContext, this style context won’t be attached to any widget, so you may want to call styleContextSetPath yourself.

This function is only useful when using the theming layer separated from GTK+, if you are using StyleContext to theme GtkWidgets, use widgetGetStyleContext in order to get a style context ready to theme the widget.

notifyStateChange

styleContextNotifyStateChange Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsWindow b) 
=> a

context: a StyleContext

-> b

window: a Window

-> Ptr ()

regionId: animatable region to notify on, or Nothing. See styleContextPushAnimatableRegion

-> StateType

state: state to trigger transition for

-> Bool

stateValue: True if state is the state we are changing to, False if we are changing away from it

-> m () 

Deprecated: (Since version 3.6)This function does nothing.

Notifies a state change on context, so if the current style makes use of transition animations, one will be started so all rendered elements under regionId are animated for state state being set to value stateValue.

The window parameter is used in order to invalidate the rendered area as the animation runs, so make sure it is the same window that is being rendered on by the gtk_render_*() functions.

If regionId is Nothing, all rendered elements using context will be affected by this state transition.

As a practical example, a Button notifying a state transition on the prelight state: > language="C" -- >gtk_style_context_notify_state_change (context, > gtk_widget_get_window (widget), > NULL, > GTK_STATE_PRELIGHT, > button->in_button);

Can be handled in the CSS file like this: > language="CSS" -- >button { > background-color: #f00 >} > >button:hover { > background-color: #fff; > transition: 200ms linear >}

This combination will animate the button background from red to white if a pointer enters the button, and back to red if the pointer leaves the button.

Note that state is used when finding the transition parameters, which is why the style places the transition under the :hover pseudo-class.

Since: 3.0

popAnimatableRegion

styleContextPopAnimatableRegion Source #

Arguments

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

context: a StyleContext

-> m () 

Deprecated: (Since version 3.6)This function does nothing.

Pops an animatable region from context. See styleContextPushAnimatableRegion.

Since: 3.0

pushAnimatableRegion

styleContextPushAnimatableRegion Source #

Arguments

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

context: a StyleContext

-> Ptr ()

regionId: unique identifier for the animatable region

-> m () 

Deprecated: (Since version 3.6)This function does nothing.

Pushes an animatable region, so all further gtk_render_*() calls between this call and the following styleContextPopAnimatableRegion will potentially show transition animations for this region if styleContextNotifyStateChange is called for a given state, and the current theme/style defines transition animations for state changes.

The regionId used must be unique in context so the themes can uniquely identify rendered elements subject to a state transition.

Since: 3.0

removeClass

styleContextRemoveClass Source #

Arguments

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

context: a StyleContext

-> Text

className: class name to remove

-> m () 

Removes className from context.

Since: 3.0

removeProvider

styleContextRemoveProvider Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsStyleProvider b) 
=> a

context: a StyleContext

-> b

provider: a StyleProvider

-> m () 

Removes provider from the style providers list in context.

Since: 3.0

removeProviderForScreen

styleContextRemoveProviderForScreen Source #

Arguments

:: (HasCallStack, MonadIO m, IsScreen a, IsStyleProvider b) 
=> a

screen: a Screen

-> b

provider: a StyleProvider

-> m () 

Removes provider from the global style providers list in screen.

Since: 3.0

removeRegion

styleContextRemoveRegion Source #

Arguments

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

context: a StyleContext

-> Text

regionName: region name to unset

-> m () 

Deprecated: (Since version 3.14)

Removes a region from context.

Since: 3.0

resetWidgets

styleContextResetWidgets Source #

Arguments

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

screen: a Screen

-> m () 

This function recomputes the styles for all widgets under a particular Screen. This is useful when some global parameter has changed that affects the appearance of all widgets, because when a widget gets a new style, it will both redraw and recompute any cached information about its appearance. As an example, it is used when the color scheme changes in the related Settings object.

Since: 3.0

restore

styleContextRestore Source #

Arguments

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

context: a StyleContext

-> m () 

Restores context state to a previous stage. See styleContextSave.

Since: 3.0

save

styleContextSave Source #

Arguments

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

context: a StyleContext

-> m () 

Saves the context state, so temporary modifications done through styleContextAddClass, styleContextRemoveClass, styleContextSetState, etc. can quickly be reverted in one go through styleContextRestore.

The matching call to styleContextRestore must be done before GTK returns to the main loop.

Since: 3.0

scrollAnimations

styleContextScrollAnimations Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsWindow b) 
=> a

context: a StyleContext

-> b

window: a Window used previously in styleContextNotifyStateChange

-> Int32

dx: Amount to scroll in the X axis

-> Int32

dy: Amount to scroll in the Y axis

-> m () 

Deprecated: (Since version 3.6)This function does nothing.

This function is analogous to windowScroll, and should be called together with it so the invalidation areas for any ongoing animation are scrolled together with it.

Since: 3.0

setBackground

styleContextSetBackground Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsWindow b) 
=> a

context: a StyleContext

-> b

window: a Window

-> m () 

Deprecated: (Since version 3.18)Use renderBackground instead. Note that clients still using this function are now responsible for calling this function again whenever context is invalidated.

Sets the background of window to the background pattern or color specified in context for its current state.

Since: 3.0

setDirection

styleContextSetDirection Source #

Arguments

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

context: a StyleContext

-> TextDirection

direction: the new direction.

-> m () 

Deprecated: (Since version 3.8)Use styleContextSetState with GTK_STATE_FLAG_DIR_LTR and GTK_STATE_FLAG_DIR_RTL instead.

Sets the reading direction for rendering purposes.

If you are using a StyleContext returned from widgetGetStyleContext, you do not need to call this yourself.

Since: 3.0

setFrameClock

styleContextSetFrameClock Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsFrameClock b) 
=> a

context: a FrameClock

-> b

frameClock: a FrameClock

-> m () 

Attaches context to the given frame clock.

The frame clock is used for the timing of animations.

If you are using a StyleContext returned from widgetGetStyleContext, you do not need to call this yourself.

Since: 3.8

setJunctionSides

styleContextSetJunctionSides Source #

Arguments

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

context: a StyleContext

-> [JunctionSides]

sides: sides where rendered elements are visually connected to other elements

-> m () 

Sets the sides where rendered elements (mostly through renderFrame) will visually connect with other visual elements.

This is merely a hint that may or may not be honored by themes.

Container widgets are expected to set junction hints as appropriate for their children, so it should not normally be necessary to call this function manually.

Since: 3.0

setParent

styleContextSetParent Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsStyleContext b) 
=> a

context: a StyleContext

-> Maybe b

parent: the new parent or Nothing

-> m () 

Sets the parent style context for context. The parent style context is used to implement inheritance of properties.

If you are using a StyleContext returned from widgetGetStyleContext, the parent will be set for you.

Since: 3.4

setPath

styleContextSetPath Source #

Arguments

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

context: a StyleContext

-> WidgetPath

path: a WidgetPath

-> m () 

Sets the WidgetPath used for style matching. As a consequence, the style will be regenerated to match the new given path.

If you are using a StyleContext returned from widgetGetStyleContext, you do not need to call this yourself.

Since: 3.0

setScale

styleContextSetScale Source #

Arguments

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

context: a StyleContext

-> Int32

scale: scale

-> m () 

Sets the scale to use when getting image assets for the style.

Since: 3.10

setScreen

styleContextSetScreen Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsScreen b) 
=> a

context: a StyleContext

-> b

screen: a Screen

-> m () 

Attaches context to the given screen.

The screen is used to add style information from “global” style providers, such as the screen’s Settings instance.

If you are using a StyleContext returned from widgetGetStyleContext, you do not need to call this yourself.

Since: 3.0

setState

styleContextSetState Source #

Arguments

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

context: a StyleContext

-> [StateFlags]

flags: state to represent

-> m () 

Sets the state to be used for style matching.

Since: 3.0

stateIsRunning

styleContextStateIsRunning Source #

Arguments

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

context: a StyleContext

-> StateType

state: a widget state

-> m (Bool, Double)

Returns: True if there is a running transition animation for state.

Deprecated: (Since version 3.6)This function always returns False

Returns True if there is a transition animation running for the current region (see styleContextPushAnimatableRegion).

If progress is not Nothing, the animation progress will be returned there, 0.0 means the state is closest to being unset, while 1.0 means it’s closest to being set. This means transition animation will run from 0 to 1 when state is being set and from 1 to 0 when it’s being unset.

Since: 3.0

toString

styleContextToString Source #

Arguments

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

context: a StyleContext

-> [StyleContextPrintFlags]

flags: Flags that determine what to print

-> m Text

Returns: a newly allocated string representing context

Converts the style context into a string representation.

The string representation always includes information about the name, state, id, visibility and style classes of the CSS node that is backing context. Depending on the flags, more information may be included.

This function is intended for testing and debugging of the CSS implementation in GTK+. There are no guarantees about the format of the returned string, it may change.

Since: 3.20

Properties

direction

No description available in the introspection data.

constructStyleContextDirection :: IsStyleContext o => TextDirection -> IO (GValueConstruct o) Source #

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

getStyleContextDirection :: (MonadIO m, IsStyleContext o) => o -> m TextDirection Source #

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

get styleContext #direction

setStyleContextDirection :: (MonadIO m, IsStyleContext o) => o -> TextDirection -> m () Source #

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

set styleContext [ #direction := value ]

paintClock

No description available in the introspection data.

clearStyleContextPaintClock :: (MonadIO m, IsStyleContext o) => o -> m () Source #

Set the value of the “paint-clock” property to Nothing. When overloading is enabled, this is equivalent to

clear #paintClock

constructStyleContextPaintClock :: (IsStyleContext o, IsFrameClock a) => a -> IO (GValueConstruct o) Source #

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

getStyleContextPaintClock :: (MonadIO m, IsStyleContext o) => o -> m (Maybe FrameClock) Source #

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

get styleContext #paintClock

setStyleContextPaintClock :: (MonadIO m, IsStyleContext o, IsFrameClock a) => o -> a -> m () Source #

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

set styleContext [ #paintClock := value ]

parent

Sets or gets the style context’s parent. See styleContextSetParent for details.

Since: 3.4

clearStyleContextParent :: (MonadIO m, IsStyleContext o) => o -> m () Source #

Set the value of the “parent” property to Nothing. When overloading is enabled, this is equivalent to

clear #parent

constructStyleContextParent :: (IsStyleContext o, IsStyleContext a) => a -> IO (GValueConstruct o) Source #

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

getStyleContextParent :: (MonadIO m, IsStyleContext o) => o -> m (Maybe StyleContext) Source #

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

get styleContext #parent

setStyleContextParent :: (MonadIO m, IsStyleContext o, IsStyleContext a) => o -> a -> m () Source #

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

set styleContext [ #parent := value ]

screen

No description available in the introspection data.

constructStyleContextScreen :: (IsStyleContext o, IsScreen a) => a -> IO (GValueConstruct o) Source #

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

getStyleContextScreen :: (MonadIO m, IsStyleContext o) => o -> m Screen Source #

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

get styleContext #screen

setStyleContextScreen :: (MonadIO m, IsStyleContext o, IsScreen a) => o -> a -> m () Source #

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

set styleContext [ #screen := value ]

Signals

changed

type C_StyleContextChangedCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type StyleContextChangedCallback = IO () Source #

The changed signal is emitted when there is a change in the StyleContext.

For a StyleContext returned by widgetGetStyleContext, the styleUpdated signal/vfunc might be more convenient to use.

This signal is useful when using the theming layer standalone.

Since: 3.0

afterStyleContextChanged :: (IsStyleContext a, MonadIO m) => a -> StyleContextChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after styleContext #changed callback

onStyleContextChanged :: (IsStyleContext a, MonadIO m) => a -> StyleContextChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on styleContext #changed callback