gtk-engines r1261 - in trunk: . engines/clearlooks/src



Author: denisw
Date: Sat Sep 27 08:18:47 2008
New Revision: 1261
URL: http://svn.gnome.org/viewvc/gtk-engines?rev=1261&view=rev

Log:
2008-09-27  Denis Washington  <denisw svn gnome org>

	* engines/clearlooks/src/clearlooks_draw.c:
	* engines/clearlooks/src/clearlooks_draw_glossy.c:
	* engines/clearlooks/src/clearlooks_draw_gummy.c:
	* engines/clearlooks/src/clearlooks_style.c:
	* engines/clearlooks/src/clearlooks_types.h:
	Customize drawing of the selection rectangles around GtkIconView
	items introduced in GTK+ trunk. (Bug #553575)


Modified:
   trunk/ChangeLog
   trunk/engines/clearlooks/src/clearlooks_draw.c
   trunk/engines/clearlooks/src/clearlooks_draw_glossy.c
   trunk/engines/clearlooks/src/clearlooks_draw_gummy.c
   trunk/engines/clearlooks/src/clearlooks_style.c
   trunk/engines/clearlooks/src/clearlooks_types.h

Modified: trunk/engines/clearlooks/src/clearlooks_draw.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_draw.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_draw.c	Sat Sep 27 08:18:47 2008
@@ -1900,6 +1900,43 @@
 }
 
 static void
+clearlooks_draw_icon_view_item (cairo_t                  *cr,
+	                        const ClearlooksColors   *colors,
+	                        const WidgetParameters   *params,
+	                        int x, int y, int width, int height)
+{
+	CairoColor upper_color;
+	CairoColor lower_color;
+	cairo_pattern_t *pattern;
+	cairo_save (cr);
+
+	cairo_translate (cr, x, y);
+
+	if (params->focus)
+		upper_color = colors->base[params->state_type];
+	else
+		upper_color = colors->base[GTK_STATE_ACTIVE];
+
+	ge_shade_color(&upper_color, 0.92, &lower_color);
+
+	pattern = cairo_pattern_create_linear (0, 0, 0, height);
+	cairo_pattern_add_color_stop_rgb (pattern, 0.0, upper_color.r,
+	                                                upper_color.g,
+	                                                upper_color.b);
+	cairo_pattern_add_color_stop_rgb (pattern, 1.0, lower_color.r,
+	                                                lower_color.g,
+	                                                lower_color.b);
+
+	cairo_set_source (cr, pattern);
+	ge_cairo_rounded_rectangle  (cr, 0, 0, width, height, params->radius, CR_CORNER_ALL);
+	cairo_fill       (cr);
+
+	cairo_pattern_destroy (pattern);
+
+	cairo_restore (cr);
+}
+
+static void
 clearlooks_draw_handle (cairo_t *cr,
                         const ClearlooksColors          *colors,
                         const WidgetParameters          *params,
@@ -2370,6 +2407,7 @@
 	functions->draw_statusbar           = clearlooks_draw_statusbar;
 	functions->draw_menu_frame          = clearlooks_draw_menu_frame;
 	functions->draw_tooltip             = clearlooks_draw_tooltip;
+	functions->draw_icon_view_item      = clearlooks_draw_icon_view_item;
 	functions->draw_handle              = clearlooks_draw_handle;
 	functions->draw_resize_grip         = clearlooks_draw_resize_grip;
 	functions->draw_arrow               = clearlooks_draw_arrow;

Modified: trunk/engines/clearlooks/src/clearlooks_draw_glossy.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_draw_glossy.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_draw_glossy.c	Sat Sep 27 08:18:47 2008
@@ -1443,6 +1443,26 @@
 	}
 }
 
+static void
+clearlooks_glossy_draw_icon_view_item (cairo_t                *cr,
+	                                   const ClearlooksColors *colors,
+	                                   const WidgetParameters *params,
+	                                   int x, int y, int width, int height)
+{
+	CairoColor color;
+	gfloat radius;
+
+	if (params->focus)
+		color = colors->base[params->state_type];
+	else
+		color = colors->base[GTK_STATE_ACTIVE];
+
+	radius = MIN (width / 2, params->radius);
+	radius = MIN (height / 2, radius);
+
+	clearlooks_draw_glossy_gradient (cr, x, y, width, height, &color, params->disabled, params->radius, CR_CORNER_ALL);
+}
+
 void
 clearlooks_register_style_glossy (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants)
 {
@@ -1463,4 +1483,5 @@
 	functions->draw_selected_cell      = clearlooks_glossy_draw_selected_cell;
 	functions->draw_checkbox           = clearlooks_glossy_draw_checkbox;
 	functions->draw_radiobutton        = clearlooks_glossy_draw_radiobutton;
+	functions->draw_icon_view_item     = clearlooks_glossy_draw_icon_view_item;
 }

