murrine r140 - in trunk: . schema src



Author: acimitan
Date: Sun Feb 22 01:18:56 2009
New Revision: 140
URL: http://svn.gnome.org/viewvc/murrine?rev=140&view=rev

Log:
2009-02-22  Andrea Cimitan  <andrea cimitan gmail com

	* schema/murrine.xml.in.in:
	* src/murrine_draw.c (murrine_draw_classic_focus),
	(murrine_draw_focus), (murrine_register_style_murrine):
	* src/murrine_rc_style.c (murrine_rc_style_init),
	(murrine_rc_style_parse), (murrine_rc_style_merge):
	* src/murrine_rc_style.h:
	* src/murrine_style.c (murrine_style_draw_box),
	(murrine_style_init_from_rc), (murrine_style_draw_focus),
	(murrine_style_copy):
	* src/murrine_style.h:
	* src/murrine_types.h:
	First implementation of the focus drawing.
	Maybe not amazing as clearlooks's focus, but this focus is 
	compatible with much more colorschemes.


Modified:
   trunk/ChangeLog
   trunk/schema/murrine.xml.in.in
   trunk/src/murrine_draw.c
   trunk/src/murrine_rc_style.c
   trunk/src/murrine_rc_style.h
   trunk/src/murrine_style.c
   trunk/src/murrine_style.h
   trunk/src/murrine_types.h

Modified: trunk/schema/murrine.xml.in.in
==============================================================================
--- trunk/schema/murrine.xml.in.in	(original)
+++ trunk/schema/murrine.xml.in.in	Sun Feb 22 01:18:56 2009
@@ -31,6 +31,13 @@
 		<precision>0.1</precision>
 	</option>
 
+	<option type="color" name="focus_color" default="#000000">
+		<_long_name>Focus Color</_long_name>
+		<section>General</section>
+		<_description>Sets the Color of Focus</_description>
+	</option>
+
+
 	<option type="enumeration" name="glazestyle" default="0">
 		<_long_name>Glaze Style</_long_name>
 		<section>General</section>

Modified: trunk/src/murrine_draw.c
==============================================================================
--- trunk/src/murrine_draw.c	(original)
+++ trunk/src/murrine_draw.c	Sun Feb 22 01:18:56 2009
@@ -2067,6 +2067,150 @@
 	}
 }
 
