Gtk.ThemingEngine

g GObject.Object GObject.Object Gtk.ThemingEngine Gtk.ThemingEngine GObject.Object->Gtk.ThemingEngine

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

load (name)

get_background_color (state)

get_border (state)

get_border_color (state)

get_color (state)

get_direction ()

get_font (state)

get_junction_sides ()

get_margin (state)

get_padding (state)

get_path ()

get_property (property, state)

get_screen ()

get_state ()

get_style_property (property_name)

has_class (style_class)

has_region (style_region)

lookup_color (color_name)

state_is_running (state)

Virtual Methods

Inherited:

GObject.Object (7)

do_render_activity (cr, x, y, width, height)

do_render_arrow (cr, angle, x, y, size)

do_render_background (cr, x, y, width, height)

do_render_check (cr, x, y, width, height)

do_render_expander (cr, x, y, width, height)

do_render_extension (cr, x, y, width, height, gap_side)

do_render_focus (cr, x, y, width, height)

do_render_frame (cr, x, y, width, height)

do_render_frame_gap (cr, x, y, width, height, gap_side, xy0_gap, xy1_gap)

do_render_handle (cr, x, y, width, height)

do_render_icon (cr, pixbuf, x, y)

do_render_icon_surface (cr, surface, x, y)

do_render_layout (cr, x, y, layout)

do_render_line (cr, x0, y0, x1, y1)

do_render_option (cr, x, y, width, height)

do_render_slider (cr, x, y, width, height, orientation)

Properties

Name

Type

Flags

Short Description

name

str

r/w/co

Theming engine name

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_object

GObject.Object

r

Class Details