Modified: trunk/engines/clearlooks/src/clearlooks_draw_gummy.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_draw_gummy.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_draw_gummy.c	Sat Sep 27 08:18:47 2008
@@ -1550,6 +1550,26 @@
 }
 
 static void
+clearlooks_gummy_draw_icon_view_item (cairo_t                *cr,
+	                                  const ClearlooksColors *colors,
+	                                  const WidgetParameters *params,
+	                                  int x, int y, int width, int height)
+{
+	CairoColor color;
+	gfloat radius;
+
+	if (params->focus)
+		color = colors->base[params->state_type];
+	else
+		color = colors->base[GTK_STATE_ACTIVE];
+
+	radius = MIN (width / 2, params->radius);
+	radius = MIN (height / 2, radius);
+
+	clearlooks_draw_gummy_gradient (cr, x, y, width, height, &color, params->disabled, params->radius, CR_CORNER_ALL);
+}
+
+static void
 clearlooks_gummy_draw_focus (cairo_t                *cr,
                              const ClearlooksColors *colors,
                              const WidgetParameters *widget,
@@ -1634,6 +1654,8 @@
 			break;
 		case CL_FOCUS_SCALE:
 			break;
+		case CL_FOCUS_ICONVIEW:
+			break;
 		case CL_FOCUS_UNKNOWN:
 			/* Fallback to classic function, dots */
 			clearlooks_draw_focus (cr, colors, widget, focus, x, y, width, height);
@@ -1701,6 +1723,7 @@
 	functions->draw_statusbar          = clearlooks_gummy_draw_statusbar;
 	functions->draw_checkbox           = clearlooks_gummy_draw_checkbox;
 	functions->draw_radiobutton        = clearlooks_gummy_draw_radiobutton;
+	functions->draw_icon_view_item     = clearlooks_gummy_draw_icon_view_item;
 	functions->draw_focus              = clearlooks_gummy_draw_focus;
 
 	constants->topleft_highlight_shade = 1.3;

Modified: trunk/engines/clearlooks/src/clearlooks_style.c
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_style.c	(original)
+++ trunk/engines/clearlooks/src/clearlooks_style.c	Sat Sep 27 08:18:47 2008
@@ -133,6 +133,25 @@
 
 		cairo_destroy (cr);
 	}
+	else if (DETAIL ("icon_view_item"))
+	{
+		WidgetParameters params;
+		ClearlooksStyle  *clearlooks_style;
+		ClearlooksColors *colors;
+		cairo_t          *cr;
+
+		CHECK_ARGS
+		SANITIZE_SIZE
+
+		clearlooks_style = CLEARLOOKS_STYLE (style);
+		clearlooks_set_widget_parameters (widget, style, state_type, &params);
+		colors = &clearlooks_style->colors;
+		cr = ge_gdk_drawable_to_cairo (window, area);
+
+		STYLE_FUNCTION (draw_icon_view_item) (cr, colors, &params, x, y, width, height);
+
+		cairo_destroy (cr);
+	}
 	else if ((CLEARLOOKS_STYLE (style)->style == CL_STYLE_GLOSSY || CLEARLOOKS_STYLE (style)->style == CL_STYLE_GUMMY) &&
 	         ((DETAIL("checkbutton") || DETAIL("radiobutton")) && state_type == GTK_STATE_PRELIGHT))
 	{
@@ -1524,6 +1543,10 @@
 	{
 		focus.type = CL_FOCUS_TREEVIEW; /* Treeview without content is focused. */
 	}
+	else if (DETAIL("icon_view"))
+	{
+		focus.type = CL_FOCUS_ICONVIEW;
+	}
 	else
 	{
 		focus.type = CL_FOCUS_UNKNOWN; /* Custom widgets (Beagle) and something unknown */

Modified: trunk/engines/clearlooks/src/clearlooks_types.h
==============================================================================
--- trunk/engines/clearlooks/src/clearlooks_types.h	(original)
+++ trunk/engines/clearlooks/src/clearlooks_types.h	Sat Sep 27 08:18:47 2008
@@ -104,6 +104,7 @@
 	CL_FOCUS_TAB,
 	CL_FOCUS_COLOR_WHEEL_DARK,
 	CL_FOCUS_COLOR_WHEEL_LIGHT,
+	CL_FOCUS_ICONVIEW,
 	CL_FOCUS_UNKNOWN
 } ClearlooksFocusType;
 
@@ -484,6 +485,11 @@
 	                               const CheckboxParameters	*checkbox,
 	                               int x, int y, int width, int height);
 
+	void (*draw_icon_view_item)   (cairo_t *cr,
+	                               const ClearlooksColors *colors,
+	                               const WidgetParameters *widget,
+	                               int x, int y, int width, int height);
+
 	/* Style internal functions */
 	/* XXX: Only used by slider_button, inline it? */
 	void (*draw_shadow)           (cairo_t *cr,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]