* 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 "gtkoptionmenu.h"
#include "gtkrc.h"
#include "gtkspinbutton.h"
#include "gtkstyle.h"
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)
* @style: a #GtkStyle.
* @returns: @style.
*
- * Deprecated equivalent of g_object_ref().
- **/
+ * Increase the reference count of @style.
+ *
+ * Deprecated: 2.0: use g_object_ref() instead.
+ */
GtkStyle*
gtk_style_ref (GtkStyle *style)
{
* gtk_style_unref:
* @style: a #GtkStyle.
*
- * Deprecated equivalent of g_object_unref().
- **/
+ * Decrease the reference count of @style.
+ *
+ * Deprecated: 2.0: use g_object_unref() instead.
+ */
void
gtk_style_unref (GtkStyle *style)
{
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)
* Draws a horizontal line from (@x1, @y) to (@x2, @y) in @window
* using the given style and state.
*
- * Deprecated: Use gtk_paint_hline() instead.
+ * Deprecated: 2.0: Use gtk_paint_hline() instead.
**/
void
gtk_draw_hline (GtkStyle *style,
* Draws a vertical line from (@x, @y1_) to (@x, @y2_) in @window
* using the given style and state.
*
- * Deprecated: Use gtk_paint_vline() instead.
+ * Deprecated: 2.0: Use gtk_paint_vline() instead.
**/
void
gtk_draw_vline (GtkStyle *style,
* Draws a shadow around the given rectangle in @window
* using the given style and state and shadow type.
*
- * Deprecated: Use gtk_paint_shadow() instead.
+ * Deprecated: 2.0: Use gtk_paint_shadow() instead.
*/
void
gtk_draw_shadow (GtkStyle *style,
*
* Draws a polygon on @window with the given parameters.
*
- * Deprecated: Use gtk_paint_polygon() instead.
+ * Deprecated: 2.0: Use gtk_paint_polygon() instead.
*/
void
gtk_draw_polygon (GtkStyle *style,
* 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.
+ * Deprecated: 2.0: Use gtk_paint_arrow() instead.
*/
void
gtk_draw_arrow (GtkStyle *style,
* Draws a diamond in the given rectangle on @window using the given
* parameters.
*
- * Deprecated: Use gtk_paint_diamond() instead.
+ * Deprecated: 2.0: Use gtk_paint_diamond() instead.
*/
void
gtk_draw_diamond (GtkStyle *style,
*
* Draws a text string on @window with the given parameters.
*
- * Deprecated: Use gtk_paint_layout() instead.
+ * Deprecated: 2.0: Use gtk_paint_layout() instead.
*/
void
gtk_draw_string (GtkStyle *style,
*
* Draws a box on @window with the given parameters.
*
- * Deprecated: Use gtk_paint_box() instead.
+ * Deprecated: 2.0: Use gtk_paint_box() instead.
*/
void
gtk_draw_box (GtkStyle *style,
*
* Draws a flat box on @window with the given parameters.
*
- * Deprecated: Use gtk_paint_flat_box() instead.
+ * Deprecated: 2.0: Use gtk_paint_flat_box() instead.
*/
void
gtk_draw_flat_box (GtkStyle *style,
* Draws a check button indicator in the given rectangle on @window with
* the given parameters.
*
- * Deprecated: Use gtk_paint_check() instead.
+ * Deprecated: 2.0: Use gtk_paint_check() instead.
*/
void
gtk_draw_check (GtkStyle *style,
* Draws a radio button indicator in the given rectangle on @window with
* the given parameters.
*
- * Deprecated: Use gtk_paint_option() instead.
+ * Deprecated: 2.0: Use gtk_paint_option() instead.
*/
void
gtk_draw_option (GtkStyle *style,
* 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.
+ * Deprecated: 2.0: Use gtk_paint_tab() instead.
*/
void
gtk_draw_tab (GtkStyle *style,
* using the given style and state and shadow type, leaving a
* gap in one side.
*
- * Deprecated: Use gtk_paint_shadow_gap() instead.
+ * Deprecated: 2.0: Use gtk_paint_shadow_gap() instead.
*/
void
gtk_draw_shadow_gap (GtkStyle *style,
* 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.
+ * Deprecated: 2.0: Use gtk_paint_box_gap() instead.
*/
void
gtk_draw_box_gap (GtkStyle *style,
*
* Draws an extension, i.e. a notebook tab.
*
- * Deprecated: Use gtk_paint_extension() instead.
+ * Deprecated: 2.0: Use gtk_paint_extension() instead.
**/
void
gtk_draw_extension (GtkStyle *style,
* Draws a focus indicator around the given rectangle on @window using the
* given style.
*
- * Deprecated: Use gtk_paint_focus() instead.
+ * Deprecated: 2.0: Use gtk_paint_focus() instead.
*/
void
gtk_draw_focus (GtkStyle *style,
GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, GTK_STATE_NORMAL, NULL, NULL, NULL, x, y, width, height);
}
+/**
+ * gtk_draw_slider:
+ * @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
+ *
+ * Draws a slider in the given rectangle on @window using the
+ * given style and orientation.
+ */
void
gtk_draw_slider (GtkStyle *style,
GdkWindow *window,
*
* Draws a handle as used in #GtkHandleBox and #GtkPaned.
*
- * Deprecated: Use gtk_paint_handle() instead.
+ * Deprecated: 2.0: Use gtk_paint_handle() instead.
**/
void
gtk_draw_handle (GtkStyle *style,
*
* Draws an expander as used in #GtkTreeView.
*
- * Deprecated: Use gtk_paint_expander() instead.
+ * Deprecated: 2.0: Use gtk_paint_expander() instead.
**/
void
gtk_draw_expander (GtkStyle *style,
x, y, expander_style);
}
+/**
+ * gtk_draw_layout:
+ * @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
+ *
+ * Draws a layout on @window using the given parameters.
+ */
void
gtk_draw_layout (GtkStyle *style,
GdkWindow *window,
* Draws a resize grip in the given rectangle on @window using the given
* parameters.
*
- * Deprecated: Use gtk_paint_resize_grip() instead.
+ * Deprecated: 2.0: Use gtk_paint_resize_grip() instead.
*/
void
gtk_draw_resize_grip (GtkStyle *style,
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);
}
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_peek (widget_type);
+ 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);
+ 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));
+
+ klass = g_type_class_ref (widget_type);
+
+ 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);
+}
+
+/**
+ * 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,
+ ...)
+{
+ va_list var_args;
+
+ 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*
_gtk_style_peek_property_value (GtkStyle *style,
GType widget_type,
/* Default functions */
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))
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)
+ if (GTK_IS_OPTION_MENU (widget))
gtk_widget_style_get (widget,
"indicator-size", &tmp_size,
"indicator-spacing", &tmp_spacing,
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)
{
}
}
-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,
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;
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;
gboolean need_stipple = FALSE;
ByteRange *br;
- run = pango_layout_iter_get_run (iter);
+ run = pango_layout_iter_get_run_readonly (iter);
if (run)
{
}
void
-_gtk_style_shade (GdkColor *a,
- GdkColor *b,
- gdouble k)
+_gtk_style_shade (const GdkColor *a,
+ GdkColor *b,
+ gdouble k)
{
gdouble red;
gdouble green;
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* @widget: the widget (may be %NULL)
* @detail: a style detail (may be %NULL)
* @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);
}
/**
* 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);
}
/**
* 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_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, width, height);
}
/**
*
* Draws a text string on @window with the given parameters.
*
- * Deprecated: Use gtk_paint_layout() instead.
+ * Deprecated: 2.0: 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)
+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)
{
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_string (style, window, state_type,
+ (GdkRectangle *) area, widget, detail,
+ x, y, string);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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_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
}
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_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;
* 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;