gtk.Style — an object that hold style information for widgets
class gtk.Style(gobject.GObject): |
Even though the following attributes that are arrays of gtk.gdk.Color, gtk.gdk.GC or gtk.gdk.Pixmap objects are read-only, the individual array items are read-write.
|
gobject.GObject Signal Prototypes
"realize | def callback(style, user_param1, ...) |
"unrealize | def callback(style, user_param1, ...) |
A gtk.Style object encapsulates the information that provides the look and feel for a widget. Each gtk.Widget has an associated gtk.Style object that is used when rendering that widget. Usually the gtk.Style for a widget is the same as the default style that is set by GTK and modified the theme engine. A gtk.Style holds information for the five possible widget states though not every widget supports all five states:
gtk.STATE_NORMAL | The state of a sensitive widget that is not active and does not have the focus |
gtk.STATE_ACTIVE | The state of a sensitive widget when it is active e.g. a button that is pressed but not yet released |
gtk.STATE_PRELIGHT | The state of a sensitive widget that has the focus e.g. a button that has the mouse pointer over it. |
gtk.STATE_SELECTED | The state of a widget that is selected e.g. selected text in a gtk.Entry widget |
gtk.STATE_INSENSITIVE | The state of a widget that is insensitive and will not respond to any events e.g. cannot be activated, selected or prelit. |
A gtk.Style contains the read-only attributes described in the above section.
Usually applications should not need to use or modify the gtk.Style of their widgets.
|
Returns : | a copy of the gtk.Style object |
The copy() method returns a copy of the style object.
|
window : | a gtk.Window. |
Returns : | a gtk.Style object |
The attach() method adapts a style to the specified window. This process allocates the colors and creates the graphics contexts for the style specializing them to a particular visual and colormap. A new gtk.Style may be created if the style has already been adapted to a window with a different style and colormap.
|
The detach() method detaches the style and frees its resources if it is no longer attached.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
The set_background() method sets the background of window to the background color or pixmap of the style for the widget state specified by state_type.
|
window : | a gtk.gdk.Window |
set_bg : | if TRUE use the bg_pixmap for the widget state |
state_type : | the widget state |
area : | the clipping area |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The apply_default_background() method sets the background of the specified window in the area specified by x, y, width and height. The background color is derived from the bg_gc of the style with the state specified by state_type. If area is not None it specifies a clipping area for the application of the background.
|
stock_id : | a stock ID |
Returns : | a gtk.IconSet |
The lookup_icon_set() method looks in the gtk.IconFactory list associated with the style and the default icon factory for the stock icon specified by stock_id. If the stock icon iconset is found it is returned.
|
source : | the gtk.IconSource specifying the icon to render |
direction : | a text direction |
state : | a widget state |
size : | the size to render the icon at. A size of -1 means render at the size of the source and don't scale. |
widget : | a widget |
detail : | a style detail |
Returns : | a gtk.gdk.Pixbuf |
The render_icon() method renders the icon specified by source at the specified size for the specified widget state according to the given parameters and returns the result in a gtk.gdk.Pixbuf.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | the rectangle that clips the output |
widget : | a widget |
detail : | a detail string |
x1 : | the starting x coordinate |
x2 : | the ending x coordinate |
y : | the y coordinate |
The paint_hline() method draws a horizontal line from (x1, y) to (x2, y) in window using the specified state_type of the style. If area is not None the line is clipped by the rectangle specified by area.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | the rectangle to which the output is clipped |
widget : | a widget |
detail : | a detail string |
y1 : | the starting y coordinate |
y2 : | the ending y coordinate |
x : | the x coordinate |
The paint_vline() method draws a vertical line from (x, y1) to (x, y2) in window using the specified state_type of the style. If area is not None the line is clipped by the rectangle specified by area.
|
window : | a gtk.gdk.Window* |
state_type : | a widget state |
shadow_type : | a type of shadow - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | the rectangle to which the output is clipped |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_shadow() method draws a shadow of the specified shadow_type on the specified window with the size specified by x, y, width and height. If area is not None the shadow is clipped to the rectangle' area. state_type specifies the style state to use for drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
points : | a list or tuple containing point (x, y) tuples |
fill : | if TRUE the polygon should be filled |
The paint_polygon() method draws a polygon on the specified window with the shadow type specified by shadow_type connecting the points specified by points. If area is not None it specifies a clipping rectangle. The style state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | the widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
arrow_type : | an arrow type - one of: gtk.ARROW_UP, gtk.ARROW_DOWN, gtk.ARROW_LEFT, gtk.ARROW_RIGHT |
fill : | if TRUE the arrow should be filled |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_arrow() method draws an arrow of the type specified by arrow_type on the specified window with the shadow type specified by shadow_type with the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_diamond() method draws a diamond on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_box() method draws a box on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_flat_box() method draws a flat box (no shadow) on the specified window with the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The style state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_check() method draws a check on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_option() method draws an option menu item on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_tab() method draws a tab on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
gap_side : | a position - one of: gtk.POS_LEFT, gtk.POS_RIGHT, gtk.POS_TOP, gtk.POS_BOTTOM |
gap_x : | the x position of the gap |
gap_width : | the gap width |
The paint_shadow_gap() method draws a shadow with a gap on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. The gap position and width is specified by gap_side, gap_x and gap_width. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
gap_side : | a position - one of: gtk.POS_LEFT, gtk.POS_RIGHT, gtk.POS_TOP, gtk.POS_BOTTOM |
gap_x : | the x position of the gap |
gap_width : | the gap width |
The paint_box_gap() method draws a box with a gap on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. The gap position and width is specified by gap_side, gap_x and gap_width. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
gap_side : | a position - one of: gtk.POS_LEFT, gtk.POS_RIGHT, gtk.POS_TOP, gtk.POS_BOTTOM |
The paint_extension() method draws an extension on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. The extension position is specified by gap_side. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_focus() method draws a focus indicator on the specified window with the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
orientation : | a position - one of: gtk.ORIENTATION_HORIZONTAL or gtk.ORIENTATION_VERTICAL |
The paint_slider() method draws a slider with the specified orientation on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
shadow_type : | a shadow type - one of: gtk.SHADOW_NONE, gtk.SHADOW_IN, gtk.SHADOW_OUT, gtk.SHADOW_ETCHED_IN, gtk.SHADOW_ETCHED_OUT |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
orientation : | a position - one of: gtk.ORIENTATION_HORIZONTAL or gtk.ORIENTATION_VERTICAL |
The paint_handle() method draws a handle with the specified orientation on the specified window with the shadow type specified by shadow_type and the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
expander_style : | an expander style - one of: gtk.EXPANDER_COLLAPSED, gtk.EXPANDER_SEMI_COLLAPSED, gtk.EXPANDER_SEMI_EXPANDED or gtk.EXPANDER_EXPANDED |
The paint_expander() method draws an expander with the specified expander_style on the specified window at the location specified by x, y. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
use_text : | if TRUE use the text graphics context for drawing |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
x : | the x location |
y : | the y location |
layout : | a Pango.Layout object containing the text to display |
The paint_layout() method draws the text in a pango.Layout specified by layout on the specified window at the location specified by x and y. If text is TRUE use the text graphics context of the style for drawing, otherwise use the fg graphics context. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing.
|
window : | a gtk.gdk.Window |
state_type : | a widget state |
area : | a clipping rectangle |
widget : | a widget |
detail : | a detail string |
edge : | the edge in which to draw the resize grip, currently only gtk.WINDOW_EDGE_SOUTH_EAST is implemented |
x : | the x location |
y : | the y location |
width : | the width |
height : | the height |
The paint_resize_grip() method draws a resize grip at the specified edge on the specified window with the location and size specified by x, y, width and height. If area is not None it specifies a clipping rectangle. The widget state specified by state_type determines the graphics context to use while drawing. Currently the grip can only be drawn at the gtk.WINDOW_EDGE_SOUTH_EAST (lower right) edge.
|
style : | the object which received the signal. |
user_param1 : | the first user parameter (if any) specified with the connect() method |
... : | additional user parameters (if any) |
This signal is available in GTK+ 2.4 and above.
Emitted when the style has been initialized for a particular colormap and depth. 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.
|
style : | the object which received the signal. |
user_param1 : | the first user parameter (if any) specified with the connect() method |
... : | additional user parameters (if any) |
This signal is available in GTK+ 2.4 and above.
Emitted when the aspects of the style specific to a particular colormap and depth are being cleaned up. A connection to this signal can be useful if a widget wants to cache objects like a gtk.gdk.GC as object data on gtk.Style. This signal provides a convenient place to free such cached objects.