Gtk.Style - Classes - Gtk 3.0 (original) (raw)

g GObject.Object GObject.Object Gtk.Style Gtk.Style GObject.Object->Gtk.Style

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class new ()
apply_default_background (cr, window, state_type, x, y, width, height)
copy ()
detach ()
get_style_property (widget_type, property_name)
has_context ()
lookup_color (color_name)
lookup_icon_set (stock_id)
render_icon (source, direction, state, size, widget, detail)
set_background (window, state_type)

Virtual Methods

Inherited:

GObject.Object (7)

do_copy (src)
do_draw_arrow (cr, state_type, shadow_type, widget, detail, arrow_type, fill, x, y, width, height)
do_draw_box (cr, state_type, shadow_type, widget, detail, x, y, width, height)
do_draw_box_gap (cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width)
do_draw_check (cr, state_type, shadow_type, widget, detail, x, y, width, height)
do_draw_diamond (cr, state_type, shadow_type, widget, detail, x, y, width, height)
do_draw_expander (cr, state_type, widget, detail, x, y, expander_style)
do_draw_extension (cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side)
do_draw_flat_box (cr, state_type, shadow_type, widget, detail, x, y, width, height)
do_draw_focus (cr, state_type, widget, detail, x, y, width, height)
do_draw_handle (cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation)
do_draw_hline (cr, state_type, widget, detail, x1, x2, y)
do_draw_layout (cr, state_type, use_text, widget, detail, x, y, layout)
do_draw_option (cr, state_type, shadow_type, widget, detail, x, y, width, height)
do_draw_resize_grip (cr, state_type, widget, detail, edge, x, y, width, height)
do_draw_shadow (cr, state_type, shadow_type, widget, detail, x, y, width, height)
do_draw_shadow_gap (cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width)
do_draw_slider (cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation)
do_draw_spinner (cr, state_type, widget, detail, step, x, y, width, height)
do_draw_tab (cr, state_type, shadow_type, widget, detail, x, y, width, height)
do_draw_vline (cr, state_type, widget, detail, y1_, y2_, x)
do_init_from_rc (rc_style)
do_realize ()
do_render_icon (source, direction, state, size, widget, detail)
do_set_background (window, state_type)
do_unrealize ()

Properties

Name Type Flags Short Description
context Gtk.StyleContext r/w/co Gtk.StyleContext to get style from

Signals

Inherited:

GObject.Object (1)

Name Short Description
realize Emitted when the style has been initialized for a particular visual.
unrealize Emitted when the aspects of the style specific to a particular visual is being cleaned up.

Fields

Inherited:

GObject.Object (1)

Name Type Access Description
attach_count int r
background [cairo.Pattern] r Set of background cairo.Pattern
base [Gdk.Color] r Set of base Gdk.Color
bg [Gdk.Color] r Set of background Gdk.Color
black Gdk.Color r Gdk.Color to use for black
dark [Gdk.Color] r Set of dark Gdk.Color
fg [Gdk.Color] r Set of foreground Gdk.Color
font_desc Pango.FontDescription r Pango.FontDescription
icon_factories [object] r
light [Gdk.Color] r Set of light Gdk.Color
mid [Gdk.Color] r Set of mid Gdk.Color
parent_instance GObject.Object r
private_font_desc Pango.FontDescription r
property_cache [object] r
rc_style Gtk.RcStyle r
styles [object] r
text [Gdk.Color] r Set of text Gdk.Color
text_aa [Gdk.Color] r Color halfway between text/base
visual Gdk.Visual r
white Gdk.Color r Gdk.Color to use for white
xthickness int r Thickness in X direction
ythickness int r Thickness in Y direction

Class Details

class Gtk.Style(**kwargs)

Bases:

GObject.Object

Abstract:

No

Structure:

Gtk.StyleClass

A Gtk.Style object encapsulates the information that provides the look and feel for a widget.

In GTK+ 3.0, Gtk.Style has been deprecated and replaced byGtk.StyleContext.

Each Gtk.Widget has an associated Gtk.Style object that is used when rendering that widget. Also, a Gtk.Style holds information for the five possible widget states though not every widget supports all five states; see Gtk.StateType.

Usually the Gtk.Style for a widget is the same as the default style that is set by GTK+ and modified the theme engine.

Usually applications should not need to use or modify the Gtk.Style of their widgets.

classmethod new()[source]

Returns:

a new Gtk.Style.

Return type:

Gtk.Style

Creates a new Gtk.Style.

apply_default_background(cr, window, state_type, x, y, width, height)[source]

Parameters:

copy()[source]