class Gtk.ThemingEngine(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gtk.ThemingEngineClass

Gtk.ThemingEngine was the object used for rendering themed content in GTK+ widgets. It used to allow overriding GTK+’s default implementation of rendering functions by allowing engines to be loaded as modules.

Gtk.ThemingEngine has been deprecated in GTK+ 3.14 and will be ignored for rendering. The advancements in CSS theming are good enough to allow themers to achieve their goals without the need to modify source code.

classmethod load(name)[source]
Parameters:

name (str) – Theme engine name to load

Returns:

A theming engine, or None if the engine name doesn’t exist.

Return type:

Gtk.ThemingEngine or None

Loads and initializes a theming engine module from the standard directories.

Deprecated since version 3.14.

get_background_color(state)[source]
Parameters:

state (Gtk.StateFlags) – state to retrieve the color for

Returns:

return value for the background color

Return type:

color: Gdk.RGBA

Gets the background color for a given state.

New in version 3.0.

Deprecated since version 3.14.

get_border(state)[source]
Parameters:

state (Gtk.StateFlags) – state to retrieve the border for

Returns:

return value for the border settings

Return type:

border: Gtk.Border

Gets the border for a given state as a Gtk.Border.

New in version 3.0.

Deprecated since version 3.14.

get_border_color(state)[source]
Parameters:

state (Gtk.StateFlags) – state to retrieve the color for

Returns:

return value for the border color

Return type:

color: Gdk.RGBA

Gets the border color for a given state.

New in version 3.0.

Deprecated since version 3.14.

get_color(state)[source]
Parameters:

state (Gtk.StateFlags) – state to retrieve the color for

Returns:

return value for the foreground color

Return type:

color: Gdk.RGBA

Gets the foreground color for a given state.

New in version 3.0.

Deprecated since version 3.14.

get_direction()[source]
Returns:

the widget direction

Return type:

Gtk.TextDirection

Returns the widget direction used for rendering.

New in version 3.0.

Deprecated since version 3.8: Use Gtk.ThemingEngine.get_state() and check for Gtk.StateFlags.DIR_LTR and Gtk.StateFlags.DIR_RTL instead.

get_font(state)[source]
Parameters:

state (Gtk.StateFlags) – state to retrieve the font for

Returns:

the Pango.FontDescription for the given state. This object is owned by GTK+ and should not be freed.

Return type:

Pango.FontDescription

Returns the font description for a given state.

New in version 3.0.

Deprecated since version 3.8: Use gtk_theming_engine_get()

get_junction_sides()[source]
Returns:

the widget direction

Return type:

Gtk.JunctionSides

Returns the widget direction used for rendering.

New in version 3.0.

Deprecated since version 3.14.

get_margin(state)[source]
Parameters:

state (Gtk.StateFlags) – state to retrieve the border for

Returns:

return value for the margin settings

Return type:

margin: Gtk.Border

Gets the margin for a given state as a Gtk.Border.

New in version 3.0.

Deprecated since version 3.14.

get_padding(state)[source]
Parameters:

state (Gtk.StateFlags) – state to retrieve the padding for

Returns:

return value for the padding settings

Return type:

padding: Gtk.Border

Gets the padding for a given state as a Gtk.Border.

New in version 3.0.

Deprecated since version 3.14.

get_path()[source]
Returns:

A Gtk.WidgetPath

Return type:

Gtk.WidgetPath

Returns the widget path used for style matching.

New in version 3.0.

Deprecated since version 3.14.

get_property(property, state)[source]
Parameters:
  • property (str) – the property name

  • state (Gtk.StateFlags) – state to retrieve the value for

Returns:

return location for the property value, you must free this memory using GObject.Value.unset() once you are done with it.

Return type:

value: GObject.Value

Gets a property value as retrieved from the style settings that apply to the currently rendered element.

New in version 3.0.

Deprecated since version 3.14.

get_screen()[source]
Returns:

a Gdk.Screen, or None.

Return type:

Gdk.Screen or None

Returns the Gdk.Screen to which self currently rendering to.

Deprecated since version 3.14.

get_state()[source]
Returns:

the state flags

Return type:

Gtk.StateFlags

returns the state used when rendering.

New in version 3.0.

Deprecated since version 3.14.

get_style_property(property_name)[source]
Parameters:

property_name (str) – the name of the widget style property

Returns:

Return location for the property value, free with GObject.Value.unset() after use.

Return type:

value: GObject.Value

Gets the value for a widget style property.

New in version 3.0.

Deprecated since version 3.14.

has_class(style_class)[source]
Parameters:

style_class (str) – class name to look up

Returns:

True if self has class_name defined

Return type:

bool

Returns True if the currently rendered contents have defined the given class name.

New in version 3.0.

Deprecated since version 3.14.

has_region(style_region)[source]
Parameters:

style_region (str) – a region name

Returns:

True if region is defined

flags:

return location for region flags

Return type:

(bool, flags: Gtk.RegionFlags)

Returns True if the currently rendered contents have the region defined. If flags_return is not None, it is set to the flags affecting the region.

New in version 3.0.

Deprecated since version 3.14.

lookup_color(color_name)[source]
Parameters:

color_name (str) – color name to lookup

Returns:

True if color_name was found and resolved, False otherwise

color:

Return location for the looked up color

Return type:

(bool, color: Gdk.RGBA)

Looks up and resolves a color name in the current style’s color map.

New in version 3.0.

Deprecated since version 3.14.

state_is_running(state)[source]
Parameters:

state (Gtk.StateType) – a widget state

Returns:

True if there is a running transition animation for state.

progress:

return location for the transition progress

Return type:

(bool, progress: float)

Returns True if there is a transition animation running for the current region (see Gtk.StyleContext.push_animatable_region()).

If progress is not None, the animation progress will be returned there, 0.0 means the state is closest to being False, while 1.0 means it’s closest to being True. This means transition animations will run from 0 to 1 when state is being set to True and from 1 to 0 when it’s being set to False.

New in version 3.0.

Deprecated since version 3.6: Always returns False

do_render_activity(cr, x, y, width, height) virtual
Parameters:

Renders an area displaying activity, such as in Gtk.Spinner, or Gtk.ProgressBar.

do_render_arrow(cr, angle, x, y, size) virtual
Parameters:

Renders an arrow pointing to a certain direction.

do_render_background(cr, x, y, width, height) virtual
Parameters:

Renders the background area of a widget region.

do_render_check(cr, x, y, width, height) virtual
Parameters:

Renders a checkmark, as in Gtk.CheckButton.

do_render_expander(cr, x, y, width, height) virtual
Parameters:

Renders an element what will expose/expand part of the UI, as in Gtk.Expander.

do_render_extension(cr, x, y, width, height, gap_side) virtual
Parameters:

Renders a extension to a box, usually a notebook tab.

do_render_focus(cr, x, y, width, height) virtual
Parameters:

Renders the focus indicator.

do_render_frame(cr, x, y, width, height) virtual
Parameters:

Renders the frame around a widget area.

do_render_frame_gap(cr, x, y, width, height, gap_side, xy0_gap, xy1_gap) virtual
Parameters:

Renders the frame around a widget area with a gap in it.

do_render_handle(cr, x, y, width, height) virtual
Parameters:

Renders a handle to drag UI elements, as in Gtk.Paned.

do_render_icon(cr, pixbuf, x, y) virtual
Parameters:

Renders an icon given as a GdkPixbuf.Pixbuf.

do_render_icon_surface(cr, surface, x, y) virtual
Parameters:

Renders an icon given as a cairo.Surface.

do_render_layout(cr, x, y, layout) virtual
Parameters:

Renders a Pango.Layout

do_render_line(cr, x0, y0, x1, y1) virtual
Parameters:

Renders a line between two points.

do_render_option(cr, x, y, width, height) virtual
Parameters:

Renders an option, as in Gtk.RadioButton.

do_render_slider(cr, x, y, width, height, orientation) virtual
Parameters:

Renders a slider control, as in Gtk.Scale.

Property Details

Gtk.ThemingEngine.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The theming engine name, this name will be used when registering custom properties, for a theming engine named “Clearlooks” registering a “glossy” custom property, it could be referenced in the CSS file as

-Clearlooks-glossy: true;

New in version 3.0.