gtk3-0.15.10: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.General.StyleContext

Contents

- Description
- Types
- Constructors
- Methods

Description

Rendering UI elements

Synopsis

- data StyleContext
- class GObjectClass o => StyleContextClass o
- castToStyleContext :: GObjectClass obj => obj -> StyleContext
- gTypeStyleContext :: GType
- toStyleContext :: StyleContextClass o => o -> StyleContext
- styleContextNew :: IO StyleContext
- styleContextAddProvider :: (StyleContextClass context, StyleProviderClass provider) => context -> provider -> Int -> IO ()
- styleContextAddProviderForScreen :: (ScreenClass screen, StyleProviderClass provider) => screen -> provider -> Int -> IO ()
- styleContextAddClass :: (StyleContextClass context, GlibString string) => context -> string -> IO ()
- styleContextRemoveClass :: (StyleContextClass context, GlibString string) => context -> string -> IO ()
- styleContextHasClass :: (StyleContextClass context, GlibString string) => context -> string -> IO Bool
- styleContextListClasses :: (StyleContextClass context, GlibString string) => context -> IO [string]

# Description

GtkStyleContext 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 `StyleProviders`. 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 be also 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 `styleContextSetScreen`, as well as updating the context yourself using `styleContextInvalidate` whenever any of the conditions change, such as a change in the "gtk-theme-name" setting or a hierarchy change in the rendered widget.

# Types

data StyleContext Source #

#### Instances

Instances details

Eq StyleContext Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: StyleContext -> StyleContext -> Bool Source # (/=) :: StyleContext -> StyleContext -> Bool Source #
Ord StyleContext Source # |

Instance details

Defined in Graphics.UI.Gtk.Types

Methods

compare :: StyleContext -> StyleContext -> Ordering Source #

(<) :: StyleContext -> StyleContext -> Bool Source #

(<=) :: StyleContext -> StyleContext -> Bool Source #

(>) :: StyleContext -> StyleContext -> Bool Source #

(>=) :: StyleContext -> StyleContext -> Bool Source #

max :: StyleContext -> StyleContext -> StyleContext Source #

min :: StyleContext -> StyleContext -> StyleContext Source #

GObjectClass StyleContext Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: StyleContext -> GObject Source # unsafeCastGObject :: GObject -> StyleContext Source #
StyleContextClass StyleContext Source # |
Instance details Defined in Graphics.UI.Gtk.Types

class GObjectClass o => StyleContextClass o Source #

#### Instances

Instances details

StyleContextClass StyleContext Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToStyleContext :: GObjectClass obj => obj -> StyleContext Source #

gTypeStyleContext :: GType Source #

toStyleContext :: StyleContextClass o => o -> StyleContext Source #

# Constructors

styleContextNew Source #

Arguments

:: IO StyleContext | 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.

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

# Methods

styleContextAddProvider Source #

Arguments

:: (StyleContextClass context, StyleProviderClass provider) |
=> context | `context` a `StyleContext`
-> provider | `provider` a `StyleProvider`
-> Int | `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 1 and 800
-> IO () |

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.

styleContextAddProviderForScreen Source #

Arguments

:: (ScreenClass screen, StyleProviderClass provider) |
=> screen | `screen` a `Screen`
-> provider | `provider` a `StyleProvider`
-> Int | `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 1 and 800
-> IO () |

Adds a global style provider to `screen`, which will be used in style construction for all `StyleContexts` 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.

styleContextAddClass :: (StyleContextClass context, GlibString string) => context -> string -> IO () Source #

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 GtkEntry defining an “entry” class, would be matched by:

    GtkEntry.entry { ... }

While any widget defining an “entry” class would be matched by:

    .entry { ... }

styleContextRemoveClass :: (StyleContextClass context, GlibString string) => context -> string -> IO () Source #

Removes `className` from `context`.

styleContextHasClass :: (StyleContextClass context, GlibString string) => context -> string -> IO Bool Source #

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

styleContextListClasses :: (StyleContextClass context, GlibString string) => context -> IO [string] Source #

Returns the list of classes currently defined in context.