Styles

Styles — Functions for drawing widget parts

Functions

#define GTK_STYLE_ATTACHED()
GtkStyle * gtk_style_new ()
GtkStyle * gtk_style_copy ()
GtkStyle * gtk_style_attach ()
void gtk_style_detach ()
GtkStyle * gtk_style_ref ()
void gtk_style_unref ()
void gtk_style_set_background ()
void gtk_style_apply_default_background ()
#define gtk_style_apply_default_pixmap()
gboolean gtk_style_lookup_color ()
GtkIconSet * gtk_style_lookup_icon_set ()
GdkPixbuf * gtk_style_render_icon ()
GdkFont * gtk_style_get_font ()
void gtk_style_set_font ()
void gtk_style_get_style_property ()
void gtk_style_get_valist ()
void gtk_style_get ()
void gtk_draw_hline ()
void gtk_draw_vline ()
void gtk_draw_shadow ()
void gtk_draw_polygon ()
void gtk_draw_arrow ()
void gtk_draw_diamond ()
void gtk_draw_string ()
void gtk_draw_box ()
void gtk_draw_box_gap ()
void gtk_draw_check ()
void gtk_draw_extension ()
void gtk_draw_flat_box ()
void gtk_draw_focus ()
void gtk_draw_handle ()
void gtk_draw_option ()
void gtk_draw_shadow_gap ()
void gtk_draw_slider ()
void gtk_draw_tab ()
void gtk_draw_expander ()
void gtk_draw_layout ()
void gtk_draw_resize_grip ()
void gtk_paint_arrow ()
void gtk_paint_box ()
void gtk_paint_box_gap ()
void gtk_paint_check ()
void gtk_paint_diamond ()
void gtk_paint_extension ()
void gtk_paint_flat_box ()
void gtk_paint_focus ()
void gtk_paint_handle ()
void gtk_paint_hline ()
void gtk_paint_option ()
void gtk_paint_polygon ()
void gtk_paint_shadow ()
void gtk_paint_shadow_gap ()
void gtk_paint_slider ()
void gtk_paint_spinner ()
void gtk_paint_string ()
void gtk_paint_tab ()
void gtk_paint_vline ()
void gtk_paint_expander ()
void gtk_paint_layout ()
void gtk_paint_resize_grip ()
void gtk_draw_insertion_cursor ()
GtkBorder * gtk_border_new ()
GtkBorder * gtk_border_copy ()
void gtk_border_free ()
gboolean (*GtkRcPropertyParser) ()

Signals

Types and Values

struct GtkStyle
struct GtkBorder
  GtkRcProperty

Object Hierarchy

    GBoxed
    ╰── GtkBorder
    GObject
    ╰── GtkStyle

Includes

#include <gtk/gtk.h>

Description

Functions

GTK_STYLE_ATTACHED()

#define GTK_STYLE_ATTACHED(style) (GTK_STYLE (style)->attach_count > 0)

Returns whether the style is attached to a window.

Parameters

style

a GtkStyle.

 

gtk_style_new ()

GtkStyle *
gtk_style_new (void);

Creates a new GtkStyle.

Returns

a new GtkStyle.


gtk_style_copy ()

GtkStyle *
gtk_style_copy (GtkStyle *style);

Creates a copy of the passed in GtkStyle object.

Parameters

style

a GtkStyle

 

Returns

a copy of style .

[transfer full]


gtk_style_attach ()

GtkStyle *
gtk_style_attach (GtkStyle *style,
                  GdkWindow *window);

Attaches a style to a window; this process allocates the colors and creates the GC's for the style - it specializes it to a particular visual and colormap. The process may involve the creation of a new style if the style has already been attached to a window with a different style and colormap.

Since this function may return a new object, you have to use it in the following way: style = gtk_style_attach (style, window)

Parameters

style

a GtkStyle.

 

window

a GdkWindow.

 

Returns

Either style , or a newly-created GtkStyle. If the style is newly created, the style parameter will be unref'ed, and the new style will have a reference count belonging to the caller.


gtk_style_detach ()

void
gtk_style_detach (GtkStyle *style);

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

Parameters

style

a GtkStyle

 

gtk_style_ref ()

GtkStyle *
gtk_style_ref (GtkStyle *style);

gtk_style_ref has been deprecated since version 2.0 and should not be used in newly-written code.

use g_object_ref() instead.

Increase the reference count of style .

Parameters

style

a GtkStyle.

 

Returns

style .


gtk_style_unref ()

void
gtk_style_unref (GtkStyle *style);

gtk_style_unref has been deprecated since version 2.0 and should not be used in newly-written code.

