CssProvider

GtkCssProvider is an object implementing the GtkStyleProvider interface. It is able to parse CSS-like input in order to style widgets.

Default files

An application can cause GTK+ to parse a specific CSS style sheet by calling gtk_css_provider_load_from_file() and adding the provider with gtk_style_context_add_provider() or gtk_style_context_add_provider_for_screen(). 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+ tries to load $HOME/.themes/theme-name/gtk-3.0/gtk.css, falling back to datadir/share/themes/theme-name/gtk-3.0/gtk.css, where theme-name is the name of the current theme (see the "gtk-theme-name" setting) and datadir is the prefix configured when GTK+ was compiled, unless overridden by the GTK_DATA_PREFIX environment variable.

<hr>

Style sheets

The basic structure of the style sheets understood by this provider is a series of statements, which are either rule sets or '@-rules', separated by whitespace.

A rule set consists of a selector and a declaration block, which is a series of declarations enclosed in curly braces ({ and }). The declarations are separated by semicolons (;). Multiple selectors can share the same declaration block, by putting all the separators in front of the block, separated by commas.

<hr>

Selectors

Selectors work very similar to the way they do in CSS, with widget class names taking the role of element names, and widget names taking the role of IDs. When used in a selector, widget names must be prefixed with a '#' character. The '*' character represents the so-called universal selector, which matches any widget.

To express more complicated situations, selectors can be combined in various ways:

To require that a widget satisfies several conditions, combine several selectors into one by concatenating them. E.g. GtkButton#button1 matches a GtkButton widget with the name button1.

To only match a widget when it occurs inside some other widget, write the two selectors after each other, separated by whitespace. E.g. GtkToolBar GtkButton matches GtkButton widgets that occur inside a GtkToolBar.

In the previous example, the GtkButton is matched even if it occurs deeply nested inside the toolbar. To restrict the match to direct children of the parent widget, insert a '&gt;' character between the two selectors. E.g. GtkNotebook &gt; GtkLabel matches GtkLabel widgets that are direct children of a GtkNotebook.

Widgets may also define style classes, which can be used for matching. When used in a selector, style classes must be prefixed with a '.' character.

Refer to the documentation of individual widgets to learn which style classes they define and see the section called “Style classes and regions” for a list of all style classes used by GTK+ widgets.

Note that there is some ambiguity in the selector syntax when it comes to differentiation widget class names from regions. GTK+ currently treats a string as a widget class name if it contains any uppercase characters (which should work for more widgets with names like GtkLabel).

In complicated widgets like e.g. a GtkNotebook, it may be desirable to style different parts of the widget differently. To make this possible, container widgets may define regions, whose names may be used for matching in selectors.

Some containers allow to further differentiate between regions by applying so-called pseudo-classes to the region. For example, the tab region in GtkNotebook allows to single out the first or last tab by using the :first-child or :last-child pseudo-class. When used in selectors, pseudo-classes must be prefixed with a ':' character.

Refer to the documentation of individual widgets to learn which regions and pseudo-classes they define and see the section called “Style classes and regions” for a list of all regions used by GTK+ widgets.

Another use of pseudo-classes is to match widgets depending on their state. This is conceptually similar to the :hover, :active or :focus pseudo-classes in CSS. The available pseudo-classes for widget states are :active, :prelight (or :hover), :insensitive, :selected, :focused and :inconsistent.

Widget state pseudoclasses may only apply to the last element in a selector.

To determine the effective style for a widget, all the matching rule sets are merged. As in CSS, rules apply by specificity, so the rules whose selectors more closely match a widget path will take precedence over the others.

<hr>

@ Rules

GTK+'s CSS supports the @import rule, in order to load another CSS style sheet in addition to the currently parsed one.

In order to extend key bindings affecting different widgets, GTK+ supports the @binding-set rule to parse a set of bind/unbind directives, see GtkBindingSet for the supported syntax. Note that the binding sets defined in this way must be associated with rule sets by setting the gtk-key-bindings style property.

Customized key bindings are typically defined in a separate gtk-keys.css CSS file and GTK+ loads this file according to the current key theme, which is defined by the "gtk-key-theme-name" setting.

