Creates a standalone #GtkStyleContext, this style context won’t be attached to any widget, so you may want to call gtk.style_context.StyleContext.setPath yourself.
Adds a style class to context, so posterior calls to gtk.style_context.StyleContext.get or any of the gtk_render_*() functions will make use of this new class for styling.
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 gtk.style_context.StyleContext.addProviderForScreen.
Adds a region to context, so posterior calls to gtk.style_context.StyleContext.get or any of the gtk_render_*() functions will make use of this new region for styling.
Stops all running animations for region_id and all animatable regions underneath.
Connect to Changed signal.
Gets the background color for a given state.
Gets the border for a given state as a #GtkBorder.
Gets the border color for a given state.
Gets the foreground color for a given state.
Returns the widget direction used for rendering.
Returns the font description for a given state. The returned object is const and will remain valid until the #GtkStyleContext::changed signal happens.
Returns the #GdkFrameClock to which context is attached.
Returns the sides where rendered elements connect visually with others.
Gets the margin for a given state as a #GtkBorder. See gtk_style_property_get() and #GTK_STYLE_PROPERTY_MARGIN for details.
Gets the padding for a given state as a #GtkBorder. See gtk.style_context.StyleContext.get and #GTK_STYLE_PROPERTY_PADDING for details.
Gets the parent context set via gtk.style_context.StyleContext.setParent. See that function for details.
Returns the widget path used for style matching.
Gets a style property from context for the given state.
Returns the scale used for assets.
Returns the #GdkScreen to which context is attached.
Queries the location in the CSS where property was defined for the current context. Note that the state to be queried is taken from gtk.style_context.StyleContext.getState.
Returns the state used for style matching.
Gets the value for a widget style property.
Returns true if context currently has defined the given class name.
Returns true if context has the region defined. If flags_return is not null, it is set to the flags affecting the region.
Invalidates context style information, so it will be reconstructed again. It is useful if you modify the context and need the new information immediately.
Returns the list of classes currently defined in context.
Returns the list of regions currently defined in context.
Looks up and resolves a color name in the context color map.
Looks up stock_id in the icon factories associated to context and the default icon factory, returning an icon set if found, otherwise null.
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 region_id are animated for state state being set to value state_value.
Pops an animatable region from context. See gtk.style_context.StyleContext.pushAnimatableRegion.
Pushes an animatable region, so all further gtk_render_*() calls between this call and the following gtk.style_context.StyleContext.popAnimatableRegion will potentially show transition animations for this region if gtk.style_context.StyleContext.notifyStateChange is called for a given state, and the current theme/style defines transition animations for state changes.
Removes class_name from context.
Removes provider from the style providers list in context.
Removes a region from context.
Restores context state to a previous stage. See gtk.style_context.StyleContext.save.
Saves the context state, so temporary modifications done through gtk.style_context.StyleContext.addClass, gtk.style_context.StyleContext.removeClass, gtk.style_context.StyleContext.setState, etc. can quickly be reverted in one go through gtk.style_context.StyleContext.restore.
This function is analogous to gdk.window.Window.scroll, and should be called together with it so the invalidation areas for any ongoing animation are scrolled together with it.
Returns this, for use in with statements.
Sets the background of window to the background pattern or color specified in context for its current state.
Sets the reading direction for rendering purposes.
Attaches context to the given frame clock.
Sets the sides where rendered elements (mostly through gtk.global.renderFrame) will visually connect with other visual elements.
Sets the parent style context for context. The parent style context is used to implement inheritance
of properties.
Sets the #GtkWidgetPath used for style matching. As a consequence, the style will be regenerated to match the new given path.
Sets the scale to use when getting image assets for the style.
Attaches context to the given screen.
Sets the state to be used for style matching.
Returns true if there is a transition animation running for the current region (see gtk.style_context.StyleContext.pushAnimatableRegion).
Converts the style context into a string representation.
Get parent property.
Set parent property.
Adds a global style provider to screen, which will be used in style construction for all #GtkStyleContexts under screen.
Get builder for gtk.style_context.StyleContext
Removes provider from the global style providers list in screen.
This function recomputes the styles for all widgets under a particular #GdkScreen. 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 #GtkSettings object.
Set the GObject of a D ObjectWrap wrapper.
Get a pointer to the underlying C object.
Calls g_object_ref() on a GObject.
Calls g_object_unref() on a GObject.
Get the GType of an object.
GObject GType property.
Convenience method to return this cast to a type. For use in D with statements.
Template to get the D object from a C GObject and cast it to the given D object type.
Connect a D closure to an object signal.
Template for setting a GObject property.
Template for getting a GObject property.
Creates a binding between source_property on source and target_property on target.
Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.
This function is intended for #GObject implementations to re-enforce a floating[floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling gobject.object.ObjectWrap.refSink.
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 #GObject::notify signal is emitted for each property modified while the object is frozen.
Gets a named field from the objects table of associations (see gobject.object.ObjectWrap.setData).
Gets a property of an object.
This function gets back user data pointers stored via gobject.object.ObjectWrap.setQdata.
Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.
Checks whether object has a floating[floating-ref] reference.
Emits a "notify" signal for the property property_name on object.
Emits a "notify" signal for the property specified by pspec on object.
Increase the reference count of object, and possibly remove the floating[floating-ref] reference, if object has a floating reference.
Releases all references to other objects. This can be used to break reference cycles.
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
Sets a property on an object.
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
This function gets back user data pointers stored via gobject.object.ObjectWrap.setQdata and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:
Reverts the effect of a previous call to gobject.object.ObjectWrap.freezeNotify. The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.
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 gobject.closure.Closure.invalidate on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, gobject.object.ObjectWrap.ref_ and gobject.object.ObjectWrap.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.
Connect to Notify signal.
#GtkStyleContext is an object that stores styling information affecting a widget defined by #GtkWidgetPath.
In order to construct the final style information, #GtkStyleContext queries information from all attached #GtkStyleProviders. Style providers can be either attached explicitly to the context through gtk.style_context.StyleContext.addProvider, or to the screen through gtk.style_context.StyleContext.addProviderForScreen. The resulting style is a combination of all providers’ information in priority order.
For GTK+ widgets, any #GtkStyleContext returned by gtk.widget.Widget.getStyleContext will already have a #GtkWidgetPath, a #GdkScreen 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 gtk.style_context.StyleContext.setPath and possibly gtk.style_context.StyleContext.setScreen. See the “Foreign drawing“ example in gtk3-demo.
Style Classes # {#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 #GtkStyleProvider yourself with the gtk.types.STYLE_PROVIDER_PRIORITY_FALLBACK priority, either a #GtkCssProvider or a custom object implementing the #GtkStyleProvider 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 #GtkStyleProvider with the gtk.types.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 gtk.types.STYLE_PROVIDER_PRIORITY_USER priority.