+static void
+murrine_draw_classic_focus (cairo_t *cr,
+                            const MurrineColors    *colors,
+                            const WidgetParameters *widget,
+                            const FocusParameters  *focus,
+                            int x, int y, int width, int height)
+{
+	if (focus->has_color)
+		murrine_set_color_rgb (cr, &focus->color);
+	else if (focus->type == MRN_FOCUS_COLOR_WHEEL_LIGHT)
+		cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+	else if (focus->type == MRN_FOCUS_COLOR_WHEEL_DARK)
+		cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+	else
+		murrine_set_color_rgba (cr, &colors->fg[widget->state_type], 0.7);
+
+	cairo_set_line_width (cr, focus->line_width);
+
+	if (focus->dash_list[0])
+	{
+		gint n_dashes = strlen ((gchar *)focus->dash_list);
+		gdouble *dashes = g_new (gdouble, n_dashes);
+		gdouble total_length = 0;
+		gdouble dash_offset;
+		gint i;
+
+		for (i = 0; i < n_dashes; i++)
+		{
+			dashes[i] = focus->dash_list[i];
+			total_length += focus->dash_list[i];
+		}
+
+		dash_offset = -focus->line_width / 2.0;
+		while (dash_offset < 0)
+			dash_offset += total_length;
+
+		cairo_set_dash (cr, dashes, n_dashes, dash_offset);
+		g_free (dashes);
+	}
+
+	cairo_rectangle (cr, x+focus->line_width/2.0, y+focus->line_width/2.0,
+	                     width-focus->line_width, height-focus->line_width);
+	cairo_stroke (cr);
+}
+
+void
+murrine_draw_focus (cairo_t *cr,
+                    const MurrineColors    *colors,
+                    const WidgetParameters *widget,
+                    const FocusParameters  *focus,
+                    int x, int y, int width, int height)
+{
+	MurrineRGB fill = focus->color;
+	MurrineRGB border;
+
+	/* Default values */
+	int radius = 0;
+	double xoffset = 1.0;
+	double yoffset = 1.0;
+	double border_alpha = 0.90;
+	double fill_alpha = 0.14;
+	boolean focus_fill = TRUE;
+	boolean focus_border = TRUE;
+
+	/* Do some useful things to adjust focus */
+	switch (focus->type)
+	{
+		case MRN_FOCUS_BUTTON:
+			xoffset = -(focus->padding);
+			yoffset = -(focus->padding);
+			radius = widget->roundness-1;
+			break;
+		case MRN_FOCUS_BUTTON_FLAT:
+			xoffset = -(focus->padding);
+			yoffset = -(focus->padding);
+			if (widget->active || widget->prelight)
+				radius = widget->roundness-1;
+			break;
+		case MRN_FOCUS_LABEL:
+			xoffset = 0.0;
+			yoffset = 0.0;
+			break;
+		case MRN_FOCUS_TREEVIEW:
+			xoffset = -1.0;
+			yoffset = -1.0;
+			focus_border = FALSE;
+			break;
+		case MRN_FOCUS_TREEVIEW_DND:
+			break;
+		case MRN_FOCUS_TREEVIEW_HEADER:
+			cairo_translate (cr, -1, 0);
+			break;
+		case MRN_FOCUS_TREEVIEW_ROW:
+			xoffset = 0.0;
+			if (widget->state_type == GTK_STATE_SELECTED)
+			{
+				fill = colors->text[GTK_STATE_SELECTED];
+				border_alpha = 0.35;
+				focus_fill = FALSE;
+			}
+			break;
+		case MRN_FOCUS_TAB:
+			break;
+		case MRN_FOCUS_SCALE:
+			break;
+		case MRN_FOCUS_ICONVIEW:
+			break;
+		case MRN_FOCUS_UNKNOWN:
+			/* Fallback to classic function, dots */
+			murrine_draw_classic_focus (cr, colors, widget, focus, x, y, width, height);
+			return;
+			break;
+		default:
+			break;
+	};
+
+	murrine_shade (&fill, 1.0, &border);
+
+	cairo_translate (cr, x, y);
+	cairo_set_line_width (cr, focus->line_width);
+
+	cairo_save (cr);
+
+	murrine_rounded_rectangle_closed (cr, xoffset, yoffset, width-(xoffset*2), height-(yoffset*2), radius, widget->corners);
+	cairo_clip_preserve (cr);
+
+	if (focus_fill)
+	{
+		murrine_set_color_rgba (cr, &fill, fill_alpha);
+		cairo_fill (cr);
+	}
+
+	if (focus_border)
+	{
+		cairo_new_path (cr);
+		cairo_move_to (cr, xoffset, height-yoffset-0.5);
+		cairo_line_to (cr, width-xoffset,  height-yoffset-0.5);
+		murrine_set_color_rgba (cr, &border, border_alpha);
+		cairo_stroke (cr);
+	}
+
+	cairo_restore (cr);
+}
+
 void
 murrine_register_style_murrine (MurrineStyleFunctions *functions)
 {
@@ -2101,4 +2245,5 @@
 	functions->draw_arrow              = murrine_draw_arrow;
 	functions->draw_checkbox           = murrine_draw_checkbox;
 	functions->draw_radiobutton        = murrine_draw_radiobutton;
+	functions->draw_focus              = murrine_draw_focus;
 }

Modified: trunk/src/murrine_rc_style.c
==============================================================================
--- trunk/src/murrine_rc_style.c	(original)
+++ trunk/src/murrine_rc_style.c	Sun Feb 22 01:18:56 2009
@@ -38,6 +38,7 @@
 	TOKEN_ANIMATION = G_TOKEN_LAST + 1,
 	TOKEN_COLORIZE_SCROLLBAR,
 	TOKEN_CONTRAST,
+	TOKEN_FOCUS_COLOR,
 	TOKEN_GLAZESTYLE,
 	TOKEN_GLOW_SHADE,
 	TOKEN_GLOWSTYLE,
@@ -90,6 +91,7 @@
 	{ "animation",           TOKEN_ANIMATION },
 	{ "colorize_scrollbar",  TOKEN_COLORIZE_SCROLLBAR },
 	{ "contrast",            TOKEN_CONTRAST },