GTK+ also supports an additional @define-color rule, in order to define a color name which may be used instead of color numeric representations. Also see the "gtk-color-scheme" setting for a way to override the values of these named colors.

<hr>

Symbolic colors

Besides being able to define color names, the CSS parser is also able to read different color expressions, which can also be nested, providing a rich language to define colors which are derived from a set of base colors.

The various ways to express colors in GTK+ CSS are:

Syntax Explanation Examples

rgb(r, g, b) An opaque color; r, g, b can be either integers between 0 and 255 or percentages

rgb(128, 10, 54) rgb(20%, 30%, 0%)

rgba(r, g, b, a) A translucent color; r, g, b are as in the previous row, a is a floating point number between 0 and 1

rgba(255, 255, 0, 0.5)

#xxyyzz

An opaque color; xx, yy, zz are hexadecimal numbers specifying r, g, b variants with between 1 and 4 hexadecimal digits per component are allowed

#ff12ab #f0c

@name Reference to a color that has been defined with @define-color

@bg_color

mix(color1, color2, f) A linear combination of color1 and color2. f is a floating point number between 0 and 1.

mix(#ff1e0a, @bg_color, 0.8)

shade(color, f) A lighter or darker variant of color. f is a floating point number.

shade(@fg_color, 0.5)

lighter(color) A lighter variant of color

darker(color) A darker variant of color

alpha(color, f) Modifies passed color's alpha by a factor f. f is a floating point number. f &lt; 1.0 results in a more transparent color while f &gt; 1.0 results in a more opaque color.

alhpa(blue, 0.5)

<hr>

Gradients

Linear or radial Gradients can be used as background images.

A linear gradient along the line from (start_x, start_y) to (end_x, end_y) is specified using the syntax

-gtk-gradient (linear, start_x start_y, end_x end_y, color-stop (position, color), ...)

where start_x and end_x can be either a floating point number between 0 and 1 or one of the special values 'left', 'right' or 'center', start_y and end_y can be either a floating point number between 0 and 1 or one of the special values 'top', 'bottom' or 'center', position is a floating point number between 0 and 1 and color is a color expression (see above). The color-stop can be repeated multiple times to add more than one color stop. 'from (color)' and 'to (color)' can be used as abbreviations for color stops with position 0 and 1, respectively.

A radial gradient along the two circles defined by (start_x, start_y, start_radius) and (end_x, end_y, end_radius) is specified using the syntax

-gtk-gradient (radial, start_x start_y, start_radius, end_x end_y, end_radius, color-stop (position, color), ...)

where start_radius and end_radius are floating point numbers and the other parameters are as before.

<hr>

Text shadow

A shadow list can be applied to text or symbolic icons, using the CSS3 text-shadow syntax, as defined in the CSS3 specification.

A text shadow is specified using the syntax

text-shadow: horizontal_offset vertical_offset [ blur_radius ] color

The offset of the shadow is specified with the horizontal_offset and vertical_offset parameters. The optional blur radius is parsed, but it is currently not rendered by the GTK+ theming engine.

To set a shadow on an icon, use the icon-shadow property instead, with the same syntax.

To set multiple shadows on an element, you can specify a comma-separated list of shadow elements in the text-shadow or icon-shadow property. Shadows are always rendered front-back, i.e. the first shadow specified is on top of the others. Shadows can thus overlay each other, but they can never overlay the text or icon itself, which is always rendered on top of the shadow layer.

<hr>

Box shadow

Themes can apply shadows on framed elements using the CSS3 box-shadow syntax, as defined in the CSS3 specification.

A box shadow is specified using the syntax

box-shadow: [ inset ] horizontal_offset vertical_offset [ blur_radius ] [ spread ] color

A positive offset will draw a shadow that is offset to the right (down) of the box, a negative offset to the left (top). The optional spread parameter defines an additional distance to expand the shadow shape in all directions, by the specified radius. The optional blur radius parameter is parsed, but it is currently not rendered by the GTK+ theming engine. The inset parameter defines whether the drop shadow should be rendered inside or outside the box canvas.

To set multiple box-shadows on an element, you can specify a comma-separated list of shadow elements in the box-shadow property. Shadows are always rendered front-back, i.e. the first shadow specified is on top of the others, so they may overlap other boxes or other shadows.

<hr>

Border images

Images and gradients can also be used in slices for the purpose of creating scalable borders. For more information, see the CSS3 documentation for the border-image property, which can be found here.

The parameters of the slicing process are controlled by four separate properties. Note that you can use the

border-image

shorthand property to set values for the three properties at the same time.

border-image-source: url(path) (or border-image-source: -gtk-gradient(...))

: Specifies the source of the border image, and it can either be an URL or a gradient (see above).

border-image-slice: top right bottom left

The sizes specified by the top, right, bottom and left parameters are the offsets, in pixels, from the relevant edge where the image should be "cut off" to build the slices used for the rendering of the border.

border-image-width: top right bottom left

The sizes specified by the top, right, bottom and left parameters are inward distances from the border box edge, used to specify the rendered size of each slice determined by border-image-slice. If this property is not specified, the values of border-width will be used as a fallback.

border-image-repeat: repeat|round|space ? repeat|round|space

Specifies how the image slices should be rendered in the area outlined by border-width. The default (stretch) is to resize the slice to fill in the whole allocated area. If the value of this property is 'repeat', the image slice will be tiled to fill the area. If the value of this property is 'round', the image slice will be tiled to fill the area, and scaled to fit it exactly a whole number of times. If the value of this property is 'space', the image slice will be tiled to fill the area, and if it doesn't fit it exactly a whole number of times, the extra space is distributed as padding around the slices. If two options are specified, the first one affects the horizontal behaviour and the second one the vertical behaviour. If only one option is specified, it affects both.

<hr>

Styles can specify transitions that will be used to create a gradual change in the appearance when a widget state changes. The following syntax is used to specify transitions:

duration ms ease|ease-in|ease-out|ease-in-out loop?

The duration is the amount of time that the animation will take for a complete cycle from start to end. If the loop option is given, the animation will be repated until the state changes again. The option after the duration determines the transition function from a small set of predefined functions.

Figure 6. Linear transition

Figure 7. Ease transition

Figure 8. Ease-in-out transition

Figure 9. Ease-in transition

Figure 10. Ease-out transition

<hr>

Supported properties

Properties are the part that differ the most to common CSS, not all properties are supported (some are planned to be supported eventually, some others are meaningless or don't map intuitively in a widget based environment).

The currently supported properties are:

Property name Syntax Maps to Examples

engine engine-name GtkThemingEngine engine: clearlooks; engine: none; /+* use the default (i.e. builtin) engine) +/

background-color color (see above) GdkRGBA

background-color: #fff; color: color1; background-color: shade (color1, 0.5); color: mix (color1, #f0f, 0.8);

color

border-top-color transparent|color (see above)

border-right-color

border-bottom-color

border-left-color

border-color color{1,4}

font-family

family [, family]* gchararray font-family: Sans, Arial;

font-style oblique|italic

PANGO_TYPE_STYLE font-style: italic;

font-variant small-caps

PANGO_TYPE_VARIANT font-variant: normal;

font-weight bold|bolder|lighter|100|200|300|400|500|600|700|800|900

PANGO_TYPE_WEIGHT font-weight: bold;

font-size Font size in point gint font-size: 13;

font

family style size PangoFontDescription font: Sans 15;

margin-top integer gint margin-top: 0;

margin-left integer gint margin-left: 1;

margin-bottom integer gint margin-bottom: 2;

margin-right integer gint margin-right: 4;

margin

width vertical_width horizontal_width top_width horizontal_width bottom_width top_width right_width bottom_width left_width

GtkBorder

margin: 5; margin: 5 10; margin: 5 10 3; margin: 5 10 3 5;

padding-top integer gint padding-top: 5;

padding-left integer gint padding-left: 5;

padding-bottom integer gint padding-bottom: 5;

padding-right integer gint padding-right: 5;

padding

background-image

gradient (see above) or url(path) cairo_pattern_t

-gtk-gradient (linear, left top, right top, from (#fff), to (#000)); -gtk-gradient (linear, 0.0 0.5, 0.5 1.0, from (#fff), color-stop (0.5, #f00), to (#000)); -gtk-gradient (radial, center center, 0.2, center center, 0.8, color-stop (0.0, #fff), color-stop (1.0, #000)); url ('background.png');

background-repeat no-repeat

internal

background-repeat: no-repeat; If not specified, the style doesn't respect the CSS3 specification, since the background will be stretched to fill the area.

border-top-width integer gint border-top-width: 5;

border-left-width integer gint border-left-width: 5;

border-bottom-width integer gint border-bottom-width: 5;

border-right-width integer gint border-right-width: 5;

border-width GtkBorder

border-width: 1; border-width: 1 2; border-width: 1 2 3; border-width: 1 2 3 5;

border-radius integer gint border-radius: 5;

border-style solid|inset|outset

GtkBorderStyle border-style: solid;

border-image

border image (see above) internal use only

border-image: url("/path/to/image.png") 3 4 3 4 stretch; border-image: url("/path/to/image.png") 3 4 4 3 repeat stretch;

text-shadow shadow list (see above) internal use only

text-shadow: 1 1 0 blue, -4 -4 red;

transition transition (see above) internal use only

transition: 150ms ease-in-out; transition: 1s linear loop;

gtk-key-bindings binding set name list internal use only

gtk-bindings: binding1, binding2, ...;

GtkThemingEngines can register their own, engine-specific style properties with the function gtk_theming_engine_register_property(). These properties can be set in CSS like other properties, using a name of the form

-namespace-name

, where namespace is typically the name of the theming engine, and name is the name of the property. Style properties that have been registered by widgets using gtk_widget_class_install_style_property() can also be set in this way, using the widget class name for namespace.

Constructors

this
this(GtkCssProvider* gtkCssProvider)

Sets our main struct and passes it to the parent class

this
this()

Returns a newly created GtkCssProvider.

Members

Functions

addOnParsingError
void addOnParsingError(void delegate(CssSection, ErrorG, CssProvider) dlg, ConnectFlags connectFlags)

Signals that a parsing error occured. the path, line and position describe the actual location of the error as accurately as possible. Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal. Note that this signal may be emitted at any time as the css provider may opt to defer parsing parts or all of the input to a later time than when a loading function was called. See Also GtkStyleContext, GtkStyleProvider

getCssProviderStruct
GtkCssProvider* getCssProviderStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

loadFromData
int loadFromData(string data)

Loads data into css_provider, making it clear any previously loaded information.

loadFromFile
int loadFromFile(File file)

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

loadFromPath
int loadFromPath(string path)

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

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()

Convertes the provider into a string representation in CSS format. Using gtk_css_provider_load_from_data() with the return value from this function on a new provider created with gtk_css_provider_new() will basicallu create a duplicate of this provider.

Mixins

__anonymous
mixin StyleProviderT!(GtkCssProvider)
Undocumented in source.

Static functions

callBackParsingError
void callBackParsingError(GtkCssProvider* providerStruct, GtkCssSection* section, GError* error, CssProvider _cssProvider)
Undocumented in source. Be warned that the author may not have intended to support it.
getDefault
CssProvider getDefault()

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

getNamed
CssProvider getNamed(string name, string variant)

Loads a theme from the usual theme paths

Variables

connectedSignals
int[string] connectedSignals;
gtkCssProvider
GtkCssProvider* gtkCssProvider;

the main Gtk struct

onParsingErrorListeners
void delegate(CssSection, ErrorG, CssProvider)[] onParsingErrorListeners;
Undocumented in source.

Inherited Members

From ObjectG

gObject
GObject* gObject;

the main Gtk struct

getObjectGStruct
GObject* getObjectGStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

isGcRoot
bool isGcRoot;
Undocumented in source.
destroyNotify
void destroyNotify(ObjectG obj)
Undocumented in source. Be warned that the author may not have intended to support it.
toggleNotify
void toggleNotify(ObjectG obj, GObject* object, int isLastRef)
Undocumented in source. Be warned that the author may not have intended to support it.
~this
~this()
Undocumented in source.
getDObject
RT getDObject(U obj)

Gets a D Object from the objects table of associations.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setProperty
void setProperty(string propertyName, int value)
setProperty
void setProperty(string propertyName, string value)
setProperty
void setProperty(string propertyName, long value)
setProperty
void setProperty(string propertyName, ulong value)
unref
void unref()
Undocumented in source. Be warned that the author may not have intended to support it.
doref
ObjectG doref()
Undocumented in source. Be warned that the author may not have intended to support it.
connectedSignals
int[string] connectedSignals;
Undocumented in source.
onNotifyListeners
void delegate(ParamSpec, ObjectG)[] onNotifyListeners;
Undocumented in source.
addOnNotify
void addOnNotify(void delegate(ParamSpec, ObjectG) dlg, string property, ConnectFlags connectFlags)

The notify signal is emitted on an object when one of its properties has been changed. Note that getting this signal doesn't guarantee that the value of the property has actually changed, it may also be emitted when the setter for the property is called to reinstate the previous value.

callBackNotify
void callBackNotify(GObject* gobjectStruct, GParamSpec* pspec, ObjectG _objectG)
Undocumented in source. Be warned that the author may not have intended to support it.
classInstallProperty
void classInstallProperty(GObjectClass* oclass, uint propertyId, ParamSpec pspec)

Installs a new property. This is usually done in the class initializer. Note that it is possible to redefine a property in a derived class, by installing a property with the same name. This can be useful at times, e.g. to change the range of allowed values or the default value.

classInstallProperties
void classInstallProperties(GObjectClass* oclass, ParamSpec[] pspecs)

Installs new properties from an array of GParamSpecs. This is usually done in the class initializer. The property id of each property is the index of each GParamSpec in the pspecs array. The property id of 0 is treated specially by GObject and it should not be used to store a GParamSpec. This function should be used if you plan to use a static array of GParamSpecs and g_object_notify_by_pspec(). For instance, this Since 2.26

classFindProperty
ParamSpec classFindProperty(GObjectClass* oclass, string propertyName)

Looks up the GParamSpec for a property of a class.

classListProperties
ParamSpec[] classListProperties(GObjectClass* oclass)

Get an array of GParamSpec* for all properties of a class.

classOverrideProperty
void classOverrideProperty(GObjectClass* oclass, uint propertyId, string name)

Registers property_id as referring to a property with the name name in a parent class or in an interface implemented by oclass. This allows this class to override a property implementation in a parent class or to provide the implementation of a property from an interface. Note Internally, overriding is implemented by creating a property of type GParamSpecOverride; generally operations that query the properties of the object class, such as g_object_class_find_property() or g_object_class_list_properties() will return the overridden property. However, in one case, the construct_properties argument of the constructor virtual function, the GParamSpecOverride is passed instead, so that the param_id field of the GParamSpec will be correct. For virtually all uses, this makes no difference. If you need to get the overridden property, you can call g_param_spec_get_redirect_target(). Since 2.4

interfaceInstallProperty
void interfaceInstallProperty(void* iface, ParamSpec pspec)

Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property. This function is meant to be called from the interface's default vtable initialization function (the class_init member of GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface. Since 2.4

interfaceFindProperty
ParamSpec interfaceFindProperty(void* iface, string propertyName)

Find the GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek(). Since 2.4

interfaceListProperties
ParamSpec[] interfaceListProperties(void* iface)

Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek(). Since 2.4

doref
void* doref(void* object)

Increases the reference count of object.

unref
void unref(void* object)

Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

refSink
void* refSink(void* object)

Increase the reference count of object, and possibly remove the floating reference, if object has a floating reference. In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one. Since 2.10

clearObject
void clearObject(ObjectG objectPtr)

Clears a reference to a GObject. object_ptr must not be NULL. If the reference is NULL then this function does nothing. Otherwise, the reference count of the object is decreased and the pointer is set to NULL. This function is threadsafe and modifies the pointer atomically, using memory barriers where needed. A macro is also included that allows this function to be used without pointer casts. Since 2.28

isFloating
int isFloating(void* object)

Checks whether object has a floating reference. Since 2.10

forceFloating
void forceFloating()

This function is intended for GObject implementations to re-enforce a floating object reference. Doing this is seldom required: all GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink(). Since 2.10

weakRef
void weakRef(GWeakNotify notify, void* data)

Adds a weak reference callback to an object. Weak references are used for notification when an object is finalized. They are called "weak references" because they allow you to safely hold a pointer to an object without calling g_object_ref() (g_object_ref() adds a strong reference, that is, forces the object to stay alive). Note that the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use GWeakRef if thread-safety is required.

weakUnref
void weakUnref(GWeakNotify notify, void* data)

Removes a weak reference callback to an object.

addWeakPointer
void addWeakPointer(void** weakPointerLocation)

Adds a weak reference from weak_pointer to object to indicate that the pointer located at weak_pointer_location is only valid during the lifetime of object. When the object is finalized, weak_pointer will be set to NULL. Note that as with g_object_weak_ref(), the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use GWeakRef if thread-safety is required.

removeWeakPointer
void removeWeakPointer(void** weakPointerLocation)

Removes a weak reference from object that was previously added using g_object_add_weak_pointer(). The weak_pointer_location has to match the one used with g_object_add_weak_pointer().

addToggleRef
void addToggleRef(GToggleNotify notify, void* data)

Increases the reference count of the object by one and sets a callback to be called when all other references to the object are dropped, or when this is already the last reference to the object and another reference is established. This functionality is intended for binding object to a proxy object managed by another memory manager. This is done with two paired references: the strong reference added by g_object_add_toggle_ref() and a reverse reference to the proxy object which is either a strong reference or weak reference. The setup is that when there are no other references to object, only a weak reference is held in the reverse direction from object to the proxy object, but when there are other references held to object, a strong reference is held. The notify callback is called when the reference from object to the proxy object should be toggled from strong to weak (is_last_ref true) or weak to strong (is_last_ref false). Since a (normal) reference must be held to the object before calling g_object_add_toggle_ref(), the initial state of the reverse link is always strong. Multiple toggle references may be added to the same gobject, however if there are multiple toggle references to an object, none of them will ever be notified until all but one are removed. For this reason, you should only ever use a toggle reference if there is important state in the proxy object. Since 2.8

removeToggleRef
void removeToggleRef(GToggleNotify notify, void* data)

Removes a reference added with g_object_add_toggle_ref(). The reference count of the object is decreased by one. Since 2.8

notify
void notify(string propertyName)

Emits a "notify" signal for the property property_name on object. When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

notifyByPspec
void notifyByPspec(ParamSpec pspec)

Emits a "notify" signal for the property specified by pspec on object. This function omits the property name lookup, hence it is faster than g_object_notify(). One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with Since 2.26

freezeNotify
void freezeNotify()

Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one "notify" signal is emitted for each property modified while the object is frozen. This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

thawNotify
void thawNotify()

Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted. Duplicate notifications for each property are squashed so that at most one "notify" signal is emitted for each property. It is an error to call this function when the freeze count is zero.

getData
void* getData(string key)

Gets a named field from the objects table of associations (see g_object_set_data()).

setData
void setData(string key, void* data)

Each object carries around a table of associations from strings to pointers. This function lets you set an association. If the object already had an association with that name, the old association will be destroyed.

setDataFull
void setDataFull(string key, void* data, GDestroyNotify destroy)

Like g_object_set_data() except it adds notification for when the association is destroyed, either by setting it to a different value or when the object is destroyed. Note that the destroy callback is not called if data is NULL.

stealData
void* stealData(string key)

Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

dupData
void* dupData(string key, GDuplicateFunc dupFunc, void* userData)

This is a variant of g_object_get_data() which returns a 'duplicate' of the value. dup_func defines the meaning of 'duplicate' in this context, it could e.g. take a reference on a ref-counted object. If the key is not set on the object then dup_func will be called with a NULL argument. Note that dup_func is called while user data of object is locked. This function can be useful to avoid races when multiple threads are using object data on the same key on the same object. Since 2.34

replaceData
int replaceData(string key, void* oldval, void* newval, GDestroyNotify destroy, GDestroyNotify* oldDestroy)

Compares the user data for the key key on object with oldval, and if they are the same, replaces oldval with newval. This is like a typical atomic compare-and-exchange operation, for user data on an object. If the previous value was replaced then ownership of the old value (oldval) is passed to the caller, including the registered destroy notify for it (passed out in old_destroy). Its up to the caller to free this as he wishes, which may or may not include using old_destroy as sometimes replacement should not destroy the object in the normal way. Return: TRUE if the existing value for key was replaced by newval, FALSE otherwise. Since 2.34

getQdata
void* getQdata(GQuark quark)

This function gets back user data pointers stored via g_object_set_qdata().

setQdata
void setQdata(GQuark quark, void* data)

This sets an opaque, named pointer on an object. The name is specified through a GQuark (retrived e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the object with g_object_get_qdata() until the object is finalized. Setting a previously set user data pointer, overrides (frees) the old pointer set, using NULL as pointer essentially removes the data stored.

setQdataFull
void setQdataFull(GQuark quark, void* data, GDestroyNotify destroy)

This function works like g_object_set_qdata(), but in addition, a void (*destroy) (gpointer) function may be specified which is called with data as argument when the object is finalized, or the data is being overwritten by a call to g_object_set_qdata() with the same quark.

stealQdata
void* stealQdata(GQuark quark)

This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update

dupQdata
void* dupQdata(GQuark quark, GDuplicateFunc dupFunc, void* userData)

This is a variant of g_object_get_qdata() which returns a 'duplicate' of the value. dup_func defines the meaning of 'duplicate' in this context, it could e.g. take a reference on a ref-counted object. If the quark is not set on the object then dup_func will be called with a NULL argument. Note that dup_func is called while user data of object is locked. This function can be useful to avoid races when multiple threads are using object data on the same key on the same object. Since 2.34

replaceQdata
int replaceQdata(GQuark quark, void* oldval, void* newval, GDestroyNotify destroy, GDestroyNotify* oldDestroy)

Compares the user data for the key quark on object with oldval, and if they are the same, replaces oldval with newval. This is like a typical atomic compare-and-exchange operation, for user data on an object. If the previous value was replaced then ownership of the old value (oldval) is passed to the caller, including the registered destroy notify for it (passed out in old_destroy). Its up to the caller to free this as he wishes, which may or may not include using old_destroy as sometimes replacement should not destroy the object in the normal way. Return: TRUE if the existing value for quark was replaced by newval, FALSE otherwise. Since 2.34

setProperty
void setProperty(string propertyName, Value value)

Sets a property on an object.

getProperty
void getProperty(string propertyName, Value value)

Gets a property of an object. value must have been initialized to the expected type of the property (or a type to which the expected type can be transformed) using g_value_init(). In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset(). Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

setValist
void setValist(string firstPropertyName, void* varArgs)

Sets properties on an object.

getValist
void getValist(string firstPropertyName, void* varArgs)

Gets properties of an object. In general, a copy is made of the property contents and the caller is responsible for freeing the memory in the appropriate manner for the type, for instance by calling g_free() or g_object_unref(). See g_object_get().

watchClosure
void watchClosure(Closure closure)

This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

runDispose
void runDispose()

Releases all references to other objects. This can be used to break reference cycles. This functions should only be called from object system implementations.

From StyleProviderIF

getStyleProviderTStruct
GtkStyleProvider* getStyleProviderTStruct()
Undocumented in source.
getStruct
void* getStruct()

the main Gtk struct as a void*

getIconFactory
IconFactory getIconFactory(WidgetPath path)

Warning gtk_style_provider_get_icon_factory has been deprecated since version 3.8 and should not be used in newly-written code. Will always return NULL for all GTK-provided style providers. Returns the GtkIconFactory defined to be in use for path, or NULL if none is defined.

getStyle
StyleProperties getStyle(WidgetPath path)

Warning gtk_style_provider_get_style has been deprecated since version 3.8 and should not be used in newly-written code. Will always return NULL for all GTK-provided style providers as the interface cannot correctly work the way CSS is specified. Returns the style settings affecting a widget defined by path, or NULL if provider doesn't contemplate styling path.

getStyleProperty
int getStyleProperty(WidgetPath path, GtkStateFlags state, ParamSpec pspec, Value value)

Looks up a widget style property as defined by provider for the widget represented by path.

Meta