static gboolean
draw_gap_image(GtkStyle *style,
- GdkWindow *window,
- GdkRectangle *area,
+ cairo_t *cr,
GtkWidget *widget,
ThemeMatchData *match_data,
gboolean draw_center,
{
ThemeImage *image;
- if ((width == -1) && (height == -1))
- gdk_drawable_get_size(window, &width, &height);
- else if (width == -1)
- gdk_drawable_get_size(window, &width, NULL);
- else if (height == -1)
- gdk_drawable_get_size(window, NULL, &height);
-
if (!(match_data->flags & THEME_MATCH_ORIENTATION))
{
match_data->flags |= THEME_MATCH_ORIENTATION;
}
if (image->background)
- theme_pixbuf_render_no_cairo (image->background,
- window, area, components, FALSE,
+ theme_pixbuf_render (image->background,
+ cr, components, FALSE,
x, y, width, height);
if (image->gap_start)
- theme_pixbuf_render_no_cairo (image->gap_start,
- window, area, COMPONENT_ALL, FALSE,
+ theme_pixbuf_render (image->gap_start,
+ cr, COMPONENT_ALL, FALSE,
r1.x, r1.y, r1.width, r1.height);
if (image->gap)
- theme_pixbuf_render_no_cairo (image->gap,
- window, area, COMPONENT_ALL, FALSE,
+ theme_pixbuf_render (image->gap,
+ cr, COMPONENT_ALL, FALSE,
r2.x, r2.y, r2.width, r2.height);
if (image->gap_end)
- theme_pixbuf_render_no_cairo (image->gap_end,
- window, area, COMPONENT_ALL, FALSE,
+ theme_pixbuf_render (image->gap_end,
+ cr, COMPONENT_ALL, FALSE,
r3.x, r3.y, r3.width, r3.height);
return TRUE;
return FALSE;
}
+static gboolean
+draw_gap_image_no_cairo(GtkStyle *style,
+ GdkWindow *window,
+ GdkRectangle *area,
+ GtkWidget *widget,
+ ThemeMatchData *match_data,
+ gboolean draw_center,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ GtkPositionType gap_side,
+ gint gap_x,
+ gint gap_width)
+{
+ gboolean result;
+ cairo_t *cr;
+
+ if ((width == -1) && (height == -1))
+ gdk_drawable_get_size(window, &width, &height);
+ else if (width == -1)
+ gdk_drawable_get_size(window, &width, NULL);
+ else if (height == -1)
+ gdk_drawable_get_size(window, NULL, &height);
+
+ cr = gdk_cairo_create (window);
+ if (area)
+ {
+ gdk_cairo_rectangle (cr, area);
+ cairo_clip (cr);
+ }
+
+ result = draw_gap_image (style, cr, widget, match_data,
+ draw_center, x, y, width, height,
+ gap_side, gap_x, gap_width);
+
+ cairo_destroy (cr);
+
+ return result;
+}
+
static void
draw_hline (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x1,
ThemeImage *image;
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
match_data.function = TOKEN_D_HLINE;
match_data.detail = (gchar *)detail;
match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
if (image)
{
if (image->background)
- theme_pixbuf_render_no_cairo (image->background,
- window, area, COMPONENT_ALL, FALSE,
+ theme_pixbuf_render (image->background,
+ cr, COMPONENT_ALL, FALSE,
x1, y, (x2 - x1) + 1, 2);
}
else
- parent_class->draw_hline (style, window, state, area, widget, detail,
+ parent_class->draw_hline (style, cr, state, widget, detail,
x1, x2, y);
}
static void
draw_vline (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint y1,
ThemeImage *image;
ThemeMatchData match_data;
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
match_data.function = TOKEN_D_VLINE;
match_data.detail = (gchar *)detail;
match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
if (image)
{
if (image->background)
- theme_pixbuf_render_no_cairo (image->background,
- window, area, COMPONENT_ALL, FALSE,
+ theme_pixbuf_render (image->background,
+ cr, COMPONENT_ALL, FALSE,
x, y1, 2, (y2 - y1) + 1);
}
else
- parent_class->draw_vline (style, window, state, area, widget, detail,
+ parent_class->draw_vline (style, cr, state, widget, detail,
y1, y2, x);
}
static void
draw_shadow(GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
{
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
match_data.function = TOKEN_D_SHADOW;
match_data.detail = (gchar *)detail;
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, FALSE, FALSE,
+ if (!draw_simple_image (style, cr, widget, &match_data, FALSE, FALSE,
x, y, width, height))
- parent_class->draw_shadow (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_shadow (style, cr, state, shadow, widget, detail,
x, y, width, height);
}
static void
draw_arrow (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
GtkArrowType arrow_direction,
{
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
if (detail &&
(strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
{
match_data.state = state;
match_data.arrow_direction = arrow_direction;
- if (draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
box_x, box_y, box_width, box_height))
{
/* The theme included stepper images, we're done */
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
box_x, box_y, box_width, box_height))
- parent_class->draw_box (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_box (style, cr, state, shadow, widget, detail,
box_x, box_y, box_width, box_height);
}
match_data.state = state;
match_data.arrow_direction = arrow_direction;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
x, y, width, height))
- parent_class->draw_arrow (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_arrow (style, cr, state, shadow, widget, detail,
arrow_direction, fill, x, y, width, height);
}
static void
draw_diamond (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
{
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
match_data.function = TOKEN_D_DIAMOND;
match_data.detail = (gchar *)detail;
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
x, y, width, height))
- parent_class->draw_diamond (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_diamond (style, cr, state, shadow, widget, detail,
x, y, width, height);
}
static void
draw_box (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
{
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
if (detail &&
(strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
{
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
x, y, width, height)) {
- parent_class->draw_box (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_box (style, cr, state, shadow, widget, detail,
x, y, width, height);
}
}
static void
draw_flat_box (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
{
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
match_data.function = TOKEN_D_FLAT_BOX;
match_data.detail = (gchar *)detail;
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
x, y, width, height))
- parent_class->draw_flat_box (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_flat_box (style, cr, state, shadow, widget, detail,
x, y, width, height);
}
static void
draw_check (GtkStyle *style,
- GdkWindow *window,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
{
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
match_data.function = TOKEN_D_CHECK;
match_data.detail = (gchar *)detail;
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
x, y, width, height))
- parent_class->draw_check (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_check (style, cr, state, shadow, widget, detail,
x, y, width, height);
}
static void
-draw_option (GtkStyle *style,
- GdkWindow *window,
+draw_option (GtkStyle *style,
+ cairo_t *cr,
GtkStateType state,
GtkShadowType shadow,
- GdkRectangle *area,
GtkWidget *widget,
const gchar *detail,
gint x,
{
ThemeMatchData match_data;
- g_return_if_fail(style != NULL);
- g_return_if_fail(window != NULL);
-
match_data.function = TOKEN_D_OPTION;
match_data.detail = (gchar *)detail;
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+ if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
x, y, width, height))
- parent_class->draw_option (style, window, state, shadow, area, widget, detail,
+ parent_class->draw_option (style, cr, state, shadow, widget, detail,
x, y, width, height);
}
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_gap_image (style, window, area, widget, &match_data, FALSE,
+ if (!draw_gap_image_no_cairo (style, window, area, widget, &match_data, FALSE,
x, y, width, height, gap_side, gap_x, gap_width))
parent_class->draw_shadow_gap (style, window, state, shadow, area, widget, detail,
x, y, width, height, gap_side, gap_x, gap_width);
match_data.shadow = shadow;
match_data.state = state;
- if (!draw_gap_image (style, window, area, widget, &match_data, TRUE,
+ if (!draw_gap_image_no_cairo (style, window, area, widget, &match_data, TRUE,
x, y, width, height, gap_side, gap_x, gap_width))
parent_class->draw_box_gap (style, window, state, shadow, area, widget, detail,
x, y, width, height, gap_side, gap_x, gap_width);