+	{ "focus_color",         TOKEN_FOCUS_COLOR },
 	{ "glazestyle",          TOKEN_GLAZESTYLE },
 	{ "glow_shade",          TOKEN_GLOW_SHADE },
 	{ "glowstyle",           TOKEN_GLOWSTYLE },
@@ -148,6 +150,7 @@
 	murrine_rc->animation = FALSE;
 	murrine_rc->colorize_scrollbar = TRUE;
 	murrine_rc->contrast = 1.0;
+	murrine_rc->has_focus_color = FALSE;
 	murrine_rc->glazestyle = 1;
 	murrine_rc->glow_shade = 1.0;
 	murrine_rc->glowstyle = 0;
@@ -475,6 +478,11 @@
 				token = theme_parse_shade (settings, scanner, &murrine_style->contrast);
 				murrine_style->flags |= MRN_FLAG_CONTRAST;
 				break;
+			case TOKEN_FOCUS_COLOR:
+				token = theme_parse_color (settings, scanner, &murrine_style->focus_color);
+				murrine_style->flags |= MRN_FLAG_FOCUS_COLOR;
+				murrine_style->has_focus_color = TRUE;
+				break;
 			case TOKEN_GLAZESTYLE:
 				token = theme_parse_int (settings, scanner, &murrine_style->glazestyle);
 				murrine_style->flags |= MRN_FLAG_GLAZESTYLE;
@@ -640,6 +648,11 @@
 		dest_w->colorize_scrollbar = src_w->colorize_scrollbar;
 	if (flags & MRN_FLAG_CONTRAST)
 		dest_w->contrast = src_w->contrast;
+	if (flags & MRN_FLAG_FOCUS_COLOR)
+	{
+		dest_w->has_focus_color = TRUE;
+		dest_w->focus_color = src_w->focus_color;
+	}
 	if (flags & MRN_FLAG_GLAZESTYLE)
 		dest_w->glazestyle = src_w->glazestyle;
 	if (flags & MRN_FLAG_GLOW_SHADE)

Modified: trunk/src/murrine_rc_style.h
==============================================================================
--- trunk/src/murrine_rc_style.h	(original)
+++ trunk/src/murrine_rc_style.h	Sun Feb 22 01:18:56 2009
@@ -38,30 +38,31 @@
 	MRN_FLAG_ANIMATION = 1 << 0,
 	MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 1,
 	MRN_FLAG_CONTRAST = 1 << 2,
