Package: gtk

Class gtk-style-context

Superclasses

g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

direction
The direction property of type gtk-text-direction (Read / Write)
The text direction of the style context.
Default value: :ltr
paint-clock
The paint-clock property of type gdk-frame-clock (Read / Write)
The associated frame clock of the style context.
parent
The parent property of type gtk-style-context (Read / Write)
The parent of the style context.
screen
The screen property of type gdk-screen (Read / Write)
The associated screen of the style context.

Details

The gtk-style-context object stores styling information affecting a widget defined by a gtk-widget-path instance.

In order to construct the final style information, the gtk-style-context object queries information from all attached gtk-style-provider objects. Style providers can be either attached explicitly to the style context through the gtk-style-context-add-provider function, or to the screen through the gtk-style-context-add-provider-for-screen function. The resulting style is a combination of all information of the style provider in priority order.

For GTK widgets, any gtk-style-context object returned by the gtk-widget-style-context function will already have a gtk-widget-path instance, a gdk-screen object and a text direction 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 the gtk-style-context-path and gtk-style-context-screen functions. See the "Custom Drawing" example in the GTK Lisp Demo.

Style Classes
Widgets can add style classes to their style 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.

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

Custom styling in UI libraries and applications
If you are developing a library with custom widgets that render differently than standard components, you may need to add a gtk-style-provider object yourself with the +gtk-style-provider-priority-fallback+ priority, either a gtk-css-provider object or a custom object implementing the gtk-style-provider 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 application, you probably want then to make your style information prevail to the style information of the theme, so you must use a gtk-style-provider object with the +gtk-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-style-provider-priority-user+ priority.

Signal Details

The "changed" signal
 lambda (context)    :run-first      
The signal is emitted when there is a change in the style context. For a style context returned by the gtk-widget-style-context function, the "style-updated" signal of the gtk-widget class might be more convenient to use. The signal is useful when using the theming layer standalone.
context
The gtk-style-context object which received the signal.
 

Slot Access Functions

Inherited Slot Access Functions

See also

2021-11-26