gtk.Style — an object that hold style information for widgets
class gtk.Style( |
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.
|
def callback( | |
def callback( |
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:
| The state of a sensitive widget that is not active and does not have the focus |
| The state of a sensitive widget when it is active e.g. a button that is pressed but not yet released |
| The state of a sensitive widget that has the focus e.g. a button that has the mouse pointer over it. |
| The state of a widget that is selected e.g. selected text
in a gtk.Entry
widget |
| 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.
def copy()
Returns : | a copy of the gtk.Style
object |
The copy
() method returns a copy of the
style object.
def attach(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.
def detach()
The detach
() method detaches the style and frees its resources if it is no longer attached.
def set_background(window
, state_type
)
| a gtk.gdk.Window |
| 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
.
def apply_default_background(window
, set_bg
, state_type
, area
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| if True use the bg_pixmap
for the widget state |
| the widget state |
| the clipping area |
| the x location |
| the y location |
| the width |
| 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.
def lookup_icon_set(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.
def lookup_color(color_name
)
| the name of the logical color to look up |
Returns : | a gtk.gdk.Color
on succes, None otherwise. |
The lookup_color
() method looks up color_name
in the style's logical color mappings, filling in color and returning True
if found, otherwise returning Flase
.
Do not cache the found mapping, because it depends on the GtkStyle and might
change when a theme switch occurs.
def render_icon(source
, direction
, state
, size
, widget
=None, detail
=None)
| the gtk.IconSource
specifying the icon to render |
| a text direction |
| a widget state |
| the size to render the icon at. A size of -1 means render at the size of the source and don't scale. |
| a widget |
| 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
.
def paint_hline(window
, state_type
, area
, widget
, detail
, x1
, x2
, y
)
| a gtk.gdk.Window |
| a widget state |
| the rectangle that clips the output |
| a widget |
| a detail string |
| the starting x coordinate |
| the ending x coordinate |
| 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
.
def paint_vline(window
, state_type
, area
, widget
, detail
, y1
, y2
, x
)
| a gtk.gdk.Window |
| a widget state |
| the rectangle to which the output is clipped |
| a widget |
| a detail string |
| the starting y coordinate |
| the ending y coordinate |
| 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
.
def paint_shadow(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window * |
| a widget state |
| a type of shadow - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| the rectangle to which the output is clipped |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_polygon(window
, state_type
, shadow_type
, area
, widget
, detail
, points
, fill
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| a list or tuple containing point (x, y) tuples |
| 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.
def paint_arrow(window
, state_type
, shadow_type
, area
, widget
, detail
, arrow_type
, fill
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| the widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| an arrow type - one of:
gtk.ARROW_UP , gtk.ARROW_DOWN ,
gtk.ARROW_LEFT ,
gtk.ARROW_RIGHT |
| if True the arrow should be
filled |
| the x location |
| the y location |
| the width |
| 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.
def paint_diamond(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_box(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_flat_box(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_check(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_option(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_tab(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_shadow_gap(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
, gap_side
, gap_x
, gap_width
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| the height |
| a position - one of:
gtk.POS_LEFT , gtk.POS_RIGHT ,
gtk.POS_TOP ,
gtk.POS_BOTTOM |
| the x position of the gap |
| 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.
def paint_box_gap(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
, gap_side
, gap_x
, gap_width
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| the height |
| a position - one of:
gtk.POS_LEFT , gtk.POS_RIGHT ,
gtk.POS_TOP ,
gtk.POS_BOTTOM |
| the x position of the gap |
| 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.
def paint_extension(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
, gap_side
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| the height |
| 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.
def paint_focus(window
, state_type
, area
, widget
, detail
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| 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.
def paint_slider(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
, orientation
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| the height |
| 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.
def paint_handle(window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
, orientation
)
| a gtk.gdk.Window |
| a widget state |
| a shadow type - one of:
gtk.SHADOW_NONE , gtk.SHADOW_IN ,
gtk.SHADOW_OUT , gtk.SHADOW_ETCHED_IN ,
gtk.SHADOW_ETCHED_OUT |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| the width |
| the height |
| 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.
def paint_expander(window
, state_type
, area
, widget
, detail
, x
, y
, expander_style
)
| a gtk.gdk.Window |
| a widget state |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| 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.
def paint_layout(window
, state_type
, use_text
, area
, widget
, detail
, x
, y
, layout
)
| a gtk.gdk.Window |
| a widget state |
| if True use the text
graphics context for drawing |
| a clipping rectangle |
| a widget |
| a detail string |
| the x location |
| the y location |
| 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.
def paint_resize_grip(window
, state_type
, area
, widget
, detail
, edge
, x
, y
, width
, height
)
| a gtk.gdk.Window |
| a widget state |
| a clipping rectangle |
| a widget |
| a detail string |
| the edge in which to draw the resize grip,
currently only gtk.WINDOW_EDGE_SOUTH_EAST is
implemented |
| the x location |
| the y location |
| the width |
| 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.
def callback(style
, user_param1
, ...
)
| the object which received the signal. |
| the first user parameter (if any) specified
with the connect () |
| 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.
def callback(style
, user_param1
, ...
)
| the object which received the signal. |
| the first user parameter (if any) specified
with the connect () |
| 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.