-	MRN_FLAG_GLAZESTYLE = 1 << 3,
-	MRN_FLAG_GLOW_SHADE = 1 << 4,
-	MRN_FLAG_GLOWSTYLE = 1 << 5,
-	MRN_FLAG_GRADIENT_SHADES = 1 << 6,
-	MRN_FLAG_GRADIENTS = 1 << 7,
-	MRN_FLAG_HIGHLIGHT_SHADE = 1 << 8,
-	MRN_FLAG_LIGHTBORDER_SHADE = 1 << 9,
-	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 10,
-	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 11,
-	MRN_FLAG_LISTVIEWSTYLE = 1 << 12,
-	MRN_FLAG_MENUBARITEMSTYLE = 1 << 13,
-	MRN_FLAG_MENUBARSTYLE = 1 << 14,
-	MRN_FLAG_MENUITEMSTYLE = 1 << 15,
-	MRN_FLAG_MENUSTYLE = 1 << 16,
-	MRN_FLAG_PROFILE = 1 << 17,
-	MRN_FLAG_PROGRESSBARSTYLE = 1 << 18,
-	MRN_FLAG_RELIEFSTYLE = 1 << 19,
-	MRN_FLAG_RGBA = 1 << 20,
-	MRN_FLAG_ROUNDNESS = 1 << 21,
-	MRN_FLAG_SCROLLBAR_COLOR = 1 << 22,
-	MRN_FLAG_SCROLLBARSTYLE = 1 << 23,
-	MRN_FLAG_SLIDERSTYLE = 1 << 24,
-	MRN_FLAG_STEPPERSTYLE = 1 << 25,
-	MRN_FLAG_TOOLBARSTYLE = 1 << 26
+	MRN_FLAG_FOCUS_COLOR = 1 << 3,
+	MRN_FLAG_GLAZESTYLE = 1 << 4,
+	MRN_FLAG_GLOW_SHADE = 1 << 5,
+	MRN_FLAG_GLOWSTYLE = 1 << 6,
+	MRN_FLAG_GRADIENT_SHADES = 1 << 7,
+	MRN_FLAG_GRADIENTS = 1 << 8,
+	MRN_FLAG_HIGHLIGHT_SHADE = 1 << 9,
+	MRN_FLAG_LIGHTBORDER_SHADE = 1 << 10,
+	MRN_FLAG_LIGHTBORDERSTYLE= 1 << 11,
+	MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 12,
+	MRN_FLAG_LISTVIEWSTYLE = 1 << 13,
+	MRN_FLAG_MENUBARITEMSTYLE = 1 << 14,
+	MRN_FLAG_MENUBARSTYLE = 1 << 15,
+	MRN_FLAG_MENUITEMSTYLE = 1 << 16,
+	MRN_FLAG_MENUSTYLE = 1 << 17,
+	MRN_FLAG_PROFILE = 1 << 18,
+	MRN_FLAG_PROGRESSBARSTYLE = 1 << 19,
+	MRN_FLAG_RELIEFSTYLE = 1 << 20,
+	MRN_FLAG_RGBA = 1 << 21,
+	MRN_FLAG_ROUNDNESS = 1 << 22,
+	MRN_FLAG_SCROLLBAR_COLOR = 1 << 23,
+	MRN_FLAG_SCROLLBARSTYLE = 1 << 24,
+	MRN_FLAG_SLIDERSTYLE = 1 << 25,
+	MRN_FLAG_STEPPERSTYLE = 1 << 26,
+	MRN_FLAG_TOOLBARSTYLE = 1 << 27
 } MurrineRcFlags;
 
 struct _MurrineRcStyle
@@ -94,11 +95,13 @@
 	guint8   toolbarstyle;
 
 	gboolean animation;
-	gboolean gradients;
 	gboolean colorize_scrollbar;
+	gboolean gradients;
+	gboolean has_focus_color;
 	gboolean has_scrollbar_color;
 	gboolean rgba;
 
+	GdkColor focus_color;
 	GdkColor scrollbar_color;
 
 	MurrineProfiles profile;