Returns:

a copy of self

Return type:

Gtk.Style

Creates a copy of the passed in Gtk.Style object.

detach()[source]

Detaches a style from a window. If the style is not attached to any windows anymore, it is unrealized. See gtk_style_attach().

get_style_property(widget_type, property_name)[source]

Parameters:

Returns:

a GObject.Value where the value of the property being queried will be stored

Return type:

value: GObject.Value

Queries the value of a style property corresponding to a widget class is in the given style.

New in version 2.16.

has_context()[source]

Returns:

True if self has a Gtk.StyleContext

Return type:

bool

Returns whether self has an associated Gtk.StyleContext.

New in version 3.0.

lookup_color(color_name)[source]

Parameters:

color_name (str) – the name of the logical color to look up

Returns:

True if the mapping was found.

color:

the Gdk.Color to fill in

Return type:

(bool, color: Gdk.Color)

Looks up color_name in the style’s logical color mappings, filling in color and returning True if found, otherwise returning False. Do not cache the found mapping, because it depends on the Gtk.Style and might change when a theme switch occurs.

New in version 2.10.

lookup_icon_set(stock_id)[source]

Parameters:

stock_id (str) – an icon name

Returns:

icon set of stock_id

Return type:

Gtk.IconSet

Looks up stock_id in the icon factories associated with selfand the default icon factory, returning an icon set if found, otherwise None.

render_icon(source, direction, state, size, widget, detail)[source]

Parameters:

Returns:

a newly-created GdkPixbuf.Pixbufcontaining the rendered icon

Return type:

GdkPixbuf.Pixbuf

Renders the icon specified by source at the given sizeaccording to the given parameters and returns the result in a pixbuf.

set_background(window, state_type)[source]

Parameters:

Sets the background of window to the background color or pixmap specified by self for the given state.

do_copy(src) virtual

Parameters:

src (Gtk.Style) –

do_draw_arrow(cr, state_type, shadow_type, widget, detail, arrow_type, fill, x, y, width, height) virtual

Parameters:

do_draw_box(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_box_gap(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width) virtual

Parameters:

do_draw_check(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_diamond(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_expander(cr, state_type, widget, detail, x, y, expander_style) virtual

Parameters:

do_draw_extension(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side) virtual

Parameters:

do_draw_flat_box(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_focus(cr, state_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_handle(cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation) virtual

Parameters:

do_draw_hline(cr, state_type, widget, detail, x1, x2, y) virtual

Parameters:

do_draw_layout(cr, state_type, use_text, widget, detail, x, y, layout) virtual

Parameters:

do_draw_option(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_resize_grip(cr, state_type, widget, detail, edge, x, y, width, height) virtual

Parameters:

do_draw_shadow(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_shadow_gap(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width) virtual

Parameters:

do_draw_slider(cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation) virtual

Parameters:

do_draw_spinner(cr, state_type, widget, detail, step, x, y, width, height) virtual

Parameters:

do_draw_tab(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual

Parameters:

do_draw_vline(cr, state_type, widget, detail, y1_, y2_, x) virtual

Parameters:

do_init_from_rc(rc_style) virtual

Parameters:

rc_style (Gtk.RcStyle) –

do_realize() virtual

do_render_icon(source, direction, state, size, widget, detail) virtual

Parameters:

Returns:

a newly-created GdkPixbuf.Pixbufcontaining the rendered icon

Return type:

GdkPixbuf.Pixbuf

Renders the icon specified by source at the given sizeaccording to the given parameters and returns the result in a pixbuf.

do_set_background(window, state_type) virtual

Parameters:

Sets the background of window to the background color or pixmap specified by style for the given state.

do_unrealize() virtual

Signal Details

Gtk.Style.signals.realize(style)

Signal Name:

realize

Flags:

RUN_FIRST

Parameters:

style (Gtk.Style) – The object which received the signal

Emitted when the style has been initialized for a particular visual. Connecting to this signal is probably seldom useful since most of the time applications and widgets only deal with styles that have been already realized.

New in version 2.4.

Gtk.Style.signals.unrealize(style)

Signal Name:

unrealize

Flags:

RUN_FIRST

Parameters:

style (Gtk.Style) – The object which received the signal

Emitted when the aspects of the style specific to a particular visual is being cleaned up. A connection to this signal can be useful if a widget wants to cache objects as object data on Gtk.Style. This signal provides a convenient place to free such cached objects.

New in version 2.4.

Property Details

Gtk.Style.props.context

Name:

context

Type:

Gtk.StyleContext

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Gtk.StyleContext to get style from