2000-02-07 02:36:39 +00:00
|
|
|
/* GTK+ Pixbuf Engine
|
2000-03-06 16:12:22 +00:00
|
|
|
* Copyright (C) 1998-2000 Red Hat, Inc.
|
2000-02-07 02:36:39 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
|
|
|
|
* Carsten Haitzler <raster@rasterman.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <math.h>
|
2000-07-09 22:18:21 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "pixbuf.h"
|
2000-07-18 16:21:33 +00:00
|
|
|
#include "pixbuf-rc-style.h"
|
|
|
|
#include "pixbuf-style.h"
|
|
|
|
|
|
|
|
static void pixbuf_style_init (PixbufStyle *style);
|
|
|
|
static void pixbuf_style_class_init (PixbufStyleClass *klass);
|
|
|
|
|
2001-03-05 16:44:18 +00:00
|
|
|
static GtkStyleClass *parent_class = NULL;
|
2000-02-07 02:36:39 +00:00
|
|
|
|
|
|
|
static ThemeImage *
|
2000-07-18 16:21:33 +00:00
|
|
|
match_theme_image (GtkStyle *style,
|
|
|
|
ThemeMatchData *match_data)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
GList *tmp_list;
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
tmp_list = PIXBUF_RC_STYLE (style->rc_style)->img_list;
|
2000-02-07 02:36:39 +00:00
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
guint flags;
|
|
|
|
ThemeImage *image = tmp_list->data;
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
|
|
|
|
if (match_data->function != image->match_data.function)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
flags = match_data->flags & image->match_data.flags;
|
|
|
|
|
|
|
|
if (flags != image->match_data.flags) /* Required components not present */
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((flags & THEME_MATCH_STATE) &&
|
|
|
|
match_data->state != image->match_data.state)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((flags & THEME_MATCH_SHADOW) &&
|
|
|
|
match_data->shadow != image->match_data.shadow)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((flags & THEME_MATCH_ARROW_DIRECTION) &&
|
|
|
|
match_data->arrow_direction != image->match_data.arrow_direction)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((flags & THEME_MATCH_ORIENTATION) &&
|
|
|
|
match_data->orientation != image->match_data.orientation)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((flags & THEME_MATCH_GAP_SIDE) &&
|
|
|
|
match_data->gap_side != image->match_data.gap_side)
|
|
|
|
continue;
|
|
|
|
|
2006-01-16 19:53:10 +00:00
|
|
|
if ((flags & THEME_MATCH_EXPANDER_STYLE) &&
|
|
|
|
match_data->expander_style != image->match_data.expander_style)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((flags & THEME_MATCH_WINDOW_EDGE) &&
|
|
|
|
match_data->window_edge != image->match_data.window_edge)
|
|
|
|
continue;
|
|
|
|
|
2000-02-07 02:36:39 +00:00
|
|
|
if (image->match_data.detail &&
|
2004-03-18 15:09:55 +00:00
|
|
|
(!match_data->detail ||
|
2000-02-07 02:36:39 +00:00
|
|
|
strcmp (match_data->detail, image->match_data.detail) != 0))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
static gboolean
|
2000-03-06 16:12:22 +00:00
|
|
|
draw_simple_image(GtkStyle *style,
|
2010-08-17 02:43:11 +00:00
|
|
|
cairo_t *cr,
|
2000-03-06 16:12:22 +00:00
|
|
|
GtkWidget *widget,
|
2000-02-07 02:36:39 +00:00
|
|
|
ThemeMatchData *match_data,
|
|
|
|
gboolean draw_center,
|
|
|
|
gboolean allow_setbg,
|
2000-07-18 16:21:33 +00:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
2010-08-17 02:43:11 +00:00
|
|
|
|
2000-02-07 02:36:39 +00:00
|
|
|
ThemeImage *image;
|
|
|
|
|
|
|
|
if (!(match_data->flags & THEME_MATCH_ORIENTATION))
|
|
|
|
{
|
|
|
|
match_data->flags |= THEME_MATCH_ORIENTATION;
|
|
|
|
|
|
|
|
if (height > width)
|
|
|
|
match_data->orientation = GTK_ORIENTATION_VERTICAL;
|
|
|
|
else
|
|
|
|
match_data->orientation = GTK_ORIENTATION_HORIZONTAL;
|
|
|
|
}
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
image = match_theme_image (style, match_data);
|
2000-02-07 02:36:39 +00:00
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
if (image->background)
|
|
|
|
{
|
2010-08-17 02:43:11 +00:00
|
|
|
theme_pixbuf_render (image->background, cr,
|
2000-02-07 02:36:39 +00:00
|
|
|
draw_center ? COMPONENT_ALL : COMPONENT_ALL | COMPONENT_CENTER,
|
|
|
|
FALSE,
|
|
|
|
x, y, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (image->overlay && draw_center)
|
2010-08-17 02:43:11 +00:00
|
|
|
theme_pixbuf_render (image->overlay, cr, COMPONENT_ALL,
|
2000-02-07 02:36:39 +00:00
|
|
|
TRUE,
|
|
|
|
x, y, width, height);
|
2000-07-18 16:21:33 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
2000-07-18 16:21:33 +00:00
|
|
|
else
|
|
|
|
return FALSE;
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
static gboolean
|
2000-02-07 02:36:39 +00:00
|
|
|
draw_gap_image(GtkStyle *style,
|
2010-08-17 02:47:02 +00:00
|
|
|
cairo_t *cr,
|
2000-02-07 02:36:39 +00:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
ThemeImage *image;
|
|
|
|
|
|
|
|
if (!(match_data->flags & THEME_MATCH_ORIENTATION))
|
|
|
|
{
|
|
|
|
match_data->flags |= THEME_MATCH_ORIENTATION;
|
|
|
|
|
|
|
|
if (height > width)
|
|
|
|
match_data->orientation = GTK_ORIENTATION_VERTICAL;
|
|
|
|
else
|
|
|
|
match_data->orientation = GTK_ORIENTATION_HORIZONTAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
match_data->flags |= THEME_MATCH_GAP_SIDE;
|
|
|
|
match_data->gap_side = gap_side;
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
image = match_theme_image (style, match_data);
|
2000-02-07 02:36:39 +00:00
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
gint thickness;
|
|
|
|
GdkRectangle r1, r2, r3;
|
|
|
|
GdkPixbuf *pixbuf = NULL;
|
|
|
|
guint components = COMPONENT_ALL;
|
|
|
|
|
|
|
|
if (!draw_center)
|
|
|
|
components |= COMPONENT_CENTER;
|
|
|
|
|
|
|
|
if (image->gap_start)
|
|
|
|
pixbuf = theme_pixbuf_get_pixbuf (image->gap_start);
|
|
|
|
|
|
|
|
switch (gap_side)
|
|
|
|
{
|
|
|
|
case GTK_POS_TOP:
|
|
|
|
if (pixbuf)
|
2000-07-09 22:18:21 +00:00
|
|
|
thickness = gdk_pixbuf_get_height (pixbuf);
|
2000-02-07 02:36:39 +00:00
|
|
|
else
|
2000-07-18 16:21:33 +00:00
|
|
|
thickness = style->ythickness;
|
2000-02-07 02:36:39 +00:00
|
|
|
|
|
|
|
if (!draw_center)
|
|
|
|
components |= COMPONENT_NORTH_WEST | COMPONENT_NORTH | COMPONENT_NORTH_EAST;
|
|
|
|
|
|
|
|
r1.x = x;
|
|
|
|
r1.y = y;
|
|
|
|
r1.width = gap_x;
|
|
|
|
r1.height = thickness;
|
|
|
|
r2.x = x + gap_x;
|
|
|
|
r2.y = y;
|
|
|
|
r2.width = gap_width;
|
|
|
|
r2.height = thickness;
|
|
|
|
r3.x = x + gap_x + gap_width;
|
|
|
|
r3.y = y;
|
|
|
|
r3.width = width - (gap_x + gap_width);
|
|
|
|
r3.height = thickness;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_POS_BOTTOM:
|
|
|
|
if (pixbuf)
|
2000-07-09 22:18:21 +00:00
|
|
|
thickness = gdk_pixbuf_get_height (pixbuf);
|
2000-02-07 02:36:39 +00:00
|
|
|
else
|
2000-07-18 16:21:33 +00:00
|
|
|
thickness = style->ythickness;
|
2000-02-07 02:36:39 +00:00
|
|
|
|
|
|
|
if (!draw_center)
|
|
|
|
components |= COMPONENT_SOUTH_WEST | COMPONENT_SOUTH | COMPONENT_SOUTH_EAST;
|
|
|
|
|
|
|
|
r1.x = x;
|
|
|
|
r1.y = y + height - thickness;
|
|
|
|
r1.width = gap_x;
|
|
|
|
r1.height = thickness;
|
|
|
|
r2.x = x + gap_x;
|
|
|
|
r2.y = y + height - thickness;
|
|
|
|
r2.width = gap_width;
|
|
|
|
r2.height = thickness;
|
|
|
|
r3.x = x + gap_x + gap_width;
|
|
|
|
r3.y = y + height - thickness;
|
|
|
|
r3.width = width - (gap_x + gap_width);
|
|
|
|
r3.height = thickness;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_POS_LEFT:
|
|
|
|
if (pixbuf)
|
2000-07-09 22:18:21 +00:00
|
|
|
thickness = gdk_pixbuf_get_width (pixbuf);
|
2000-02-07 02:36:39 +00:00
|
|
|
else
|
2000-07-18 16:21:33 +00:00
|
|
|
thickness = style->xthickness;
|
2000-02-07 02:36:39 +00:00
|
|
|
|
|
|
|
if (!draw_center)
|
|
|
|
components |= COMPONENT_NORTH_WEST | COMPONENT_WEST | COMPONENT_SOUTH_WEST;
|
|
|
|
|
|
|
|
r1.x = x;
|
|
|
|
r1.y = y;
|
|
|
|
r1.width = thickness;
|
|
|
|
r1.height = gap_x;
|
|
|
|
r2.x = x;
|
|
|
|
r2.y = y + gap_x;
|
|
|
|
r2.width = thickness;
|
|
|
|
r2.height = gap_width;
|
|
|
|
r3.x = x;
|
|
|
|
r3.y = y + gap_x + gap_width;
|
|
|
|
r3.width = thickness;
|
|
|
|
r3.height = height - (gap_x + gap_width);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_POS_RIGHT:
|
|
|
|
if (pixbuf)
|
2000-07-09 22:18:21 +00:00
|
|
|
thickness = gdk_pixbuf_get_width (pixbuf);
|
2000-02-07 02:36:39 +00:00
|
|
|
else
|
2000-07-18 16:21:33 +00:00
|
|
|
thickness = style->xthickness;
|
2000-02-07 02:36:39 +00:00
|
|
|
|
|
|
|
if (!draw_center)
|
|
|
|
components |= COMPONENT_NORTH_EAST | COMPONENT_EAST | COMPONENT_SOUTH_EAST;
|
|
|
|
|
|
|
|
r1.x = x + width - thickness;
|
|
|
|
r1.y = y;
|
|
|
|
r1.width = thickness;
|
|
|
|
r1.height = gap_x;
|
|
|
|
r2.x = x + width - thickness;
|
|
|
|
r2.y = y + gap_x;
|
|
|
|
r2.width = thickness;
|
|
|
|
r2.height = gap_width;
|
|
|
|
r3.x = x + width - thickness;
|
|
|
|
r3.y = y + gap_x + gap_width;
|
|
|
|
r3.width = thickness;
|
|
|
|
r3.height = height - (gap_x + gap_width);
|
|
|
|
break;
|
2006-01-16 13:18:16 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (image->background)
|
2010-08-17 02:47:02 +00:00
|
|
|
theme_pixbuf_render (image->background,
|
|
|
|
cr, components, FALSE,
|
2000-02-07 02:36:39 +00:00
|
|
|
x, y, width, height);
|
|
|
|
if (image->gap_start)
|
2010-08-17 02:47:02 +00:00
|
|
|
theme_pixbuf_render (image->gap_start,
|
|
|
|
cr, COMPONENT_ALL, FALSE,
|
2000-02-07 02:36:39 +00:00
|
|
|
r1.x, r1.y, r1.width, r1.height);
|
|
|
|
if (image->gap)
|
2010-08-17 02:47:02 +00:00
|
|
|
theme_pixbuf_render (image->gap,
|
|
|
|
cr, COMPONENT_ALL, FALSE,
|
2000-02-07 02:36:39 +00:00
|
|
|
r2.x, r2.y, r2.width, r2.height);
|
|
|
|
if (image->gap_end)
|
2010-08-17 02:47:02 +00:00
|
|
|
theme_pixbuf_render (image->gap_end,
|
|
|
|
cr, COMPONENT_ALL, FALSE,
|
2000-02-07 02:36:39 +00:00
|
|
|
r3.x, r3.y, r3.width, r3.height);
|
2000-07-18 16:21:33 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
2000-07-18 16:21:33 +00:00
|
|
|
else
|
|
|
|
return FALSE;
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_hline (GtkStyle *style,
|
2010-08-16 13:35:58 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x1,
|
|
|
|
gint x2,
|
|
|
|
gint y)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeImage *image;
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_HLINE;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.orientation = GTK_ORIENTATION_HORIZONTAL;
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
image = match_theme_image (style, &match_data);
|
2000-02-07 02:36:39 +00:00
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
if (image->background)
|
2010-08-16 13:35:58 +00:00
|
|
|
theme_pixbuf_render (image->background,
|
|
|
|
cr, COMPONENT_ALL, FALSE,
|
2000-02-07 02:36:39 +00:00
|
|
|
x1, y, (x2 - x1) + 1, 2);
|
|
|
|
}
|
2000-07-18 16:21:33 +00:00
|
|
|
else
|
2010-08-16 13:35:58 +00:00
|
|
|
parent_class->draw_hline (style, cr, state, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x1, x2, y);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_vline (GtkStyle *style,
|
2010-08-16 13:40:03 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint y1,
|
|
|
|
gint y2,
|
|
|
|
gint x)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeImage *image;
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_VLINE;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.orientation = GTK_ORIENTATION_VERTICAL;
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
image = match_theme_image (style, &match_data);
|
2000-02-07 02:36:39 +00:00
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
if (image->background)
|
2010-08-16 13:40:03 +00:00
|
|
|
theme_pixbuf_render (image->background,
|
|
|
|
cr, COMPONENT_ALL, FALSE,
|
2000-02-07 02:36:39 +00:00
|
|
|
x, y1, 2, (y2 - y1) + 1);
|
|
|
|
}
|
2000-07-18 16:21:33 +00:00
|
|
|
else
|
2010-08-16 13:40:03 +00:00
|
|
|
parent_class->draw_vline (style, cr, state, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
y1, y2, x);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_shadow(GtkStyle *style,
|
2010-08-16 13:48:06 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
2000-02-07 02:36:39 +00:00
|
|
|
GtkShadowType shadow,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_SHADOW;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 13:48:06 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, FALSE, FALSE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 13:48:06 +00:00
|
|
|
parent_class->draw_shadow (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
2002-04-21 19:00:52 +00:00
|
|
|
/* This function makes up for some brokeness in gtkrange.c
|
|
|
|
* where we never get the full arrow of the stepper button
|
|
|
|
* and the type of button in a single drawing function.
|
|
|
|
*
|
|
|
|
* It doesn't work correctly when the scrollbar is squished
|
|
|
|
* to the point we don't have room for full-sized steppers.
|
|
|
|
*/
|
2000-02-07 02:36:39 +00:00
|
|
|
static void
|
2002-04-21 19:00:52 +00:00
|
|
|
reverse_engineer_stepper_box (GtkWidget *range,
|
|
|
|
GtkArrowType arrow_type,
|
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *width,
|
|
|
|
gint *height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
2002-04-21 19:00:52 +00:00
|
|
|
gint slider_width = 14, stepper_size = 14;
|
|
|
|
gint box_width;
|
|
|
|
gint box_height;
|
|
|
|
|
2006-08-26 06:02:33 +00:00
|
|
|
if (range && GTK_IS_RANGE (range))
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
2002-04-21 19:00:52 +00:00
|
|
|
gtk_widget_style_get (range,
|
|
|
|
"slider_width", &slider_width,
|
|
|
|
"stepper_size", &stepper_size,
|
|
|
|
NULL);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
2002-04-21 19:00:52 +00:00
|
|
|
|
|
|
|
if (arrow_type == GTK_ARROW_UP || arrow_type == GTK_ARROW_DOWN)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
2002-04-21 19:00:52 +00:00
|
|
|
box_width = slider_width;
|
|
|
|
box_height = stepper_size;
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
2002-04-21 19:00:52 +00:00
|
|
|
else
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
2002-04-21 19:00:52 +00:00
|
|
|
box_width = stepper_size;
|
|
|
|
box_height = slider_width;
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
2002-04-21 19:00:52 +00:00
|
|
|
|
|
|
|
*x = *x - (box_width - *width) / 2;
|
|
|
|
*y = *y - (box_height - *height) / 2;
|
|
|
|
*width = box_width;
|
|
|
|
*height = box_height;
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_arrow (GtkStyle *style,
|
2010-08-16 13:48:06 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
GtkArrowType arrow_direction,
|
|
|
|
gint fill,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
2002-09-07 00:35:57 +00:00
|
|
|
if (detail &&
|
|
|
|
(strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
|
2002-04-21 19:00:52 +00:00
|
|
|
{
|
|
|
|
/* This is a hack to work around the fact that scrollbar steppers are drawn
|
|
|
|
* as a box + arrow, so we never have
|
|
|
|
*
|
|
|
|
* The full bounding box of the scrollbar
|
|
|
|
* The arrow direction
|
|
|
|
*
|
|
|
|
* At the same time. We simulate an extra paint function, "STEPPER", by doing
|
|
|
|
* nothing for the box, and then here, reverse engineering the box that
|
|
|
|
* was passed to draw box and using that
|
|
|
|
*/
|
|
|
|
gint box_x = x;
|
|
|
|
gint box_y = y;
|
|
|
|
gint box_width = width;
|
|
|
|
gint box_height = height;
|
|
|
|
|
|
|
|
reverse_engineer_stepper_box (widget, arrow_direction,
|
|
|
|
&box_x, &box_y, &box_width, &box_height);
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_STEPPER;
|
|
|
|
match_data.detail = (gchar *)detail;
|
|
|
|
match_data.flags = (THEME_MATCH_SHADOW |
|
|
|
|
THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_ARROW_DIRECTION);
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.arrow_direction = arrow_direction;
|
|
|
|
|
2010-08-16 13:48:06 +00:00
|
|
|
if (draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2002-04-21 19:00:52 +00:00
|
|
|
box_x, box_y, box_width, box_height))
|
|
|
|
{
|
|
|
|
/* The theme included stepper images, we're done */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, draw the full box, and fall through to draw the arrow
|
|
|
|
*/
|
|
|
|
match_data.function = TOKEN_D_BOX;
|
|
|
|
match_data.detail = (gchar *)detail;
|
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 13:48:06 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2002-04-21 19:00:52 +00:00
|
|
|
box_x, box_y, box_width, box_height))
|
2010-08-16 13:48:06 +00:00
|
|
|
parent_class->draw_box (style, cr, state, shadow, widget, detail,
|
2002-04-21 19:00:52 +00:00
|
|
|
box_x, box_y, box_width, box_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.function = TOKEN_D_ARROW;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = (THEME_MATCH_SHADOW |
|
|
|
|
THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_ARROW_DIRECTION);
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.arrow_direction = arrow_direction;
|
|
|
|
|
2010-08-16 13:48:06 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 13:48:06 +00:00
|
|
|
parent_class->draw_arrow (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
arrow_direction, fill, x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_diamond (GtkStyle *style,
|
2010-08-16 13:48:06 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_DIAMOND;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 13:48:06 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 13:48:06 +00:00
|
|
|
parent_class->draw_diamond (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_box (GtkStyle *style,
|
2010-08-16 13:48:06 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
2002-09-07 00:35:57 +00:00
|
|
|
if (detail &&
|
|
|
|
(strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
|
2002-04-21 19:00:52 +00:00
|
|
|
{
|
|
|
|
/* We handle this in draw_arrow */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.function = TOKEN_D_BOX;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
2000-07-18 16:21:33 +00:00
|
|
|
|
2010-08-16 13:48:06 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2002-01-28 05:34:17 +00:00
|
|
|
x, y, width, height)) {
|
2010-08-16 13:48:06 +00:00
|
|
|
parent_class->draw_box (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2002-01-28 05:34:17 +00:00
|
|
|
}
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_flat_box (GtkStyle *style,
|
2010-08-16 19:50:08 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_FLAT_BOX;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
2000-07-18 16:21:33 +00:00
|
|
|
|
2010-08-16 19:50:08 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 19:50:08 +00:00
|
|
|
parent_class->draw_flat_box (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_check (GtkStyle *style,
|
2010-08-16 19:55:02 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_CHECK;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 19:55:02 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 19:55:02 +00:00
|
|
|
parent_class->draw_check (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-08-16 19:58:15 +00:00
|
|
|
draw_option (GtkStyle *style,
|
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_OPTION;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 19:58:15 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 19:58:15 +00:00
|
|
|
parent_class->draw_option (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_tab (GtkStyle *style,
|
2010-08-16 20:10:00 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_TAB;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 20:10:00 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 20:10:00 +00:00
|
|
|
parent_class->draw_tab (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_shadow_gap (GtkStyle *style,
|
2010-08-16 14:09:11 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_SHADOW_GAP;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.flags = (THEME_MATCH_SHADOW |
|
|
|
|
THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_ORIENTATION);
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 14:09:11 +00:00
|
|
|
if (!draw_gap_image (style, cr, widget, &match_data, FALSE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height, gap_side, gap_x, gap_width))
|
2010-08-16 14:09:11 +00:00
|
|
|
parent_class->draw_shadow_gap (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height, gap_side, gap_x, gap_width);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_box_gap (GtkStyle *style,
|
2010-08-16 20:15:43 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side,
|
|
|
|
gint gap_x,
|
|
|
|
gint gap_width)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_BOX_GAP;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
|
|
|
|
match_data.flags = (THEME_MATCH_SHADOW |
|
|
|
|
THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_ORIENTATION);
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
|
2010-08-16 20:15:43 +00:00
|
|
|
if (!draw_gap_image (style, cr, widget, &match_data, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height, gap_side, gap_x, gap_width))
|
2010-08-16 20:15:43 +00:00
|
|
|
parent_class->draw_box_gap (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height, gap_side, gap_x, gap_width);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_extension (GtkStyle *style,
|
2010-08-16 20:19:56 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkPositionType gap_side)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_EXTENSION;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE | THEME_MATCH_GAP_SIDE;
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.gap_side = gap_side;
|
2000-07-18 16:21:33 +00:00
|
|
|
|
2010-08-16 20:19:56 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 20:19:56 +00:00
|
|
|
parent_class->draw_extension (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height, gap_side);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_focus (GtkStyle *style,
|
2010-08-16 20:24:46 +00:00
|
|
|
cairo_t *cr,
|
2002-01-18 23:14:45 +00:00
|
|
|
GtkStateType state_type,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_FOCUS;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = 0;
|
|
|
|
|
2010-08-16 20:24:46 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, FALSE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 20:24:46 +00:00
|
|
|
parent_class->draw_focus (style, cr, state_type, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_slider (GtkStyle *style,
|
2010-08-17 00:46:46 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_SLIDER;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = (THEME_MATCH_SHADOW |
|
|
|
|
THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_ORIENTATION);
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.orientation = orientation;
|
|
|
|
|
2010-08-17 00:46:46 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-17 00:46:46 +00:00
|
|
|
parent_class->draw_slider (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height, orientation);
|
|
|
|
}
|
2000-02-07 02:36:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-07-18 16:21:33 +00:00
|
|
|
draw_handle (GtkStyle *style,
|
2010-08-17 01:26:20 +00:00
|
|
|
cairo_t *cr,
|
2000-07-18 16:21:33 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkShadowType shadow,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GtkOrientation orientation)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_HANDLE;
|
2000-07-18 16:21:33 +00:00
|
|
|
match_data.detail = (gchar *)detail;
|
2000-02-07 02:36:39 +00:00
|
|
|
match_data.flags = (THEME_MATCH_SHADOW |
|
|
|
|
THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_ORIENTATION);
|
|
|
|
match_data.shadow = shadow;
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.orientation = orientation;
|
|
|
|
|
2010-08-17 01:26:20 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height))
|
2010-08-17 01:26:20 +00:00
|
|
|
parent_class->draw_handle (style, cr, state, shadow, widget, detail,
|
2000-07-18 16:21:33 +00:00
|
|
|
x, y, width, height, orientation);
|
2000-02-07 02:36:39 +00:00
|
|
|
}
|
|
|
|
|
2006-01-16 19:53:10 +00:00
|
|
|
static void
|
|
|
|
draw_expander (GtkStyle *style,
|
2010-08-16 13:26:19 +00:00
|
|
|
cairo_t *cr,
|
2006-01-16 19:53:10 +00:00
|
|
|
GtkStateType state,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
GtkExpanderStyle expander_style)
|
|
|
|
{
|
|
|
|
#define DEFAULT_EXPANDER_SIZE 12
|
|
|
|
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
gint expander_size;
|
|
|
|
gint radius;
|
|
|
|
|
|
|
|
if (widget &&
|
|
|
|
gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget),
|
|
|
|
"expander-size"))
|
|
|
|
{
|
|
|
|
gtk_widget_style_get (widget,
|
|
|
|
"expander-size", &expander_size,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
expander_size = DEFAULT_EXPANDER_SIZE;
|
|
|
|
|
|
|
|
radius = expander_size/2;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_EXPANDER;
|
|
|
|
match_data.detail = (gchar *)detail;
|
|
|
|
match_data.flags = (THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_EXPANDER_STYLE);
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.expander_style = expander_style;
|
|
|
|
|
2010-08-16 13:26:19 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2006-01-16 19:53:10 +00:00
|
|
|
x - radius, y - radius, expander_size, expander_size))
|
2010-08-16 13:26:19 +00:00
|
|
|
parent_class->draw_expander (style, cr, state, widget, detail,
|
2006-01-16 19:53:10 +00:00
|
|
|
x, y, expander_style);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
draw_resize_grip (GtkStyle *style,
|
2010-08-16 13:13:26 +00:00
|
|
|
cairo_t *cr,
|
|
|
|
GtkStateType state,
|
|
|
|
GtkWidget *widget,
|
|
|
|
const gchar *detail,
|
|
|
|
GdkWindowEdge edge,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2006-01-16 19:53:10 +00:00
|
|
|
{
|
|
|
|
ThemeMatchData match_data;
|
|
|
|
|
|
|
|
match_data.function = TOKEN_D_RESIZE_GRIP;
|
|
|
|
match_data.detail = (gchar *)detail;
|
|
|
|
match_data.flags = (THEME_MATCH_STATE |
|
|
|
|
THEME_MATCH_WINDOW_EDGE);
|
|
|
|
match_data.state = state;
|
|
|
|
match_data.window_edge = edge;
|
|
|
|
|
2010-08-16 13:13:26 +00:00
|
|
|
if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
|
2006-01-16 19:53:10 +00:00
|
|
|
x, y, width, height))
|
2010-08-16 13:13:26 +00:00
|
|
|
parent_class->draw_resize_grip (style, cr, state, widget, detail,
|
2006-01-16 19:53:10 +00:00
|
|
|
edge, x, y, width, height);
|
|
|
|
}
|
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
GType pixbuf_type_style = 0;
|
|
|
|
|
2006-03-11 02:13:11 +00:00
|
|
|
void
|
|
|
|
pixbuf_style_register_type (GTypeModule *module)
|
2000-02-07 02:36:39 +00:00
|
|
|
{
|
2009-11-06 00:21:09 +00:00
|
|
|
const GTypeInfo object_info =
|
2006-03-11 02:13:11 +00:00
|
|
|
{
|
2000-07-18 16:21:33 +00:00
|
|
|
sizeof (PixbufStyleClass),
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) pixbuf_style_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (PixbufStyle),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) pixbuf_style_init,
|
|
|
|
};
|
|
|
|
|
2001-02-01 23:55:43 +00:00
|
|
|
pixbuf_type_style = g_type_module_register_type (module,
|
|
|
|
GTK_TYPE_STYLE,
|
|
|
|
"PixbufStyle",
|
|
|
|
&object_info, 0);
|
2000-07-18 16:21:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pixbuf_style_init (PixbufStyle *style)
|
|
|
|
{
|
|
|
|
}
|
2000-02-07 02:36:39 +00:00
|
|
|
|
2000-07-18 16:21:33 +00:00
|
|
|
static void
|
|
|
|
pixbuf_style_class_init (PixbufStyleClass *klass)
|
|
|
|
{
|
|
|
|
GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
|
|
|
style_class->draw_hline = draw_hline;
|
|
|
|
style_class->draw_vline = draw_vline;
|
|
|
|
style_class->draw_shadow = draw_shadow;
|
|
|
|
style_class->draw_arrow = draw_arrow;
|
|
|
|
style_class->draw_diamond = draw_diamond;
|
|
|
|
style_class->draw_box = draw_box;
|
|
|
|
style_class->draw_flat_box = draw_flat_box;
|
|
|
|
style_class->draw_check = draw_check;
|
|
|
|
style_class->draw_option = draw_option;
|
|
|
|
style_class->draw_tab = draw_tab;
|
|
|
|
style_class->draw_shadow_gap = draw_shadow_gap;
|
|
|
|
style_class->draw_box_gap = draw_box_gap;
|
|
|
|
style_class->draw_extension = draw_extension;
|
|
|
|
style_class->draw_focus = draw_focus;
|
|
|
|
style_class->draw_slider = draw_slider;
|
|
|
|
style_class->draw_handle = draw_handle;
|
2006-01-16 19:53:10 +00:00
|
|
|
style_class->draw_expander = draw_expander;
|
|
|
|
style_class->draw_resize_grip = draw_resize_grip;
|
2000-07-18 16:21:33 +00:00
|
|
|
}
|