Modified: trunk/src/murrine_style.c
==============================================================================
--- trunk/src/murrine_style.c	(original)
+++ trunk/src/murrine_style.c	Sun Feb 22 01:18:56 2009
@@ -726,7 +726,7 @@
 			                              width, height+offset, menubarstyle);
 	}
 	else if (DETAIL ("button") && widget && widget->parent &&
-	                 (MRN_IS_TREE_VIEW(widget->parent) ||
+	                 (MRN_IS_TREE_VIEW (widget->parent) ||
 	                  MRN_IS_CLIST (widget->parent)))
 	{
 		WidgetParameters params;
@@ -1715,6 +1715,7 @@
 		murrine_style->roundness       = MURRINE_RC_STYLE (rc_style)->roundness;
 	murrine_style->animation           = MURRINE_RC_STYLE (rc_style)->animation;
 	murrine_style->colorize_scrollbar  = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
+	murrine_style->has_focus_color     = MURRINE_RC_STYLE (rc_style)->has_focus_color;
 	murrine_style->glowstyle           = MURRINE_RC_STYLE (rc_style)->glowstyle;
 	murrine_style->gradients           = MURRINE_RC_STYLE (rc_style)->gradients;
 	murrine_style->has_scrollbar_color = MURRINE_RC_STYLE (rc_style)->has_scrollbar_color;
@@ -1733,6 +1734,8 @@
 	murrine_style->stepperstyle        = MURRINE_RC_STYLE (rc_style)->stepperstyle;
 	murrine_style->toolbarstyle        = MURRINE_RC_STYLE (rc_style)->toolbarstyle;
 
+	if (murrine_style->has_focus_color)
+		murrine_style->focus_color = MURRINE_RC_STYLE (rc_style)->focus_color;
 	if (murrine_style->has_scrollbar_color)
 		murrine_style->scrollbar_color = MURRINE_RC_STYLE (rc_style)->scrollbar_color;
 
@@ -1881,6 +1884,12 @@
                           GdkRectangle *area, GtkWidget *widget, const gchar *detail,
                           gint x, gint y, gint width, gint height)
 {
+	MurrineStyle *murrine_style = MURRINE_STYLE (style);
+	MurrineColors *colors = &murrine_style->colors;
+	WidgetParameters params;
+	FocusParameters focus;
+	guint8* dash_list;
+
 	cairo_t *cr;
 
 	CHECK_ARGS
@@ -1888,72 +1897,160 @@
 
 	cr = gdk_cairo_create (window);
 
-	gboolean free_dash_list = FALSE;
-	gint line_width = 1;
-	gint8 *dash_list = "\1\1";
+	murrine_set_widget_parameters (widget, style, state_type, &params);
 
-	if (widget)
+	/* Corners */
+	params.corners = MRN_CORNER_ALL;
+	if (widget && widget->parent && MRN_IS_COMBO_BOX_ENTRY(widget->parent))
 	{
-		gtk_widget_style_get (widget,
-		                     "focus-line-width", &line_width,
-		                     "focus-line-pattern",
-		                     (gchar *) & dash_list, NULL);
+		if (params.ltr)
+			params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
+		else
+			params.corners = MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT;
 
-		free_dash_list = TRUE;
+		if (params.xthickness > 2)
+		{
+			if (params.ltr)
+				x--;
+			width++;
+		}
 	}
 
-	if (detail && !strcmp (detail, "add-mode"))
-	{
-		if (free_dash_list)
-			g_free (dash_list);
+	focus.has_color = FALSE;
+	focus.interior = FALSE;
+	focus.line_width = 1;
+	focus.padding = 1;
+	dash_list = NULL;
 
-		dash_list = "\4\4";
-		free_dash_list = FALSE;
+	if (widget)
+	{
+		gtk_widget_style_get (widget,
+		                      "focus-line-width", &focus.line_width,
+		                      "focus-line-pattern", &dash_list,
+		                      "focus-padding", &focus.padding,
+		                      "interior-focus", &focus.interior,
+		                      NULL);
 	}
-
-	if (detail && !strcmp (detail, "colorwheel_light"))
-		cairo_set_source_rgb (cr, 0., 0., 0.);
-	else if (detail && !strcmp (detail, "colorwheel_dark"))
-		cairo_set_source_rgb (cr, 1., 1., 1.);
+	if (dash_list)
+		focus.dash_list = dash_list;
 	else
-		gdk_cairo_set_source_color_alpha (cr, &style->fg[state_type], 0.7);
+		focus.dash_list = (guint8*) g_strdup ("\1\1");
 
-	cairo_set_line_width (cr, line_width);
-
-	if (dash_list[0])
+	/* Focus type */
+	if (DETAIL("button"))
 	{
-		gint n_dashes = strlen (dash_list);
-		gdouble *dashes = g_new (gdouble, n_dashes);
-		gdouble total_length = 0;
-		gdouble dash_offset;
-		gint i;
+		if (widget && widget->parent &&
+	                 (MRN_IS_TREE_VIEW (widget->parent) ||
+	                  MRN_IS_CLIST (widget->parent)))
+		{
+			focus.type = MRN_FOCUS_TREEVIEW_HEADER;
+		}
+		else
+		{
+			GtkReliefStyle relief = GTK_RELIEF_NORMAL;
+			/* Check for the shadow type. */
+			if (widget && GTK_IS_BUTTON (widget))
+				g_object_get (G_OBJECT (widget), "relief", &relief, NULL);
+
+			if (relief == GTK_RELIEF_NORMAL)
+				focus.type = MRN_FOCUS_BUTTON;
+			else
+				focus.type = MRN_FOCUS_BUTTON_FLAT;
+
+			/* This is a workaround for the bogus focus handling that
+			 * clearlooks has currently.
+			 * I truely dislike putting it here, but I guess it is better
+			 * then having such a visible bug. It should be removed in the
+			 * next unstable release cycle.  -- Benjamin
+			if (ge_object_is_a (G_OBJECT (widget), "ButtonWidget"))
+				focus.type = MRN_FOCUS_LABEL; */
+		}
+	}
+	else if (detail && g_str_has_prefix (detail, "treeview"))
+	{
+		/* Focus in a treeview, and that means a lot of different detail strings. */
+		if (g_str_has_prefix (detail, "treeview-drop-indicator"))
+			focus.type = MRN_FOCUS_TREEVIEW_DND;
+		else
+			focus.type = MRN_FOCUS_TREEVIEW_ROW;
 
-		for (i = 0; i < n_dashes; i++)
+		if (g_str_has_suffix (detail, "left"))
 		{
-			dashes[i] = dash_list[i];
-			total_length += dash_list[i];
+			focus.continue_side = MRN_CONT_RIGHT;
 		}
+		else if (g_str_has_suffix (detail, "right"))
+		{
+			focus.continue_side = MRN_CONT_LEFT;
+		}
+		else if (g_str_has_suffix (detail, "middle"))
+		{
+			focus.continue_side = MRN_CONT_LEFT | MRN_CONT_RIGHT;
+		}
+		else
+		{
+			/* This may either mean no continuation, or unknown ...
+			 * if it is unknown we assume it continues on both sides */
+			gboolean row_ending_details = FALSE;
+
+			/* Try to get the style property. */
+			if (widget)
+				gtk_widget_style_get (widget,
+				                      "row-ending-details", &row_ending_details,
+				                      NULL);
 
-		dash_offset = -line_width/2.;
-		while (dash_offset < 0)
-			dash_offset += total_length;
+			if (row_ending_details)
+				focus.continue_side = MRN_CONT_NONE;
+			else
+				focus.continue_side = MRN_CONT_LEFT | MRN_CONT_RIGHT;
+		}
 
-		cairo_set_dash (cr, dashes, n_dashes, dash_offset);
-		g_free (dashes);
+	}
+	else if (detail && g_str_has_prefix (detail, "trough") && MRN_IS_SCALE (widget)) //CHECK_HINT (GE_HINT_SCALE)*/)
+	{
+		focus.type = MRN_FOCUS_SCALE;
+	}
+	else if (DETAIL("tab"))
+	{
+		focus.type = MRN_FOCUS_TAB;
+	}
+	else if (detail && g_str_has_prefix (detail, "colorwheel"))
+	{
+		if (DETAIL ("colorwheel_dark"))
+			focus.type = MRN_FOCUS_COLOR_WHEEL_DARK;
+		else
+			focus.type = MRN_FOCUS_COLOR_WHEEL_LIGHT;
+	}
+	else if (DETAIL("checkbutton") || DETAIL("radiobutton") || DETAIL("expander"))
+	{
+		focus.type = MRN_FOCUS_LABEL; /* Let's call it "LABEL" :) */
+	}
+	else if (widget && MRN_IS_TREE_VIEW (widget))
+	{
+		focus.type = MRN_FOCUS_TREEVIEW; /* Treeview without content is focused. */
+	}
+	else if (DETAIL("icon_view"))
+	{
+		focus.type = MRN_FOCUS_ICONVIEW;
+	}
+	else
+	{
+		focus.type = MRN_FOCUS_UNKNOWN; /* Custom widgets (Beagle) and something unknown */
 	}
 
-	if (area)
+	/* Focus color */
+	if (murrine_style->has_focus_color)
 	{
-		gdk_cairo_rectangle (cr, area);
-		cairo_clip (cr);
+		murrine_gdk_color_to_rgb (&murrine_style->focus_color, &focus.color.r, &focus.color.g, &focus.color.b);
+		focus.has_color = TRUE;
 	}
+	else
+		focus.color = colors->bg[GTK_STATE_SELECTED];
 
-	cairo_rectangle (cr, x+line_width/2., y+line_width/2., width-line_width, height-line_width);
-	cairo_stroke (cr);
-	cairo_destroy (cr);
+	STYLE_FUNCTION(draw_focus) (cr, colors, &params, &focus, x, y, width, height);
+
+	g_free (focus.dash_list);
 
-	if (free_dash_list)
-		g_free (dash_list);
+	cairo_destroy (cr);
 }
 
 static void
@@ -1965,6 +2062,7 @@
 	mrn_style->animation           = mrn_src->animation;
 	mrn_style->colorize_scrollbar  = mrn_src->colorize_scrollbar;
 	mrn_style->colors              = mrn_src->colors;
+	mrn_style->focus_color         = mrn_src->focus_color;	
 	mrn_style->glazestyle          = mrn_src->glazestyle;
 	mrn_style->glow_shade          = mrn_src->glow_shade;
 	mrn_style->glowstyle           = mrn_src->glowstyle;
@@ -1973,6 +2071,7 @@
 	mrn_style->gradient_shades[2]  = mrn_src->gradient_shades[2];
 	mrn_style->gradient_shades[3]  = mrn_src->gradient_shades[3];
 	mrn_style->gradients           = mrn_src->gradients;
+	mrn_style->has_focus_color     = mrn_src->has_focus_color;
 	mrn_style->has_scrollbar_color = mrn_src->has_scrollbar_color;
 	mrn_style->highlight_shade     = mrn_src->highlight_shade;
 	mrn_style->lightborder_shade   = mrn_src->lightborder_shade;

Modified: trunk/src/murrine_style.h
==============================================================================
--- trunk/src/murrine_style.h	(original)
+++ trunk/src/murrine_style.h	Sun Feb 22 01:18:56 2009
@@ -68,11 +68,13 @@
 	guint8   toolbarstyle;
 
 	gboolean animation;
-	gboolean gradients;
 	gboolean colorize_scrollbar;
+	gboolean gradients;
+	gboolean has_focus_color;
 	gboolean has_scrollbar_color;
 	gboolean rgba;
 
+	GdkColor focus_color;
 	GdkColor scrollbar_color;
 };
 

Modified: trunk/src/murrine_types.h
==============================================================================
--- trunk/src/murrine_types.h	(original)
+++ trunk/src/murrine_types.h	Sun Feb 22 01:18:56 2009
@@ -69,6 +69,13 @@
 
 typedef enum
 {
+	MRN_CONT_NONE          = 0,
+	MRN_CONT_LEFT          = 1 << 0,
+	MRN_CONT_RIGHT         = 1 << 1
+} MurrineContinue;
+
+typedef enum
+{
 	MRN_STEPPER_UNKNOWN    = 0,
 	MRN_STEPPER_A          = 1,
 	MRN_STEPPER_B          = 2,
@@ -122,6 +129,23 @@
 
 typedef enum
 {
+	MRN_FOCUS_BUTTON,
+	MRN_FOCUS_BUTTON_FLAT,
+	MRN_FOCUS_LABEL,
+	MRN_FOCUS_TREEVIEW,
+	MRN_FOCUS_TREEVIEW_HEADER,
+	MRN_FOCUS_TREEVIEW_ROW,
+	MRN_FOCUS_TREEVIEW_DND,
+	MRN_FOCUS_SCALE,
+	MRN_FOCUS_TAB,
+	MRN_FOCUS_COLOR_WHEEL_DARK,
+	MRN_FOCUS_COLOR_WHEEL_LIGHT,
+	MRN_FOCUS_ICONVIEW,
+	MRN_FOCUS_UNKNOWN
+} MurrineFocusType;
+
+typedef enum
+{
 	MRN_DIRECTION_UP,
 	MRN_DIRECTION_DOWN,
 	MRN_DIRECTION_LEFT,
@@ -206,6 +230,18 @@
 
 typedef struct
 {
+	MurrineFocusType    type;
+	MurrineContinue     continue_side;
+	MurrineRGB          color;
+	boolean             has_color;
+	gint                line_width;
+	gint                padding;
+	guint8*             dash_list;
+	boolean             interior;
+} FocusParameters;
+
+typedef struct
+{
 	boolean lower;
 	boolean horizontal;
 	boolean fill_level;
@@ -472,6 +508,12 @@
 	                          const WidgetParameters     *widget,
 	                          const ResizeGripParameters *grip,
 	                          int x, int y, int width, int height);
+
+	void (*draw_focus) (cairo_t *cr,
+	                    const MurrineColors    *colors,
+	                    const WidgetParameters *widget,
+	                    const FocusParameters  *focus,
+	                    int x, int y, int width, int height);
 };
 
 #define MURRINE_RECTANGLE_SET(rect, _x, _y, _w, _h) rect.x      = _x; \



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