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:
Structs:
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:
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:
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:
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:
Abstract:
No
Structure:
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.
Returns:
a new Gtk.Style.
Return type:
Creates a new Gtk.Style.
apply_default_background(cr, window, state_type, x, y, width, height)[source]¶
Parameters:
- cr (cairo.Context) –
- window (Gdk.Window) –
- state_type (Gtk.StateType) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
Returns:
a copy of self
Return type:
Creates a copy of the passed in Gtk.Style object.
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:
- widget_type (GObject.GType) – the GObject.GType of a descendant of Gtk.Widget
- property_name (str) – the name of the style property to get
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.
Returns:
True if self has a Gtk.StyleContext
Return type:
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:
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:
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:
- source (Gtk.IconSource) – the Gtk.IconSource specifying the icon to render
- direction (Gtk.TextDirection) – a text direction
- state (Gtk.StateType) – a state
- size (int) – the size to render the icon at (Gtk.IconSize). A size of
(GtkIconSize)-1
means render at the size of the source and don’t scale. - widget (Gtk.Widget or None) – the widget
- detail (str or None) – a style detail
Returns:
a newly-created GdkPixbuf.Pixbufcontaining the rendered icon
Return type:
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:
- window (Gdk.Window) – a Gdk.Window
- state_type (Gtk.StateType) – a state
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:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- arrow_type (Gtk.ArrowType) –
- fill (bool) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_box(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_box_gap(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
- gap_side (Gtk.PositionType) –
- gap_x (int) –
- gap_width (int) –
do_draw_check(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_diamond(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_expander(cr, state_type, widget, detail, x, y, expander_style) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- expander_style (Gtk.ExpanderStyle) –
do_draw_extension(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
- gap_side (Gtk.PositionType) –
do_draw_flat_box(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_focus(cr, state_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_handle(cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
- orientation (Gtk.Orientation) –
do_draw_hline(cr, state_type, widget, detail, x1, x2, y) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- widget (Gtk.Widget) –
- detail (str) –
- x1 (int) –
- x2 (int) –
- y (int) –
do_draw_layout(cr, state_type, use_text, widget, detail, x, y, layout) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- use_text (bool) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- layout (Pango.Layout) –
do_draw_option(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_resize_grip(cr, state_type, widget, detail, edge, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- widget (Gtk.Widget) –
- detail (str) –
- edge (Gdk.WindowEdge) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_shadow(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_shadow_gap(cr, state_type, shadow_type, widget, detail, x, y, width, height, gap_side, gap_x, gap_width) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
- gap_side (Gtk.PositionType) –
- gap_x (int) –
- gap_width (int) –
do_draw_slider(cr, state_type, shadow_type, widget, detail, x, y, width, height, orientation) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
- orientation (Gtk.Orientation) –
do_draw_spinner(cr, state_type, widget, detail, step, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- widget (Gtk.Widget) –
- detail (str) –
- step (int) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_tab(cr, state_type, shadow_type, widget, detail, x, y, width, height) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- shadow_type (Gtk.ShadowType) –
- widget (Gtk.Widget) –
- detail (str) –
- x (int) –
- y (int) –
- width (int) –
- height (int) –
do_draw_vline(cr, state_type, widget, detail, y1_, y2_, x) virtual¶
Parameters:
- cr (cairo.Context) –
- state_type (Gtk.StateType) –
- widget (Gtk.Widget) –
- detail (str) –
- y1 (int) –
- y2 (int) –
- x (int) –
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:
- source (Gtk.IconSource) – the Gtk.IconSource specifying the icon to render
- direction (Gtk.TextDirection) – a text direction
- state (Gtk.StateType) – a state
- size (int) – the size to render the icon at (Gtk.IconSize). A size of
(GtkIconSize)-1
means render at the size of the source and don’t scale. - widget (Gtk.Widget or None) – the widget
- detail (str or None) – a style detail
Returns:
a newly-created GdkPixbuf.Pixbufcontaining the rendered icon
Return type:
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:
- window (Gdk.Window) – a Gdk.Window
- state_type (Gtk.StateType) – a state
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:
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:
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:
Default Value:
Flags:
READABLE, WRITABLE, CONSTRUCT_ONLY
Gtk.StyleContext to get style from