[gtk-theme-engine-clearlooks] Implement render_frame_gap()



commit 4deb9d0bd6da890f06c6f6daca1ab552ac4b6718
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 16 00:56:54 2010 +0100

    Implement render_frame_gap()
    
    At the moment only notebooks are handled.

 src/clearlooks_draw.c   |    7 +---
 src/clearlooks_engine.c |   65 +++++++++++++++++++++++++++++------------------
 src/clearlooks_types.h  |    2 +-
 3 files changed, 43 insertions(+), 31 deletions(-)
---
diff --git a/src/clearlooks_draw.c b/src/clearlooks_draw.c
index 7de185e..abc51cc 100644
--- a/src/clearlooks_draw.c
+++ b/src/clearlooks_draw.c
@@ -1356,7 +1356,7 @@ clearlooks_draw_frame            (cairo_t *cr,
                                   int x, int y, int width, int height)
 {
 	CairoColor *bg_color, dark;
-	const CairoColor *border = frame->border;
+	const CairoColor *border = &frame->border;
 	ClearlooksRectangle bevel_clip = {0, 0, 0, 0};
 	ClearlooksRectangle frame_clip = {0, 0, 0, 0};
 	double radius;
@@ -1368,14 +1368,11 @@ clearlooks_draw_frame            (cairo_t *cr,
 				NULL);
 
 	radius = MIN (radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
-	clearlook_lookup_shade (engine, 4, &dark);
+	clearlooks_lookup_shade (engine, 4, (GdkRGBA *) &dark);
 
 	ge_shade_color (bg_color, 1.05, &hilight);
 	gdk_rgba_free ((GdkRGBA *) bg_color);
 
-	if (frame->shadow == CL_SHADOW_NONE)
-		return;
-
 	if (frame->gap_x != -1)
 		clearlooks_get_frame_gap_clip (x, y, width, height,
 		                               frame, &bevel_clip, &frame_clip);
diff --git a/src/clearlooks_engine.c b/src/clearlooks_engine.c
index 375a0fd..4732485 100644
--- a/src/clearlooks_engine.c
+++ b/src/clearlooks_engine.c
@@ -254,31 +254,46 @@ clearlooks_engine_render_shadow (DRAW_ARGS)
 	}
 }
 
+#endif
+
 static void
-clearlooks_style_draw_box_gap (DRAW_ARGS,
-                               GtkPositionType gap_side,
-                               gint            gap_x,
-                               gint            gap_width)
+clearlooks_engine_render_frame_gap (GtkThemingEngine *engine,
+				    cairo_t          *cr,
+				    gdouble          x,
+				    gdouble          y,
+				    gdouble          width,
+				    gdouble          height,
+				    GtkPositionType  gap_side,
+				    gdouble          xy0_gap,
+				    gdouble          xy1_gap)
 {
-	ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
-	ClearlooksColors *colors = &clearlooks_style->colors;
-
-	CHECK_ARGS
+	GE_CAIRO_INIT
 
-	if (DETAIL ("notebook"))
+	if (gtk_theming_engine_has_class (engine, "notebook"))
 	{
-		WidgetParameters params;
+		ClearlooksStyleFunctions  *style_functions;
 		FrameParameters  frame;
 		gboolean start, end;
+		CairoColor *bg_color;
+		GtkStateFlags state;
+		gint radius;
 
-		frame.shadow    = shadow_type;
 		frame.gap_side  = gap_side;
-		frame.gap_x     = gap_x;
-		frame.gap_width = gap_width;
-		frame.border    = &colors->shade[5];
+		frame.gap_x     = xy0_gap;
+		frame.gap_width = xy1_gap - xy0_gap;
+		clearlooks_lookup_shade (engine, 5, (GdkRGBA *) &frame.border);
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
+		state = gtk_theming_engine_get_state (engine);
 
+		gtk_theming_engine_get (engine, state,
+					"background-color", &bg_color,
+					"border-radius", &radius,
+					NULL);
+
+		clearlooks_lookup_functions (CLEARLOOKS_ENGINE (engine),
+					     &style_functions, NULL);
+
+#if 0
 		clearlooks_get_notebook_tab_position (widget, &start, &end);
 
 		params.corners = CR_CORNER_ALL;
@@ -329,26 +344,25 @@ clearlooks_style_draw_box_gap (DRAW_ARGS,
 					params.corners ^= CR_CORNER_BOTTOMRIGHT;
 			break;
 		}
+#endif
 
 		/* Fill the background with bg[NORMAL] */
-		ge_cairo_rounded_rectangle (cr, x, y, width, height, params.radius, params.corners);
-		ge_cairo_set_color (cr, &colors->bg[GTK_STATE_NORMAL]);
+		ge_cairo_rounded_rectangle (cr, x, y, width, height, radius, 0); //params.corners);
+		ge_cairo_set_color (cr, bg_color);
 		cairo_fill (cr);
 
-		STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
-		                            x, y, width, height);
+		style_functions->draw_frame (cr, engine, &frame,
+					     x, y, width, height);
+
+		gdk_rgba_free ((GdkRGBA *) bg_color);
 	}
 	else
 	{
-		GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_box_gap (style, cr, state_type, shadow_type,
-		                                       widget, detail,
-		                                       x, y, width, height,
-		                                       gap_side, gap_x, gap_width);
+		GTK_THEMING_ENGINE_CLASS (clearlooks_engine_parent_class)->render_frame_gap (engine, cr, x, y, width, height,
+		                                       gap_side, xy0_gap, xy1_gap);
 	}
 }
 
-#endif
-
 static void
 clearlooks_engine_render_extension (GtkThemingEngine *engine,
 				    cairo_t          *cr,
@@ -1719,6 +1733,7 @@ clearlooks_engine_class_init (ClearlooksEngineClass * klass)
 	engine_class->render_extension = clearlooks_engine_render_extension;
 	engine_class->render_background = clearlooks_engine_render_background;
 	engine_class->render_frame = clearlooks_engine_render_frame;
+	engine_class->render_frame_gap = clearlooks_engine_render_frame_gap;
 	engine_class->render_layout = clearlooks_engine_render_layout;
 	engine_class->render_icon_pixbuf = clearlooks_engine_render_icon_pixbuf;
 
diff --git a/src/clearlooks_types.h b/src/clearlooks_types.h
index e41e461..68b374a 100644
--- a/src/clearlooks_types.h
+++ b/src/clearlooks_types.h
@@ -242,7 +242,7 @@ typedef struct
 	ClearlooksGapSide gap_side;
 	int gap_x;
 	int gap_width;
-	const CairoColor *border; /* maybe changes this to some other hint ... */
+	CairoColor border; /* maybe changes this to some other hint ... */
 } FrameParameters;
 
 typedef struct



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