gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.CssProvider

Contents

Description

GtkCssProvider is an object implementing the StyleProvider interface. It is able to parse [CSS-like][css-overview] input in order to style widgets.

An application can make GTK+ parse a specific CSS style sheet by calling cssProviderLoadFromFile or cssProviderLoadFromResource and adding the provider with styleContextAddProvider or styleContextAddProviderForScreen.

In addition, certain files will be read when GTK+ is initialized. First, the file $XDG_CONFIG_HOME/gtk-3.0/gtk.css is loaded if it exists. Then, GTK+ loads the first existing file among XDG_DATA_HOME/themes/theme-name/gtk-VERSION/gtk.css, $HOME/.themes/theme-name/gtk-VERSION/gtk.css, $XDG_DATA_DIRS/themes/theme-name/gtk-VERSION/gtk.css and DATADIR/share/themes/THEME/gtk-VERSION/gtk.css, where THEME is the name of the current theme (see the Settings:gtk-theme-name setting), DATADIR is the prefix configured when GTK+ was compiled (unless overridden by the GTK_DATA_PREFIX environment variable), and VERSION is the GTK+ version number. If no file is found for the current version, GTK+ tries older versions all the way back to 3.0.

In the same way, GTK+ tries to load a gtk-keys.css file for the current key theme, as defined by Settings:gtk-key-theme-name.

Synopsis

Exported types

Methods

getDefault

cssProviderGetDefault Source #

Arguments

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

Returns: The provider used for fallback styling. This memory is owned by GTK+, and you must not free it.

Returns the provider containing the style settings used as a fallback for all widgets.

getNamed

cssProviderGetNamed Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

name: A theme name

-> Maybe Text

variant: variant to load, for example, "dark", or Nothing for the default

-> m CssProvider

Returns: a CssProvider with the theme loaded. This memory is owned by GTK+, and you must not free it.

Loads a theme from the usual theme paths

loadFromData

cssProviderLoadFromData Source #

Arguments

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

cssProvider: a CssProvider

-> ByteString

data: CSS data loaded in memory

-> m ()

(Can throw GError)

Loads data into cssProvider, and by doing so clears any previously loaded information.

loadFromFile

cssProviderLoadFromFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsCssProvider a, IsFile b) 
=> a

cssProvider: a CssProvider

-> b

file: File pointing to a file to load

-> m ()

(Can throw GError)

Loads the data contained in file into cssProvider, making it clear any previously loaded information.

loadFromPath

cssProviderLoadFromPath Source #

Arguments

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

cssProvider: a CssProvider

-> Text

path: the path of a filename to load, in the GLib filename encoding

-> m ()

(Can throw GError)

Loads the data contained in path into cssProvider, making it clear any previously loaded information.

loadFromResource

cssProviderLoadFromResource Source #

Arguments

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

cssProvider: a CssProvider

-> Text

resourcePath: a Resource resource path

-> m () 

Loads the data contained in the resource at resourcePath into the CssProvider, clearing any previously loaded information.

To track errors while loading CSS, connect to the CssProvider::parsing-error signal.

Since: 3.16

new

cssProviderNew Source #

Arguments

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

Returns: A new CssProvider

Returns a newly created CssProvider.

toString

cssProviderToString Source #

Arguments

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

provider: the provider to write to a string

-> m Text

Returns: a new string representing the provider.

Converts the provider into a string representation in CSS format.

Using cssProviderLoadFromData with the return value from this function on a new provider created with cssProviderNew will basically create a duplicate of this provider.

Since: 3.2

Signals

parsingError