* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
-#include <config.h>
+#include "config.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <gobject/gvaluecollector.h>
#include "gtkgc.h"
#include "gtkmarshalers.h"
+#undef GTK_DISABLE_DEPRECATED
#include "gtkrc.h"
#include "gtkspinbutton.h"
#include "gtkstyle.h"
gint y,
gint width,
gint height);
+static void gtk_default_draw_spinner (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ guint step,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
static void rgb_to_hls (gdouble *r,
gdouble *g,
klass->draw_expander = gtk_default_draw_expander;
klass->draw_layout = gtk_default_draw_layout;
klass->draw_resize_grip = gtk_default_draw_resize_grip;
+ klass->draw_spinner = gtk_default_draw_spinner;
g_type_class_add_private (object_class, sizeof (GtkStylePrivate));
if (style->styles)
{
if (style->styles->data != style)
- g_slist_remove (style->styles, style);
+ style->styles = g_slist_remove (style->styles, style);
else
{
GSList *tmp_list = style->styles->next;
if (style->private_font_desc)
pango_font_description_free (style->private_font_desc);
-
+
if (style->rc_style)
- gtk_rc_style_unref (style->rc_style);
-
+ g_object_unref (style->rc_style);
+
G_OBJECT_CLASS (gtk_style_parent_class)->finalize (object);
}
+/**
+ * gtk_style_copy:
+ * @style: a #GtkStyle
+ *
+ * Creates a copy of the passed in #GtkStyle object.
+ *
+ * Returns: a copy of @style
+ */
GtkStyle*
gtk_style_copy (GtkStyle *style)
{
* gtk_style_attach:
* @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 dereferenced, and the new style will have
- * a reference count belonging to the caller.
*
* Attaches a style to a window; this process allocates the
* colors and creates the GC's for the style - it specializes
* Since this function may return a new object, you have to use it
* in the following way:
* <literal>style = gtk_style_attach (style, window)</literal>
- **/
+ *
+ * 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.
+ */
GtkStyle*
gtk_style_attach (GtkStyle *style,
GdkWindow *window)
}
}
-/**
- * gtk_style_ref:
- * @style: a #GtkStyle.
- * @returns: @style.
- *
- * Deprecated equivalent of g_object_ref().
- **/
-GtkStyle*
-gtk_style_ref (GtkStyle *style)
-{
- return (GtkStyle *) g_object_ref (style);
-}
-
-/**
- * gtk_style_unref:
- * @style: a #GtkStyle.
- *
- * Deprecated equivalent of g_object_unref().
- **/
-void
-gtk_style_unref (GtkStyle *style)
-{
- g_object_unref (style);
-}
-
static void
gtk_style_realize (GtkStyle *style,
GdkColormap *colormap)
g_signal_emit (style, realize_signal, 0);
}
+/**
+ * gtk_style_lookup_icon_set:
+ * @style: a #GtkStyle
+ * @stock_id: an icon name
+ *
+ * Looks up @stock_id in the icon factories associated with @style
+ * and the default icon factory, returning an icon set if found,
+ * otherwise %NULL.
+ *
+ * Return value: icon set of @stock_id
+ */
GtkIconSet*
gtk_style_lookup_icon_set (GtkStyle *style,
const char *stock_id)
}
/**
- * gtk_draw_hline:
- * @style: a #GtkStyle
- * @window: a #GdkWindow
- * @state_type: a state
- * @x1: the starting x coordinate
- * @x2: the ending x coordinate
- * @y: the y coordinate
- *
- * Draws a horizontal line from (@x1, @y) to (@x2, @y) in @window
- * using the given style and state.
- *
- * Deprecated: Use gtk_paint_hline() instead.
- **/
-void
-gtk_draw_hline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x1,
- gint x2,
- gint y)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
-}
-
-
-/**
- * gtk_draw_vline:
- * @style: a #GtkStyle
- * @window: a #GdkWindow
- * @state_type: a state
- * @y1_: the starting y coordinate
- * @y2_: the ending y coordinate
- * @x: the x coordinate
- *
- * Draws a vertical line from (@x, @y1_) to (@x, @y2_) in @window
- * using the given style and state.
- *
- * Deprecated: Use gtk_paint_vline() instead.
- **/
-void
-gtk_draw_vline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint y1_,
- gint y2_,
- gint x)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, NULL, NULL, NULL, y1_, y2_, x);
-}
-
-/**
- * gtk_draw_shadow:
- * @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
- *
- * Draws a shadow around the given rectangle in @window
- * using the given style and state and shadow type.
- *
- * Deprecated: Use gtk_paint_shadow() instead.
- */
-void
-gtk_draw_shadow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
-}
-
-/**
- * gtk_draw_polygon:
- * @style: a #GtkStyle
- * @window: a #GdkWindow
- * @state_type: a state
- * @shadow_type: type of shadow to draw
- * @points: an array of #GdkPoint<!-- -->s
- * @npoints: length of @points
- * @fill: %TRUE if the polygon should be filled
- *
- * Draws a polygon on @window with the given parameters.
- *
- * Deprecated: Use gtk_paint_polygon() instead.
- */
-void
-gtk_draw_polygon (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkPoint *points,
- gint npoints,
- gboolean fill)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
-}
-
-/**
- * gtk_draw_arrow:
- * @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
- *
- * Draws an arrow in the given rectangle on @window using the given
- * parameters. @arrow_type determines the direction of the arrow.
- *
- * Deprecated: Use gtk_paint_arrow() instead.
- */
-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)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
-}
-
-/**
- * gtk_draw_diamond:
- * @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
- *
- * Draws a diamond in the given rectangle on @window using the given
- * parameters.
- *
- * Deprecated: Use gtk_paint_diamond() instead.
- */
-void
-gtk_draw_diamond (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
-}
-
-/**
- * gtk_draw_string:
- * @style: a #GtkStyle
- * @window: a #GdkWindow
- * @state_type: a state
- * @x: x origin
- * @y: y origin
- * @string: the string to draw
- *
- * Draws a text string on @window with the given parameters.
- *
- * Deprecated: Use gtk_paint_layout() instead.
- */
-void
-gtk_draw_string (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- const gchar *string)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string);
-}
-
-/**
- * gtk_draw_box:
- * @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
- *
- * Draws a box on @window with the given parameters.
- *
- * Deprecated: Use gtk_paint_box() instead.
- */
-void
-gtk_draw_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
-}
-
-/**
- * gtk_draw_flat_box:
- * @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
- *
- * Draws a flat box on @window with the given parameters.
- *
- * Deprecated: Use gtk_paint_flat_box() instead.
- */
-void
-gtk_draw_flat_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
-}
-
-/**
- * gtk_draw_check:
- * @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
- *
- * Draws a check button indicator in the given rectangle on @window with
- * the given parameters.
- *
- * Deprecated: Use gtk_paint_check() instead.
- */
-void
-gtk_draw_check (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
-}
-
-/**
- * gtk_draw_option:
- * @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
- *
- * Draws a radio button indicator in the given rectangle on @window with
- * the given parameters.
- *
- * Deprecated: Use gtk_paint_option() instead.
- */
-void
-gtk_draw_option (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
-}
-
-/**
- * gtk_draw_tab:
- * @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
- *
- * Draws an option menu tab (i.e. the up and down pointing arrows)
- * in the given rectangle on @window using the given parameters.
- *
- * Deprecated: Use gtk_paint_tab() instead.
- */
-void
-gtk_draw_tab (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
-}
-
-/**
- * gtk_draw_shadow_gap:
- * @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
- *
- * Draws a shadow around the given rectangle in @window
- * using the given style and state and shadow type, leaving a
- * gap in one side.
- *
- * Deprecated: Use gtk_paint_shadow_gap() instead.
-*/
-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)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
-}
-
-/**
- * gtk_draw_box_gap:
- * @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
- *
- * Draws a box in @window using the given style and state and shadow type,
- * leaving a gap in one side.
- *
- * Deprecated: Use gtk_paint_box_gap() instead.
- */
-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)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
-}
-
-/**
- * gtk_draw_extension:
+ * gtk_draw_slider:
* @style: a #GtkStyle
- * @window: a #GdkWindow
+ @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
- *
- * Draws an extension, i.e. a notebook tab.
- *
- * Deprecated: Use gtk_paint_extension() instead.
- **/
-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)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
-}
-
-/**
- * gtk_draw_focus:
- * @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
+ * @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
*
- * Draws a focus indicator around the given rectangle on @window using the
- * given style.
- *
- * Deprecated: Use gtk_paint_focus() instead.
+ * Draws a slider in the given rectangle on @window using the
+ * given style and orientation.
*/
-void
-gtk_draw_focus (GtkStyle *style,
- GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, GTK_STATE_NORMAL, NULL, NULL, NULL, x, y, width, height);
-}
-
void
gtk_draw_slider (GtkStyle *style,
GdkWindow *window,
}
/**
- * gtk_draw_handle:
- * @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
- *
- * Draws a handle as used in #GtkHandleBox and #GtkPaned.
- *
- * Deprecated: Use gtk_paint_handle() instead.
- **/
-void
-gtk_draw_handle (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
-}
-
-/**
- * gtk_draw_expander:
+ * gtk_draw_layout:
* @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
- *
- * Draws an expander as used in #GtkTreeView.
+ * @use_text: whether to use the text or foreground
+ * graphics context of @style
+ * @x: x origin
+ * @y: y origin
+ * @layout: the layout to draw
*
- * Deprecated: Use gtk_paint_expander() instead.
- **/
-void
-gtk_draw_expander (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- GtkExpanderStyle expander_style)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_expander != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_expander (style, window, state_type,
- NULL, NULL, NULL,
- x, y, expander_style);
-}
-
+ * Draws a layout on @window using the given parameters.
+ */
void
gtk_draw_layout (GtkStyle *style,
GdkWindow *window,
x, y, layout);
}
-/**
- * gtk_draw_resize_grip:
- * @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
- *
- * Draws a resize grip in the given rectangle on @window using the given
- * parameters.
- *
- * Deprecated: Use gtk_paint_resize_grip() instead.
- */
-void
-gtk_draw_resize_grip (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_resize_grip != NULL);
-
- GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, window, state_type,
- NULL, NULL, NULL,
- edge,
- x, y, width, height);
-}
-
-
/**
* gtk_style_set_background:
* @style: a #GtkStyle
gtk_style_real_copy (GtkStyle *style,
GtkStyle *src)
{
+ GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
+ GtkStylePrivate *src_priv = GTK_STYLE_GET_PRIVATE (src);
gint i;
for (i = 0; i < 5; i++)
if (src->rc_style)
g_object_ref (src->rc_style);
+ g_slist_foreach (style->icon_factories, (GFunc) g_object_unref, NULL);
+ g_slist_free (style->icon_factories);
+ style->icon_factories = g_slist_copy (src->icon_factories);
+ g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL);
+
+ g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_unref, NULL);
+ g_slist_free (priv->color_hashes);
+ priv->color_hashes = g_slist_copy (src_priv->color_hashes);
+ g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_ref, NULL);
+
/* don't copy, just clear cache */
clear_property_cache (style);
}
style->base[i] = rc_style->base[i];
}
- if (rc_style->xthickness >= 0)
- style->xthickness = rc_style->xthickness;
- if (rc_style->ythickness >= 0)
- style->ythickness = rc_style->ythickness;
+ if (rc_style->xthickness >= 0)
+ style->xthickness = rc_style->xthickness;
+ if (rc_style->ythickness >= 0)
+ style->ythickness = rc_style->ythickness;
+
+ style->icon_factories = g_slist_copy (rc_style->icon_factories);
+ g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL);
+
+ priv->color_hashes = g_slist_copy (_gtk_rc_style_get_color_hashes (rc_style));
+ g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_ref, NULL);
+}
+
+static gint
+style_property_values_cmp (gconstpointer bsearch_node1,
+ gconstpointer bsearch_node2)
+{
+ const PropertyValue *val1 = bsearch_node1;
+ const PropertyValue *val2 = bsearch_node2;
+
+ if (val1->widget_type == val2->widget_type)
+ return val1->pspec < val2->pspec ? -1 : val1->pspec == val2->pspec ? 0 : 1;
+ else
+ return val1->widget_type < val2->widget_type ? -1 : 1;
+}
+
+/**
+ * gtk_style_get_style_property:
+ * @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
+ *
+ * Queries the value of a style property corresponding to a
+ * widget class is in the given style.
+ *
+ * Since: 2.16
+ */
+void
+gtk_style_get_style_property (GtkStyle *style,
+ GType widget_type,
+ const gchar *property_name,
+ GValue *value)
+{
+ GtkWidgetClass *klass;
+ GParamSpec *pspec;
+ GtkRcPropertyParser parser;
+ const GValue *peek_value;
+
+ klass = g_type_class_ref (widget_type);
+ pspec = gtk_widget_class_find_style_property (klass, property_name);
+ g_type_class_unref (klass);
+
+ if (!pspec)
+ {
+ g_warning ("%s: widget class `%s' has no property named `%s'",
+ G_STRLOC,
+ g_type_name (widget_type),
+ property_name);
+ return;
+ }
+
+ parser = g_param_spec_get_qdata (pspec,
+ g_quark_from_static_string ("gtk-rc-property-parser"));
+
+ peek_value = _gtk_style_peek_property_value (style, widget_type, pspec, parser);
+
+ if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (pspec))
+ g_value_copy (peek_value, value);
+ else if (g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (pspec), G_VALUE_TYPE (value)))
+ g_value_transform (peek_value, value);
+ else
+ g_warning ("can't retrieve style property `%s' of type `%s' as value of type `%s'",
+ pspec->name,
+ g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
+ G_VALUE_TYPE_NAME (value));
+}
+
+/**
+ * gtk_style_get_valist:
+ * @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 <type>va_list</type> of pairs of property names and
+ * locations to return the property values, starting with the
+ * location for @first_property_name.
+ *
+ * Non-vararg variant of gtk_style_get().
+ * Used primarily by language bindings.
+ *
+ * Since: 2.16
+ */
+void
+gtk_style_get_valist (GtkStyle *style,
+ GType widget_type,
+ const gchar *first_property_name,
+ va_list var_args)
+{
+ const char *property_name;
+ GtkWidgetClass *klass;
+
+ g_return_if_fail (GTK_IS_STYLE (style));
- style->icon_factories = g_slist_copy (rc_style->icon_factories);
- g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL);
+ klass = g_type_class_ref (widget_type);
- priv->color_hashes = g_slist_copy (_gtk_rc_style_get_color_hashes (rc_style));
- g_slist_foreach (priv->color_hashes, (GFunc) g_hash_table_ref, NULL);
+ property_name = first_property_name;
+ while (property_name)
+ {
+ GParamSpec *pspec;
+ GtkRcPropertyParser parser;
+ const GValue *peek_value;
+ gchar *error;
+
+ pspec = gtk_widget_class_find_style_property (klass, property_name);
+
+ if (!pspec)
+ {
+ g_warning ("%s: widget class `%s' has no property named `%s'",
+ G_STRLOC,
+ g_type_name (widget_type),
+ property_name);
+ break;
+ }
+
+ parser = g_param_spec_get_qdata (pspec,
+ g_quark_from_static_string ("gtk-rc-property-parser"));
+
+ peek_value = _gtk_style_peek_property_value (style, widget_type, pspec, parser);
+ G_VALUE_LCOPY (peek_value, var_args, 0, &error);
+ if (error)
+ {
+ g_warning ("%s: %s", G_STRLOC, error);
+ g_free (error);
+ break;
+ }
+
+ property_name = va_arg (var_args, gchar*);
+ }
+
+ g_type_class_unref (klass);
}
-static gint
-style_property_values_cmp (gconstpointer bsearch_node1,
- gconstpointer bsearch_node2)
+/**
+ * gtk_style_get:
+ * @style: a #GtkStyle
+ * @widget_type: the #GType of a descendant of #GtkWidget
+ * @first_property_name: the name of the first style property to get
+ * @Varargs: pairs of property names and locations to
+ * return the property values, starting with the location for
+ * @first_property_name, terminated by %NULL.
+ *
+ * Gets the values of a multiple style properties for @widget_type
+ * from @style.
+ *
+ * Since: 2.16
+ */
+void
+gtk_style_get (GtkStyle *style,
+ GType widget_type,
+ const gchar *first_property_name,
+ ...)
{
- const PropertyValue *val1 = bsearch_node1;
- const PropertyValue *val2 = bsearch_node2;
+ va_list var_args;
- if (val1->widget_type == val2->widget_type)
- return val1->pspec < val2->pspec ? -1 : val1->pspec == val2->pspec ? 0 : 1;
- else
- return val1->widget_type < val2->widget_type ? -1 : 1;
+ va_start (var_args, first_property_name);
+ gtk_style_get_valist (style, widget_type, first_property_name, var_args);
+ va_end (var_args);
}
const GValue*
* @source: the #GtkIconSource specifying the icon to render
* @direction: a text direction
* @state: a state
- * @size: 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
- * @detail: a style detail
+ * @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: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @returns: a newly-created #GdkPixbuf containing the rendered icon
*
- * Renders the icon specified by @source at the given @size
- * according to the given parameters and returns the result in a
+ * Renders the icon specified by @source at the given @size
+ * according to the given parameters and returns the result in a
* pixbuf.
*/
GdkPixbuf *
}
/* Default functions */
+
+/**
+ * gtk_style_apply_default_background:
+ * @style:
+ * @window:
+ * @set_bg:
+ * @state_type:
+ * @area: (allow-none):
+ * @x:
+ * @y:
+ * @width:
+ * @height:
+ */
void
-gtk_style_apply_default_background (GtkStyle *style,
- GdkWindow *window,
- gboolean set_bg,
- GtkStateType state_type,
- GdkRectangle *area,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
GdkRectangle new_rect, old_rect;
}
}
-static GdkPixbuf*
+static GdkPixbuf *
scale_or_ref (GdkPixbuf *src,
- gint width,
- gint height)
+ gint width,
+ gint height)
{
if (width == gdk_pixbuf_get_width (src) &&
height == gdk_pixbuf_get_height (src))
}
}
+static gboolean
+lookup_icon_size (GtkStyle *style,
+ GtkWidget *widget,
+ GtkIconSize size,
+ gint *width,
+ gint *height)
+{
+ GdkScreen *screen;
+ GtkSettings *settings;
+
+ if (widget && gtk_widget_has_screen (widget))
+ {
+ screen = gtk_widget_get_screen (widget);
+ settings = gtk_settings_get_for_screen (screen);
+ }
+ else if (style && style->colormap)
+ {
+ screen = gdk_colormap_get_screen (style->colormap);
+ settings = gtk_settings_get_for_screen (screen);
+ }
+ else
+ {
+ settings = gtk_settings_get_default ();
+ GTK_NOTE (MULTIHEAD,
+ g_warning ("Using the default screen for gtk_default_render_icon()"));
+ }
+
+ return gtk_icon_size_lookup_for_settings (settings, size, width, height);
+}
+
static GdkPixbuf *
gtk_default_render_icon (GtkStyle *style,
const GtkIconSource *source,
GdkPixbuf *scaled;
GdkPixbuf *stated;
GdkPixbuf *base_pixbuf;
- GdkScreen *screen;
- GtkSettings *settings;
/* Oddly, style can be NULL in this function, because
* GtkIconSet can be used without a style and if so
g_return_val_if_fail (base_pixbuf != NULL, NULL);
- if (widget && gtk_widget_has_screen (widget))
- {
- screen = gtk_widget_get_screen (widget);
- settings = gtk_settings_get_for_screen (screen);
- }
- else if (style && style->colormap)
- {
- screen = gdk_colormap_get_screen (style->colormap);
- settings = gtk_settings_get_for_screen (screen);
- }
- else
- {
- settings = gtk_settings_get_default ();
- GTK_NOTE (MULTIHEAD,
- g_warning ("Using the default screen for gtk_default_render_icon()"));
- }
-
-
- if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
+ if (size != (GtkIconSize) -1 && !lookup_icon_size(style, widget, size, &width, &height))
{
g_warning (G_STRLOC ": invalid icon size '%d'", size);
return NULL;
if (shadow_type == GTK_SHADOW_IN)
{
- if (detail && (strcmp (detail, "buttondefault") == 0))
+ if (detail && strcmp (detail, "buttondefault") == 0)
{
sanitize_size (window, &width, &height);
x, y, width, height);
return;
}
- if (widget && GTK_IS_SPIN_BUTTON (widget) &&
+ if (GTK_IS_SPIN_BUTTON (widget) &&
detail && strcmp (detail, "spinbutton") == 0)
{
draw_spinbutton_shadow (style, window, state_type,
}
if (shadow_type == GTK_SHADOW_IN &&
- widget && GTK_IS_SPIN_BUTTON (widget) &&
+ GTK_IS_SPIN_BUTTON (widget) &&
detail && strcmp (detail, "entry") == 0)
{
if (get_direction (widget) == GTK_TEXT_DIR_LTR)
{
GtkRequisition *tmp_size = NULL;
GtkBorder *tmp_spacing = NULL;
-
- if (widget)
- gtk_widget_style_get (widget,
- "indicator-size", &tmp_size,
- "indicator-spacing", &tmp_spacing,
- NULL);
if (tmp_size)
{
*indicator_size = *tmp_size;
- g_free (tmp_size);
+ gtk_requisition_free (tmp_size);
}
else
*indicator_size = default_option_indicator_size;
if (tmp_spacing)
{
*indicator_spacing = *tmp_spacing;
- g_free (tmp_spacing);
+ gtk_border_free (tmp_spacing);
}
else
*indicator_spacing = default_option_indicator_spacing;
sanitize_size (window, &width, &height);
- if (widget && GTK_IS_SPIN_BUTTON (widget) && detail)
+ if (GTK_IS_SPIN_BUTTON (widget) && detail)
{
if (strcmp (detail, "spinbutton_up") == 0)
{
if (state_type == GTK_STATE_SELECTED && detail && strcmp (detail, "paned") == 0)
{
- if (widget && !GTK_WIDGET_HAS_FOCUS (widget))
+ if (widget && !gtk_widget_has_focus (widget))
gc = style->base_gc[GTK_STATE_ACTIVE];
}
}
else
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
state_type, area, x, y, width, height);
if (is_spinbutton_box)
}
}
-static GdkGC*
-get_darkened_gc (GdkWindow *window,
- GdkColor *color,
- gint darken_count)
+static GdkGC *
+get_darkened_gc (GdkWindow *window,
+ const GdkColor *color,
+ gint darken_count)
{
GdkColor src = *color;
GdkColor shaded = *color;
!strcmp ("cell_even_ruled_sorted", detail))
{
/* This has to be really broken; alex made me do it. -jrb */
- if (GTK_WIDGET_HAS_FOCUS (widget))
+ if (widget && gtk_widget_has_focus (widget))
gc1 = style->base_gc[state_type];
else
gc1 = style->base_gc[GTK_STATE_ACTIVE];
else if (!strcmp ("cell_odd_ruled", detail) ||
!strcmp ("cell_odd_ruled_sorted", detail))
{
- if (GTK_WIDGET_HAS_FOCUS (widget))
+ if (widget && gtk_widget_has_focus (widget))
freeme = get_darkened_gc (window, &style->base[state_type], 1);
else
freeme = get_darkened_gc (window, &style->base[GTK_STATE_ACTIVE], 1);
}
else if (!strcmp ("cell_odd_ruled", detail))
{
- GdkColor *color;
+ GdkColor *color = NULL;
gtk_widget_style_get (widget,
"odd-row-color", &color,
}
else
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
state_type, area, x, y, width, height);
exterior_size = MIN (width, height);
if (exterior_size % 2 == 0) /* Ensure odd */
- exterior_size -= -1;
+ exterior_size -= 1;
pad = style->xthickness + MAX (1, (exterior_size - 2 * style->xthickness) / 9);
interior_size = MAX (1, exterior_size - 2 * pad);
exterior_size = MIN (width, height);
if (exterior_size % 2 == 0) /* Ensure odd */
- exterior_size -= -1;
+ exterior_size -= 1;
x -= (1 + exterior_size - width) / 2;
y -= (1 + exterior_size - height) / 2;
GdkGC *gc4 = NULL;
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
state_type, area, x, y, width, height);
sanitize_size (window, &width, &height);
gdk_draw_line (window, gc2,
x, y + gap_x, x, y + gap_x);
}
- if ((width - (gap_x + gap_width)) > 0)
+ if ((height - (gap_x + gap_width)) > 0)
{
gdk_draw_line (window, gc1,
x, y + gap_x + gap_width, x, y + height - 2);
gdk_draw_line (window, gc3,
x + width - 1, y + gap_x, x + width - 1, y + gap_x);
}
- if ((width - (gap_x + gap_width)) > 0)
+ if ((height - (gap_x + gap_width)) > 0)
{
gdk_draw_line (window, gc4,
x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
GdkGC *gc4 = NULL;
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
GTK_STATE_NORMAL, area, x, y, width, height);
sanitize_size (window, &width, &height);
{
case GTK_POS_TOP:
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
state_type, area,
x + style->xthickness,
y,
break;
case GTK_POS_BOTTOM:
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
state_type, area,
x + style->xthickness,
y + style->ythickness,
break;
case GTK_POS_LEFT:
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
state_type, area,
x,
y + style->ythickness,
break;
case GTK_POS_RIGHT:
gtk_style_apply_default_background (style, window,
- widget && !GTK_WIDGET_NO_WINDOW (widget),
+ widget && gtk_widget_get_has_window (widget),
state_type, area,
x + style->xthickness,
y + style->ythickness,
cairo_t *cr;
gboolean free_dash_list = FALSE;
gint line_width = 1;
- gint8 *dash_list = "\1\1";
+ gint8 *dash_list = (gint8 *) "\1\1";
if (widget)
{
{
if (free_dash_list)
g_free (dash_list);
-
- dash_list = "\4\4";
+
+ dash_list = (gint8 *) "\4\4";
free_dash_list = FALSE;
}
sanitize_size (window, &width, &height);
cr = gdk_cairo_create (window);
-
+
if (detail && !strcmp (detail, "colorwheel_light"))
cairo_set_source_rgb (cr, 0., 0., 0.);
else if (detail && !strcmp (detail, "colorwheel_dark"))
if (dash_list[0])
{
- gint n_dashes = strlen (dash_list);
+ gint n_dashes = strlen ((const gchar *) dash_list);
gdouble *dashes = g_new (gdouble, n_dashes);
gdouble total_length = 0;
gdouble dash_offset;
xthick = 0;
ythick = 0;
- if (state_type == GTK_STATE_SELECTED && widget && !GTK_WIDGET_HAS_FOCUS (widget))
+ if (state_type == GTK_STATE_SELECTED && widget && !gtk_widget_has_focus (widget))
{
GdkColor unfocused_light;
gboolean need_stipple = FALSE;
ByteRange *br;
- run = pango_layout_iter_get_run (iter);
+ run = pango_layout_iter_get_run_readonly (iter);
if (run)
{
}
}
+static void
+gtk_default_draw_spinner (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ guint step,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ GdkColor *color;
+ cairo_t *cr;
+ guint num_steps;
+ gdouble dx, dy;
+ gdouble radius;
+ gdouble half;
+ gint i;
+ guint real_step;
+
+ gtk_style_get (style, GTK_TYPE_SPINNER,
+ "num-steps", &num_steps,
+ NULL);
+ real_step = step % num_steps;
+
+ /* get cairo context */
+ cr = gdk_cairo_create (window);
+
+ /* set a clip region for the expose event */
+ cairo_rectangle (cr, x, y, width, height);
+ cairo_clip (cr);
+
+ cairo_translate (cr, x, y);
+
+ /* draw clip region */
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
+ color = &style->fg[state_type];
+ dx = width / 2;
+ dy = height / 2;
+ radius = MIN (width / 2, height / 2);
+ half = num_steps / 2;
+
+ for (i = 0; i < num_steps; i++)
+ {
+ gint inset = 0.7 * radius;
+
+ /* transparency is a function of time and intial value */
+ gdouble t = (gdouble) ((i + num_steps - real_step)
+ % num_steps) / num_steps;
+
+ cairo_save (cr);
+
+ cairo_set_source_rgba (cr,
+ color->red / 65535.,
+ color->green / 65535.,
+ color->blue / 65535.,
+ t);
+
+ cairo_set_line_width (cr, 2.0);
+ cairo_move_to (cr,
+ dx + (radius - inset) * cos (i * G_PI / half),
+ dy + (radius - inset) * sin (i * G_PI / half));
+ cairo_line_to (cr,
+ dx + radius * cos (i * G_PI / half),
+ dy + radius * sin (i * G_PI / half));
+ cairo_stroke (cr);
+
+ cairo_restore (cr);
+ }
+
+ /* free memory */
+ cairo_destroy (cr);
+}
+
void
-_gtk_style_shade (GdkColor *a,
- GdkColor *b,
- gdouble k)
+_gtk_style_shade (const GdkColor *a,
+ GdkColor *b,
+ gdouble k)
{
gdouble red;
gdouble green;
* @style: a #GtkStyle
* @window: a #GdkWindow
* @state_type: a state
- * @area: rectangle to which the output is clipped, or %NULL if the
+ * @area: (allow-none): rectangle to which the output is clipped, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x1: the starting x coordinate
* @x2: the ending x coordinate
* @y: the y coordinate
- *
+ *
* Draws a horizontal line from (@x1, @y) to (@x2, @y) in @window
* using the given style and state.
**/
void
-gtk_paint_hline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x1,
- gint x2,
- gint y)
+gtk_paint_hline (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint x1,
+ gint x2,
+ gint y)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y);
+
+ GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type,
+ (GdkRectangle *) area, widget, detail,
+ x1, x2, y);
}
/**
* @style: a #GtkStyle
* @window: a #GdkWindow
* @state_type: a state
- * @area: rectangle to which the output is clipped, or %NULL if the
+ * @area: (allow-none): rectangle to which the output is clipped, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @y1_: the starting y coordinate
* @y2_: the ending y coordinate
* @x: the x coordinate
- *
+ *
* Draws a vertical line from (@x, @y1_) to (@x, @y2_) in @window
* using the given style and state.
*/
void
-gtk_paint_vline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint y1_,
- gint y2_,
- gint x)
+gtk_paint_vline (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ const GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ gint y1_,
+ gint y2_,
+ gint x)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1_, y2_, x);
+
+ GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type,
+ (GdkRectangle *) area, widget, detail,
+ y1_, y2_, x);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: type of shadow to draw
- * @area: clip rectangle or %NULL if the
+ * @area: (allow-none): clip rectangle or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin of the rectangle
* @y: y origin of the rectangle
- * @width: width of the rectangle
- * @height: width of the rectangle
+ * @width: width of the rectangle
+ * @height: width of the rectangle
*
* Draws a shadow around the given rectangle in @window
* using the given style and state and shadow type.
*/
void
-gtk_paint_shadow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @points: an array of #GdkPoint<!-- -->s
- * @npoints: length of @points
+ * @n_points: length of @points
* @fill: %TRUE if the polygon should be filled
- *
+ *
* Draws a polygon on @window with the given parameters.
*/
void
-gtk_paint_polygon (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- GdkPoint *points,
- gint npoints,
- gboolean fill)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
+
+ GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ (GdkPoint *) points, n_points, fill);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: the type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* parameters. @arrow_type determines the direction of the arrow.
*/
void
-gtk_paint_arrow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ arrow_type, fill, x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: the type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* parameters.
*/
void
-gtk_paint_diamond (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
-}
-/**
- * gtk_paint_string:
- * @style: a #GtkStyle
- * @window: a #GdkWindow
- * @state_type: a state
- * @area: clip rectangle, or %NULL if the
- * output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
- * @x: x origin
- * @y: y origin
- * @string: the string to draw
- *
- * Draws a text string on @window with the given parameters.
- *
- * Deprecated: Use gtk_paint_layout() instead.
- */
-void
-gtk_paint_string (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- const gchar *string)
-{
- g_return_if_fail (GTK_IS_STYLE (style));
- g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
- g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string);
+ GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: the type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin of the box
* @y: y origin of the box
* @width: the width of the box
* Draws a box on @window with the given parameters.
*/
void
-gtk_paint_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: the type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin of the box
* @y: y origin of the box
* @width: the width of the box
* Draws a flat box on @window with the given parameters.
*/
void
-gtk_paint_flat_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: the type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* the given parameters.
*/
void
-gtk_paint_check (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: the type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* the given parameters.
*/
void
-gtk_paint_option (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: the type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* in the given rectangle on @window using the given parameters.
*/
void
-gtk_paint_tab (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin of the rectangle
* @y: y origin of the rectangle
- * @width: width of the rectangle
- * @height: width 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
* gap in one side.
*/
void
-gtk_paint_shadow_gap (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
+
+ GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height, gap_side, gap_x, gap_width);
}
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin of the rectangle
* @y: y origin of the rectangle
- * @width: width of the rectangle
- * @height: width 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
* leaving a gap in one side.
*/
void
-gtk_paint_box_gap (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
+
+ GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height, gap_side, gap_x, gap_width);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin of the extension
* @y: y origin of the extension
- * @width: width of the extension
- * @height: width of the extension
+ * @width: width of the extension
+ * @height: width of the extension
* @gap_side: the side on to which the extension is attached
*
* Draws an extension, i.e. a notebook tab.
**/
void
-gtk_paint_extension (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkPositionType gap_side)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
+
+ GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height, gap_side);
}
/**
* @style: a #GtkStyle
* @window: a #GdkWindow
* @state_type: a state
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* given style.
*/
void
-gtk_paint_focus (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, state_type, area, widget, detail, x, y, width, height);
+
+ GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, state_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: a shadow
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* given style and orientation.
**/
void
-gtk_paint_slider (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
+
+ GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height, orientation);
}
/**
* @window: a #GdkWindow
* @state_type: a state
* @shadow_type: type of shadow to draw
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin of the handle
* @y: y origin of the handle
* @width: with of the handle
* Draws a handle as used in #GtkHandleBox and #GtkPaned.
**/
void
-gtk_paint_handle (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- gint width,
- gint height,
- GtkOrientation orientation)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
+
+ GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height, orientation);
}
/**
* @style: a #GtkStyle
* @window: a #GdkWindow
* @state_type: a state
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* expanded position.
**/
void
-gtk_paint_expander (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- GtkExpanderStyle expander_style)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_expander != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_expander (style, window, state_type, area,
- widget, detail, x, y, expander_style);
+
+ GTK_STYLE_GET_CLASS (style)->draw_expander (style, window, state_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, expander_style);
}
/**
* @state_type: a state
* @use_text: whether to use the text or foreground
* graphics context of @style
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @x: x origin
* @y: y origin
* @layout: the layout to draw
- *
+ *
* Draws a layout on @window using the given parameters.
**/
void
-gtk_paint_layout (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gboolean use_text,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- gint x,
- gint y,
- PangoLayout *layout)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_layout != NULL);
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
-
- GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type, use_text, area,
- widget, detail, x, y, layout);
+
+ GTK_STYLE_GET_CLASS (style)->draw_layout (style, window, state_type, use_text,
+ (GdkRectangle *) area, widget, detail,
+ x, y, layout);
}
/**
* @style: a #GtkStyle
* @window: a #GdkWindow
* @state_type: a state
- * @area: clip rectangle, or %NULL if the
+ * @area: (allow-none): clip rectangle, or %NULL if the
* output should not be clipped
- * @widget: the widget (may be %NULL)
- * @detail: a style detail (may be %NULL)
+ * @widget: (allow-none): the widget
+ * @detail: (allow-none): a style detail
* @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
* parameters.
*/
void
-gtk_paint_resize_grip (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height)
+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)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
GTK_STYLE_GET_CLASS (style)->draw_resize_grip (style, window, state_type,
- area, widget, detail,
+ (GdkRectangle *) area, widget, detail,
edge, x, y, width, height);
}
+/**
+ * gtk_paint_spinner:
+ * @style: a #GtkStyle
+ * @window: a #GdkWindow
+ * @state_type: a state
+ * @area: (allow-none): clip rectangle, or %NULL if the
+ * output should not be clipped
+ * @widget: (allow-none): the widget (may be %NULL)
+ * @detail: (allow-none): a style detail (may be %NULL)
+ * @step: the nth step, a value between 0 and #GtkSpinner: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
+ *
+ * Draws a spinner on @window using the given parameters.
+ *
+ * Since: 2.20
+ */
+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)
+{
+ g_return_if_fail (GTK_IS_STYLE (style));
+ g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_spinner != NULL);
+ g_return_if_fail (style->depth == gdk_drawable_get_depth (window));
+
+ GTK_STYLE_GET_CLASS (style)->draw_spinner (style, window, state_type,
+ (GdkRectangle *)area, widget, detail,
+ step, x, y, width, height);
+}
+
+/**
+ * gtk_border_new:
+ *
+ * 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
+ **/
+GtkBorder *
+gtk_border_new (void)
+{
+ return g_slice_new0 (GtkBorder);
+}
+
/**
* gtk_border_copy:
* @border_: a #GtkBorder.
GtkBorder *
gtk_border_copy (const GtkBorder *border)
{
- return (GtkBorder *)g_memdup (border, sizeof (GtkBorder));
+ g_return_val_if_fail (border != NULL, NULL);
+
+ return g_slice_dup (GtkBorder, border);
}
/**
void
gtk_border_free (GtkBorder *border)
{
- g_free (border);
+ g_slice_free (GtkBorder, border);
}
GType
return style->private_font;
}
-/**
- * gtk_style_get_font:
- * @style: a #GtkStyle
- *
- * 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.
- *
- * Return value: 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().
- **/
-GdkFont *
-gtk_style_get_font (GtkStyle *style)
-{
- g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
-
- return gtk_style_get_font_internal (style);
-}
-
-/**
- * gtk_style_set_font:
- * @style: a #GtkStyle.
- * @font: a #GdkFont, or %NULL to use the #GdkFont corresponding
- * to style->font_desc.
- *
- * 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.
- **/
-void
-gtk_style_set_font (GtkStyle *style,
- GdkFont *font)
-{
- GdkFont *old_font;
-
- g_return_if_fail (GTK_IS_STYLE (style));
-
- old_font = style->private_font;
-
- style->private_font = font;
- if (font)
- gdk_font_ref (font);
-
- if (old_font)
- gdk_font_unref (old_font);
-
- if (style->private_font_desc)
- {
- pango_font_description_free (style->private_font_desc);
- style->private_font_desc = NULL;
- }
-}
-
typedef struct _CursorInfo CursorInfo;
struct _CursorInfo
}
static GdkGC *
-make_cursor_gc (GtkWidget *widget,
- const gchar *property_name,
+make_cursor_gc (GtkWidget *widget,
+ const gchar *property_name,
const GdkColor *fallback)
{
GdkGCValues gc_values;
}
}
+ /* Cursors in text widgets are drawn only in NORMAL state,
+ * so we can use text[GTK_STATE_NORMAL] as text color here */
if (is_primary)
{
if (!cursor_info->primary_gc)
cursor_info->primary_gc = make_cursor_gc (widget,
"cursor-color",
- &widget->style->black);
-
+ &widget->style->text[GTK_STATE_NORMAL]);
+
return cursor_info->primary_gc;
}
else
{
- static const GdkColor gray = { 0, 0x8888, 0x8888, 0x8888 };
-
if (!cursor_info->secondary_gc)
cursor_info->secondary_gc = make_cursor_gc (widget,
"secondary-cursor-color",
- &gray);
-
+ /* text_aa is the average of text and base colors,
+ * in usual black-on-white case it's grey. */
+ &widget->style->text_aa[GTK_STATE_NORMAL]);
+
return cursor_info->secondary_gc;
}
}
+GdkGC *
+_gtk_widget_get_cursor_gc (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
+ return get_insertion_cursor_gc (widget, TRUE);
+}
+
+void
+_gtk_widget_get_cursor_color (GtkWidget *widget,
+ GdkColor *color)
+{
+ GdkColor *style_color;
+
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (color != NULL);
+
+ gtk_widget_style_get (widget, "cursor-color", &style_color, NULL);
+
+ if (style_color)
+ {
+ *color = *style_color;
+ gdk_color_free (style_color);
+ }
+ else
+ *color = widget->style->text[GTK_STATE_NORMAL];
+}
+
static void
-draw_insertion_cursor (GtkWidget *widget,
- GdkDrawable *drawable,
- GdkGC *gc,
- GdkRectangle *location,
- GtkTextDirection direction,
- gboolean draw_arrow)
+draw_insertion_cursor (GtkWidget *widget,
+ GdkDrawable *drawable,
+ GdkGC *gc,
+ const GdkRectangle *location,
+ GtkTextDirection direction,
+ gboolean draw_arrow)
{
gint stem_width;
gint arrow_width;
/**
* gtk_draw_insertion_cursor:
* @widget: a #GtkWidget
- * @drawable: a #GdkDrawable
- * @area: rectangle to which the output is clipped, or %NULL if the
+ * @drawable: a #GdkDrawable
+ * @area: (allow-none): rectangle to which the output is clipped, or %NULL if the
* output should not be clipped
* @location: location where to draw the cursor (@location->width is ignored)
* @is_primary: if the cursor should be the primary cursor color.
* Since: 2.4
**/
void
-gtk_draw_insertion_cursor (GtkWidget *widget,
- GdkDrawable *drawable,
- GdkRectangle *area,
- GdkRectangle *location,
- gboolean is_primary,
- GtkTextDirection direction,
- gboolean draw_arrow)
+gtk_draw_insertion_cursor (GtkWidget *widget,
+ GdkDrawable *drawable,
+ const GdkRectangle *area,
+ const GdkRectangle *location,
+ gboolean is_primary,
+ GtkTextDirection direction,
+ gboolean draw_arrow)
{
GdkGC *gc;