use g_object_unref() instead.

Decrease the reference count of style .

Parameters

style

a GtkStyle.

 

gtk_style_set_background ()

void
gtk_style_set_background (GtkStyle *style,
                          GdkWindow *window,
                          GtkStateType state_type);

gtk_style_set_background is deprecated and should not be used in newly-written code.

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

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

gtk_style_apply_default_background ()

void
gtk_style_apply_default_background (GtkStyle *style,
                                    GdkWindow *window,
                                    gboolean set_bg,
                                    GtkStateType state_type,
                                    const GdkRectangle *area,
                                    gint x,
                                    gint y,
                                    gint width,
                                    gint height);

Parameters

area

.

[allow-none]

gtk_style_apply_default_pixmap()

#define gtk_style_apply_default_pixmap(s,gw,st,a,x,y,w,h) gtk_style_apply_default_background (s,gw,1,st,a,x,y,w,h)

gtk_style_apply_default_pixmap is deprecated and should not be used in newly-written code.

Use gtk_style_apply_default_background() instead.

Does the same as gtk_style_apply_default_background().


gtk_style_lookup_color ()

gboolean
gtk_style_lookup_color (GtkStyle *style,
                        const gchar *color_name,
                        GdkColor *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 GtkStyle and might change when a theme switch occurs.

Parameters

style

a GtkStyle

 

color_name

the name of the logical color to look up

 

color

the GdkColor to fill in.

[out]

Returns

TRUE if the mapping was found.

Since: 2.10


gtk_style_lookup_icon_set ()

GtkIconSet *
gtk_style_lookup_icon_set (GtkStyle *style,
                           const gchar *stock_id);

Looks up stock_id in the icon factories associated with style and the default icon factory, returning an icon set if found, otherwise NULL.

Parameters

style

a GtkStyle

 

stock_id

an icon name

 

Returns

icon set of stock_id .

[transfer none]


gtk_style_render_icon ()

GdkPixbuf *
gtk_style_render_icon (GtkStyle *style,
                       const GtkIconSource *source,
                       GtkTextDirection direction,
                       GtkStateType state,
                       GtkIconSize size,
                       GtkWidget *widget,
                       const gchar *detail);

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

Parameters

style

a GtkStyle

 

source

the GtkIconSource specifying the icon to render

 

direction

a text direction

 

state

a state

 

size

(type int) the size to render the icon at. A size of (GtkIconSize)-1 means render at the size of the source and don't scale.

 

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

Returns

a newly-created GdkPixbuf containing the rendered icon.

[transfer full]


gtk_style_get_font ()

GdkFont *
gtk_style_get_font (GtkStyle *style);

gtk_style_get_font is deprecated and should not be used in newly-written code.

Gets the GdkFont to use for the given style. This is meant only as a replacement for direct access to style->font and should not be used in new code. New code should use style->font_desc instead.

Parameters

style

a GtkStyle

 

Returns

the GdkFont for the style. This font is owned by the style; if you want to keep around a copy, you must call gdk_font_ref().


gtk_style_set_font ()

void
gtk_style_set_font (GtkStyle *style,
                    GdkFont *font);

gtk_style_set_font is deprecated and should not be used in newly-written code.

Sets the GdkFont to use for a given style. This is meant only as a replacement for direct access to style->font and should not be used in new code. New code should use style->font_desc instead.

Parameters

style

a GtkStyle.

 

font

a GdkFont, or NULL to use the GdkFont corresponding to style->font_desc.

[allow-none]

gtk_style_get_style_property ()

void
gtk_style_get_style_property (GtkStyle *style,
                              GType widget_type,
                              const gchar *property_name,
                              GValue *value);

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

Parameters

style

a GtkStyle

 

widget_type

the GType of a descendant of GtkWidget

 

property_name

the name of the style property to get

 

value

a GValue where the value of the property being queried will be stored

 

Since: 2.16


gtk_style_get_valist ()

void
gtk_style_get_valist (GtkStyle *style,
                      GType widget_type,
                      const gchar *first_property_name,
                      va_list var_args);

Non-vararg variant of gtk_style_get(). Used primarily by language bindings.

Parameters

style

a GtkStyle

 

widget_type

the GType of a descendant of GtkWidget

 

first_property_name

the name of the first style property to get

 

var_args

a va_list of pairs of property names and locations to return the property values, starting with the location for first_property_name .

 

Since: 2.16


gtk_style_get ()

void
gtk_style_get (GtkStyle *style,
               GType widget_type,
               const gchar *first_property_name,
               ...);

Gets the values of a multiple style properties for widget_type from style .

Parameters

style

a GtkStyle

 

widget_type

the GType of a descendant of GtkWidget

 

first_property_name

the name of the first style property to get

 

Since: 2.16


gtk_draw_hline ()

void
gtk_draw_hline (GtkStyle *style,
                GdkWindow *window,
                GtkStateType state_type,
                gint x1,
                gint x2,
                gint y);

gtk_draw_hline has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_hline() instead.

Draws a horizontal line from (x1 , y ) to (x2 , y ) in window using the given style and state.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

x1

the starting x coordinate

 

x2

the ending x coordinate

 

y

the y coordinate

 

gtk_draw_vline ()

void
gtk_draw_vline (GtkStyle *style,
                GdkWindow *window,
                GtkStateType state_type,
                gint y1_,
                gint y2_,
                gint x);

gtk_draw_vline has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_vline() instead.

Draws a vertical line from (x , y1_ ) to (x , y2_ ) in window using the given style and state.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

y1_

the starting y coordinate

 

y2_

the ending y coordinate

 

x

the x coordinate

 

gtk_draw_shadow ()

void
gtk_draw_shadow (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 GtkShadowType shadow_type,
                 gint x,
                 gint y,
                 gint width,
                 gint height);

gtk_draw_shadow has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_shadow() instead.

Draws a shadow around the given rectangle in window using the given style and state and shadow type.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

x

x origin of the rectangle

 

y

y origin of the rectangle

 

width

width of the rectangle

 

height

width of the rectangle

 

gtk_draw_polygon ()

void
gtk_draw_polygon (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  GdkPoint *points,
                  gint npoints,
                  gboolean fill);

gtk_draw_polygon has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_polygon() instead.

Draws a polygon on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

points

an array of GdkPoints

 

npoints

length of points

 

fill

TRUE if the polygon should be filled

 

gtk_draw_arrow ()

void
gtk_draw_arrow (GtkStyle *style,
                GdkWindow *window,
                GtkStateType state_type,
                GtkShadowType shadow_type,
                GtkArrowType arrow_type,
                gboolean fill,
                gint x,
                gint y,
                gint width,
                gint height);

gtk_draw_arrow has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_arrow() instead.

Draws an arrow in the given rectangle on window using the given parameters. arrow_type determines the direction of the arrow.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

arrow_type

the type of arrow to draw

 

fill

TRUE if the arrow tip should be filled

 

x

x origin of the rectangle to draw the arrow in

 

y

y origin of the rectangle to draw the arrow in

 

width

width of the rectangle to draw the arrow in

 

height

height of the rectangle to draw the arrow in

 

gtk_draw_diamond ()

void
gtk_draw_diamond (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  gint x,
                  gint y,
                  gint width,
                  gint height);

gtk_draw_diamond has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_diamond() instead.

Draws a diamond in the given rectangle on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

x

x origin of the rectangle to draw the diamond in

 

y

y origin of the rectangle to draw the diamond in

 

width

width of the rectangle to draw the diamond in

 

height

height of the rectangle to draw the diamond in

 

gtk_draw_string ()

void
gtk_draw_string (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 gint x,
                 gint y,
                 const gchar *string);

gtk_draw_string has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_layout() instead.

Draws a text string on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

x

x origin

 

y

y origin

 

string

the string to draw

 

gtk_draw_box ()

void
gtk_draw_box (GtkStyle *style,
              GdkWindow *window,
              GtkStateType state_type,
              GtkShadowType shadow_type,
              gint x,
              gint y,
              gint width,
              gint height);

gtk_draw_box has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_box() instead.

Draws a box on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

x

x origin of the box

 

y

y origin of the box

 

width

the width of the box

 

height

the height of the box

 

gtk_draw_box_gap ()

void
gtk_draw_box_gap (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  gint x,
                  gint y,
                  gint width,
                  gint height,
                  GtkPositionType gap_side,
                  gint gap_x,
                  gint gap_width);

gtk_draw_box_gap has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_box_gap() instead.

Draws a box in window using the given style and state and shadow type, leaving a gap in one side.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

x

x origin of the rectangle

 

y

y origin of the rectangle

 

width

width of the rectangle

 

height

width of the rectangle

 

gap_side

side in which to leave the gap

 

gap_x

starting position of the gap

 

gap_width

width of the gap

 

gtk_draw_check ()

void
gtk_draw_check (GtkStyle *style,
                GdkWindow *window,
                GtkStateType state_type,
                GtkShadowType shadow_type,
                gint x,
                gint y,
                gint width,
                gint height);

gtk_draw_check has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_check() instead.

Draws a check button indicator in the given rectangle on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

x

x origin of the rectangle to draw the check in

 

y

y origin of the rectangle to draw the check in

 

width

the width of the rectangle to draw the check in

 

height

the height of the rectangle to draw the check in

 

gtk_draw_extension ()

void
gtk_draw_extension (GtkStyle *style,
                    GdkWindow *window,
                    GtkStateType state_type,
                    GtkShadowType shadow_type,
                    gint x,
                    gint y,
                    gint width,
                    gint height,
                    GtkPositionType gap_side);

gtk_draw_extension has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_extension() instead.

Draws an extension, i.e. a notebook tab.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

x

x origin of the extension

 

y

y origin of the extension

 

width

width of the extension

 

height

width of the extension

 

gap_side

the side on to which the extension is attached

 

gtk_draw_flat_box ()

void
gtk_draw_flat_box (GtkStyle *style,
                   GdkWindow *window,
                   GtkStateType state_type,
                   GtkShadowType shadow_type,
                   gint x,
                   gint y,
                   gint width,
                   gint height);

gtk_draw_flat_box has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_flat_box() instead.

Draws a flat box on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

x

x origin of the box

 

y

y origin of the box

 

width

the width of the box

 

height

the height of the box

 

gtk_draw_focus ()

void
gtk_draw_focus (GtkStyle *style,
                GdkWindow *window,
                gint x,
                gint y,
                gint width,
                gint height);

gtk_draw_focus has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_focus() instead.

Draws a focus indicator around the given rectangle on window using the given style.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

x

the x origin of the rectangle around which to draw a focus indicator

 

y

the y origin of the rectangle around which to draw a focus indicator

 

width

the width of the rectangle around which to draw a focus indicator

 

height

the height of the rectangle around which to draw a focus indicator

 

gtk_draw_handle ()

void
gtk_draw_handle (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 GtkShadowType shadow_type,
                 gint x,
                 gint y,
                 gint width,
                 gint height,
                 GtkOrientation orientation);

gtk_draw_handle has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_handle() instead.

Draws a handle as used in GtkHandleBox and GtkPaned.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

x

x origin of the handle

 

y

y origin of the handle

 

width

with of the handle

 

height

height of the handle

 

orientation

the orientation of the handle

 

gtk_draw_option ()

void
gtk_draw_option (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 GtkShadowType shadow_type,
                 gint x,
                 gint y,
                 gint width,
                 gint height);

gtk_draw_option has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_option() instead.

Draws a radio button indicator in the given rectangle on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

x

x origin of the rectangle to draw the option in

 

y

y origin of the rectangle to draw the option in

 

width

the width of the rectangle to draw the option in

 

height

the height of the rectangle to draw the option in

 

gtk_draw_shadow_gap ()

void
gtk_draw_shadow_gap (GtkStyle *style,
                     GdkWindow *window,
                     GtkStateType state_type,
                     GtkShadowType shadow_type,
                     gint x,
                     gint y,
                     gint width,
                     gint height,
                     GtkPositionType gap_side,
                     gint gap_x,
                     gint gap_width);

gtk_draw_shadow_gap has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_shadow_gap() instead.

Draws a shadow around the given rectangle in window using the given style and state and shadow type, leaving a gap in one side.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

x

x origin of the rectangle

 

y

y origin of the rectangle

 

width

width of the rectangle

 

height

width of the rectangle

 

gap_side

side in which to leave the gap

 

gap_x

starting position of the gap

 

gap_width

width of the gap

 

gtk_draw_slider ()

void
gtk_draw_slider (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 GtkShadowType shadow_type,
                 gint x,
                 gint y,
                 gint width,
                 gint height,
                 GtkOrientation orientation);

gtk_draw_slider is deprecated and should not be used in newly-written code.

Draws a slider in the given rectangle on window using the given style and orientation.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

a shadow

 

x

the x origin of the rectangle in which to draw a slider

 

y

the y origin of the rectangle in which to draw a slider

 

width

the width of the rectangle in which to draw a slider

 

height

the height of the rectangle in which to draw a slider

 

orientation

the orientation to be used

 

gtk_draw_tab ()

void
gtk_draw_tab (GtkStyle *style,
              GdkWindow *window,
              GtkStateType state_type,
              GtkShadowType shadow_type,
              gint x,
              gint y,
              gint width,
              gint height);

gtk_draw_tab has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_tab() instead.

Draws an option menu tab (i.e. the up and down pointing arrows) in the given rectangle on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

x

x origin of the rectangle to draw the tab in

 

y

y origin of the rectangle to draw the tab in

 

width

the width of the rectangle to draw the tab in

 

height

the height of the rectangle to draw the tab in

 

gtk_draw_expander ()

void
gtk_draw_expander (GtkStyle *style,
                   GdkWindow *window,
                   GtkStateType state_type,
                   gint x,
                   gint y,
                   GtkExpanderStyle expander_style);

gtk_draw_expander has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_expander() instead.

Draws an expander as used in GtkTreeView.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

x

the x position to draw the expander at

 

y

the y position to draw the expander at

 

expander_style

the style to draw the expander in

 

gtk_draw_layout ()

void
gtk_draw_layout (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 gboolean use_text,
                 gint x,
                 gint y,
                 PangoLayout *layout);

gtk_draw_layout is deprecated and should not be used in newly-written code.

Draws a layout on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

use_text

whether to use the text or foreground graphics context of style

 

x

x origin

 

y

y origin

 

layout

the layout to draw

 

gtk_draw_resize_grip ()

void
gtk_draw_resize_grip (GtkStyle *style,
                      GdkWindow *window,
                      GtkStateType state_type,
                      GdkWindowEdge edge,
                      gint x,
                      gint y,
                      gint width,
                      gint height);

gtk_draw_resize_grip has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_resize_grip() instead.

Draws a resize grip in the given rectangle on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

edge

the edge in which to draw the resize grip

 

x

the x origin of the rectangle in which to draw the resize grip

 

y

the y origin of the rectangle in which to draw the resize grip

 

width

the width of the rectangle in which to draw the resize grip

 

height

the height of the rectangle in which to draw the resize grip

 

gtk_paint_arrow ()

void
gtk_paint_arrow (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 GtkShadowType shadow_type,
                 const GdkRectangle *area,
                 GtkWidget *widget,
                 const gchar *detail,
                 GtkArrowType arrow_type,
                 gboolean fill,
                 gint x,
                 gint y,
                 gint width,
                 gint height);

Draws an arrow in the given rectangle on window using the given parameters. arrow_type determines the direction of the arrow.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

arrow_type

the type of arrow to draw

 

fill

TRUE if the arrow tip should be filled

 

x

x origin of the rectangle to draw the arrow in

 

y

y origin of the rectangle to draw the arrow in

 

width

width of the rectangle to draw the arrow in

 

height

height of the rectangle to draw the arrow in

 

gtk_paint_box ()

void
gtk_paint_box (GtkStyle *style,
               GdkWindow *window,
               GtkStateType state_type,
               GtkShadowType shadow_type,
               const GdkRectangle *area,
               GtkWidget *widget,
               const gchar *detail,
               gint x,
               gint y,
               gint width,
               gint height);

Draws a box on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the box

 

y

y origin of the box

 

width

the width of the box

 

height

the height of the box

 

gtk_paint_box_gap ()

void
gtk_paint_box_gap (GtkStyle *style,
                   GdkWindow *window,
                   GtkStateType state_type,
                   GtkShadowType shadow_type,
                   const GdkRectangle *area,
                   GtkWidget *widget,
                   const gchar *detail,
                   gint x,
                   gint y,
                   gint width,
                   gint height,
                   GtkPositionType gap_side,
                   gint gap_x,
                   gint gap_width);

Draws a box in window using the given style and state and shadow type, leaving a gap in one side.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the rectangle

 

y

y origin of the rectangle

 

width

width of the rectangle

 

height

width of the rectangle

 

gap_side

side in which to leave the gap

 

gap_x

starting position of the gap

 

gap_width

width of the gap

 

gtk_paint_check ()

void
gtk_paint_check (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 GtkShadowType shadow_type,
                 const GdkRectangle *area,
                 GtkWidget *widget,
                 const gchar *detail,
                 gint x,
                 gint y,
                 gint width,
                 gint height);

Draws a check button indicator in the given rectangle on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the rectangle to draw the check in

 

y

y origin of the rectangle to draw the check in

 

width

the width of the rectangle to draw the check in

 

height

the height of the rectangle to draw the check in

 

gtk_paint_diamond ()

void
gtk_paint_diamond (GtkStyle *style,
                   GdkWindow *window,
                   GtkStateType state_type,
                   GtkShadowType shadow_type,
                   const GdkRectangle *area,
                   GtkWidget *widget,
                   const gchar *detail,
                   gint x,
                   gint y,
                   gint width,
                   gint height);

Draws a diamond in the given rectangle on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the rectangle to draw the diamond in

 

y

y origin of the rectangle to draw the diamond in

 

width

width of the rectangle to draw the diamond in

 

height

height of the rectangle to draw the diamond in

 

gtk_paint_extension ()

void
gtk_paint_extension (GtkStyle *style,
                     GdkWindow *window,
                     GtkStateType state_type,
                     GtkShadowType shadow_type,
                     const GdkRectangle *area,
                     GtkWidget *widget,
                     const gchar *detail,
                     gint x,
                     gint y,
                     gint width,
                     gint height,
                     GtkPositionType gap_side);

Draws an extension, i.e. a notebook tab.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the extension

 

y

y origin of the extension

 

width

width of the extension

 

height

width of the extension

 

gap_side

the side on to which the extension is attached

 

gtk_paint_flat_box ()

void
gtk_paint_flat_box (GtkStyle *style,
                    GdkWindow *window,
                    GtkStateType state_type,
                    GtkShadowType shadow_type,
                    const GdkRectangle *area,
                    GtkWidget *widget,
                    const gchar *detail,
                    gint x,
                    gint y,
                    gint width,
                    gint height);

Draws a flat box on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the box

 

y

y origin of the box

 

width

the width of the box

 

height

the height of the box

 

gtk_paint_focus ()

void
gtk_paint_focus (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 const GdkRectangle *area,
                 GtkWidget *widget,
                 const gchar *detail,
                 gint x,
                 gint y,
                 gint width,
                 gint height);

Draws a focus indicator around the given rectangle on window using the given style.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

the x origin of the rectangle around which to draw a focus indicator

 

y

the y origin of the rectangle around which to draw a focus indicator

 

width

the width of the rectangle around which to draw a focus indicator

 

height

the height of the rectangle around which to draw a focus indicator

 

gtk_paint_handle ()

void
gtk_paint_handle (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  const GdkRectangle *area,
                  GtkWidget *widget,
                  const gchar *detail,
                  gint x,
                  gint y,
                  gint width,
                  gint height,
                  GtkOrientation orientation);

Draws a handle as used in GtkHandleBox and GtkPaned.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the handle

 

y

y origin of the handle

 

width

with of the handle

 

height

height of the handle

 

orientation

the orientation of the handle

 

gtk_paint_hline ()

void
gtk_paint_hline (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 const GdkRectangle *area,
                 GtkWidget *widget,
                 const gchar *detail,
                 gint x1,
                 gint x2,
                 gint y);

gtk_paint_hline is deprecated and should not be used in newly-written code.

Draws a horizontal line from (x1 , y ) to (x2 , y ) in window using the given style and state.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

area

rectangle to which the output is clipped, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x1

the starting x coordinate

 

x2

the ending x coordinate

 

y

the y coordinate

 

gtk_paint_option ()

void
gtk_paint_option (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  const GdkRectangle *area,
                  GtkWidget *widget,
                  const gchar *detail,
                  gint x,
                  gint y,
                  gint width,
                  gint height);

Draws a radio button indicator in the given rectangle on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the rectangle to draw the option in

 

y

y origin of the rectangle to draw the option in

 

width

the width of the rectangle to draw the option in

 

height

the height of the rectangle to draw the option in

 

gtk_paint_polygon ()

void
gtk_paint_polygon (GtkStyle *style,
                   GdkWindow *window,
                   GtkStateType state_type,
                   GtkShadowType shadow_type,
                   const GdkRectangle *area,
                   GtkWidget *widget,
                   const gchar *detail,
                   const GdkPoint *points,
                   gint n_points,
                   gboolean fill);

Draws a polygon on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

points

an array of GdkPoints

 

n_points

length of points

 

fill

TRUE if the polygon should be filled

 

gtk_paint_shadow ()

void
gtk_paint_shadow (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  const GdkRectangle *area,
                  GtkWidget *widget,
                  const gchar *detail,
                  gint x,
                  gint y,
                  gint width,
                  gint height);

Draws a shadow around the given rectangle in window using the given style and state and shadow type.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

area

clip rectangle or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the rectangle

 

y

y origin of the rectangle

 

width

width of the rectangle

 

height

width of the rectangle

 

gtk_paint_shadow_gap ()

void
gtk_paint_shadow_gap (GtkStyle *style,
                      GdkWindow *window,
                      GtkStateType state_type,
                      GtkShadowType shadow_type,
                      const GdkRectangle *area,
                      GtkWidget *widget,
                      const gchar *detail,
                      gint x,
                      gint y,
                      gint width,
                      gint height,
                      GtkPositionType gap_side,
                      gint gap_x,
                      gint gap_width);

Draws a shadow around the given rectangle in window using the given style and state and shadow type, leaving a gap in one side.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the rectangle

 

y

y origin of the rectangle

 

width

width of the rectangle

 

height

width of the rectangle

 

gap_side

side in which to leave the gap

 

gap_x

starting position of the gap

 

gap_width

width of the gap

 

gtk_paint_slider ()

void
gtk_paint_slider (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  const GdkRectangle *area,
                  GtkWidget *widget,
                  const gchar *detail,
                  gint x,
                  gint y,
                  gint width,
                  gint height,
                  GtkOrientation orientation);

Draws a slider in the given rectangle on window using the given style and orientation.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

a shadow

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

the x origin of the rectangle in which to draw a slider

 

y

the y origin of the rectangle in which to draw a slider

 

width

the width of the rectangle in which to draw a slider

 

height

the height of the rectangle in which to draw a slider

 

orientation

the orientation to be used

 

gtk_paint_spinner ()

void
gtk_paint_spinner (GtkStyle *style,
                   GdkWindow *window,
                   GtkStateType state_type,
                   const GdkRectangle *area,
                   GtkWidget *widget,
                   const gchar *detail,
                   guint step,
                   gint x,
                   gint y,
                   gint width,
                   gint height);

Draws a spinner on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget (may be NULL).

[allow-none]

detail

a style detail (may be NULL).

[allow-none]

step

the nth step, a value between 0 and “num-steps”

 

x

the x origin of the rectangle in which to draw the spinner

 

y

the y origin of the rectangle in which to draw the spinner

 

width

the width of the rectangle in which to draw the spinner

 

height

the height of the rectangle in which to draw the spinner

 

Since: 2.20


gtk_paint_string ()

void
gtk_paint_string (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  const GdkRectangle *area,
                  GtkWidget *widget,
                  const gchar *detail,
                  gint x,
                  gint y,
                  const gchar *string);

gtk_paint_string has been deprecated since version 2.0 and should not be used in newly-written code.

Use gtk_paint_layout() instead.

Draws a text string on window with the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin

 

y

y origin

 

string

the string to draw

 

gtk_paint_tab ()

void
gtk_paint_tab (GtkStyle *style,
               GdkWindow *window,
               GtkStateType state_type,
               GtkShadowType shadow_type,
               const GdkRectangle *area,
               GtkWidget *widget,
               const gchar *detail,
               gint x,
               gint y,
               gint width,
               gint height);

Draws an option menu tab (i.e. the up and down pointing arrows) in the given rectangle on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

shadow_type

the type of shadow to draw

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin of the rectangle to draw the tab in

 

y

y origin of the rectangle to draw the tab in

 

width

the width of the rectangle to draw the tab in

 

height

the height of the rectangle to draw the tab in

 

gtk_paint_vline ()

void
gtk_paint_vline (GtkStyle *style,
                 GdkWindow *window,
                 GtkStateType state_type,
                 const GdkRectangle *area,
                 GtkWidget *widget,
                 const gchar *detail,
                 gint y1_,
                 gint y2_,
                 gint x);

Draws a vertical line from (x , y1_ ) to (x , y2_ ) in window using the given style and state.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

area

rectangle to which the output is clipped, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

y1_

the starting y coordinate

 

y2_

the ending y coordinate

 

x

the x coordinate

 

gtk_paint_expander ()

void
gtk_paint_expander (GtkStyle *style,
                    GdkWindow *window,
                    GtkStateType state_type,
                    const GdkRectangle *area,
                    GtkWidget *widget,
                    const gchar *detail,
                    gint x,
                    gint y,
                    GtkExpanderStyle expander_style);

Draws an expander as used in GtkTreeView. x and y specify the center the expander. The size of the expander is determined by the "expander-size" style property of widget . (If widget is not specified or doesn't have an "expander-size" property, an unspecified default size will be used, since the caller doesn't have sufficient information to position the expander, this is likely not useful.) The expander is expander_size pixels tall in the collapsed position and expander_size pixels wide in the expanded position.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

the x position to draw the expander at

 

y

the y position to draw the expander at

 

expander_style

the style to draw the expander in; determines whether the expander is collapsed, expanded, or in an intermediate state.

 

gtk_paint_layout ()

void
gtk_paint_layout (GtkStyle *style,
                  GdkWindow *window,
                  GtkStateType state_type,
                  gboolean use_text,
                  const GdkRectangle *area,
                  GtkWidget *widget,
                  const gchar *detail,
                  gint x,
                  gint y,
                  PangoLayout *layout);

Draws a layout on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

use_text

whether to use the text or foreground graphics context of style

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

x

x origin

 

y

y origin

 

layout

the layout to draw

 

gtk_paint_resize_grip ()

void
gtk_paint_resize_grip (GtkStyle *style,
                       GdkWindow *window,
                       GtkStateType state_type,
                       const GdkRectangle *area,
                       GtkWidget *widget,
                       const gchar *detail,
                       GdkWindowEdge edge,
                       gint x,
                       gint y,
                       gint width,
                       gint height);

Draws a resize grip in the given rectangle on window using the given parameters.

Parameters

style

a GtkStyle

 

window

a GdkWindow

 

state_type

a state

 

area

clip rectangle, or NULL if the output should not be clipped.

[allow-none]

widget

the widget.

[allow-none]

detail

a style detail.

[allow-none]

edge

the edge in which to draw the resize grip

 

x

the x origin of the rectangle in which to draw the resize grip

 

y

the y origin of the rectangle in which to draw the resize grip

 

width

the width of the rectangle in which to draw the resize grip

 

height

the height of the rectangle in which to draw the resize grip

 

gtk_draw_insertion_cursor ()

void
gtk_draw_insertion_cursor (GtkWidget *widget,
                           GdkDrawable *drawable,
                           const GdkRectangle *area,
                           const GdkRectangle *location,
                           gboolean is_primary,
                           GtkTextDirection direction,
                           gboolean draw_arrow);

gtk_draw_insertion_cursor is deprecated and should not be used in newly-written code.

Draws a text caret on drawable at location . This is not a style function but merely a convenience function for drawing the standard cursor shape.

Parameters

widget

a GtkWidget

 

drawable

a GdkDrawable

 

area

rectangle to which the output is clipped, or NULL if the output should not be clipped.

[allow-none]

location

location where to draw the cursor (location->width is ignored)

 

is_primary

if the cursor should be the primary cursor color.

 

direction

whether the cursor is left-to-right or right-to-left. Should never be GTK_TEXT_DIR_NONE

 

draw_arrow

TRUE to draw a directional arrow on the cursor. Should be FALSE unless the cursor is split.

 

Since: 2.4


gtk_border_new ()

GtkBorder *
gtk_border_new (void);

Allocates a new GtkBorder structure and initializes its elements to zero.

Returns

a new empty GtkBorder. The newly allocated GtkBorder should be freed with gtk_border_free()

Since: 2.14


gtk_border_copy ()

GtkBorder *
gtk_border_copy (const GtkBorder *border_);

Copies a GtkBorder structure.

Parameters

border_

a GtkBorder.

 

Returns

a copy of border_ .


gtk_border_free ()

void
gtk_border_free (GtkBorder *border_);

Frees a GtkBorder structure.

Parameters

border_

a GtkBorder.

 

GtkRcPropertyParser ()

gboolean
(*GtkRcPropertyParser) (const GParamSpec *pspec,
                        const GString *rc_string,
                        GValue *property_value);

Types and Values

struct GtkStyle

struct GtkStyle {
  GdkColor fg[5];
  GdkColor bg[5];
  GdkColor light[5];
  GdkColor dark[5];
  GdkColor mid[5];
  GdkColor text[5];
  GdkColor base[5];
  GdkColor text_aa[5];		/* Halfway between text/base */

  GdkColor black;
  GdkColor white;
  PangoFontDescription *font_desc;

  gint xthickness;
  gint ythickness;

  GdkGC *fg_gc[5];
  GdkGC *bg_gc[5];
  GdkGC *light_gc[5];
  GdkGC *dark_gc[5];
  GdkGC *mid_gc[5];
  GdkGC *text_gc[5];
  GdkGC *base_gc[5];
  GdkGC *text_aa_gc[5];
  GdkGC *black_gc;
  GdkGC *white_gc;

  GdkPixmap *bg_pixmap[5];
};


struct GtkBorder

struct GtkBorder {
  gint left;
  gint right;
  gint top;
  gint bottom;
};

A struct that specifies a border around a rectangular area that can be of different width on each side.


GtkRcProperty

typedef struct {
  /* quark-ified property identifier like "GtkScrollbar::spacing" */
  GQuark type_name;
  GQuark property_name;

  /* fields similar to GtkSettingsValue */
  gchar *origin;
  GValue value;
} GtkRcProperty;

Signal Details

The “realize” signal

void
user_function (GtkStyle *style,
               gpointer  user_data)

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.

Parameters

style

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

Since: 2.4


The “unrealize” signal

void
user_function (GtkStyle *style,
               gpointer  user_data)

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 GdkGC as object data on GtkStyle. This signal provides a convenient place to free such cached objects.

Parameters

style

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

Since: 2.4