[gtk-theme-engine-clearlooks] Implement a bunch of render_background() and render_frame()



commit 427146367e6879c8cb3ac516e4ee9fe828553675
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 16 00:55:46 2010 +0100

    Implement a bunch of render_background() and render_frame()

 src/clearlooks_engine.c |  391 +++++++++++++++++++---------------------------
 1 files changed, 162 insertions(+), 229 deletions(-)
---
diff --git a/src/clearlooks_engine.c b/src/clearlooks_engine.c
index 94f4e2f..b471767 100644
--- a/src/clearlooks_engine.c
+++ b/src/clearlooks_engine.c
@@ -90,74 +90,60 @@ clearlooks_set_parameters (GtkThemingEngine *engine,
 #endif
 }
 
-#if 0
-
 static void
-clearlooks_style_draw_flat_box (DRAW_ARGS)
+clearlooks_engine_render_background (GtkThemingEngine *engine,
+				     cairo_t          *cr,
+				     gdouble           x,
+				     gdouble           y,
+				     gdouble           width,
+				     gdouble           height)
 {
-	if (detail &&
-	    state_type == GTK_STATE_SELECTED && (
-	    !strncmp ("cell_even", detail, 9) ||
-	    !strncmp ("cell_odd", detail, 8)))
-	{
-		WidgetParameters params;
-		ClearlooksStyle  *clearlooks_style;
-		ClearlooksColors *colors;
+	ClearlooksStyleFunctions  *style_functions;
+	ClearlooksStyle style;
+	GtkStateFlags state;
 
-		CHECK_ARGS
+	GE_CAIRO_INIT
 
-		clearlooks_style = CLEARLOOKS_STYLE (style);
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-		colors = &clearlooks_style->colors;
+	state = gtk_theming_engine_get_state (engine);
+	clearlooks_lookup_functions (CLEARLOOKS_ENGINE (engine),
+				     &style_functions, NULL);
+	gtk_theming_engine_get (engine, state,
+				"-clearlooks-style", &style,
+				NULL);
 
+	if ((state & GTK_STATE_FLAG_SELECTED) &&
+	    gtk_theming_engine_has_class (engine, "cell"))
+	{
 		/* XXX: We could expose the side details by setting params->corners accordingly
 		 *      or adding another option. */
-		STYLE_FUNCTION (draw_selected_cell) (cr, colors, &params, x, y, width, height);
+		style_functions->draw_selected_cell (cr, engine, x, y, width, height);
 	}
-	else if (DETAIL ("tooltip"))
+	else if (gtk_theming_engine_has_class (engine, "tooltip"))
 	{
-		WidgetParameters params;
-		ClearlooksStyle  *clearlooks_style;
-		ClearlooksColors *colors;
-
-		CHECK_ARGS
-
-		clearlooks_style = CLEARLOOKS_STYLE (style);
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-		colors = &clearlooks_style->colors;
-
-		STYLE_FUNCTION (draw_tooltip) (cr, colors, &params, x, y, width, height);
+		style_functions->draw_tooltip (cr, engine, x, y, width, height);
 	}
-	else if (DETAIL ("icon_view_item"))
+	else if (gtk_theming_engine_has_class (engine, "cell") &&
+		 gtk_theming_engine_has_class (engine, "icon-view"))
 	{
-		WidgetParameters params;
-		ClearlooksStyle  *clearlooks_style;
-		ClearlooksColors *colors;
-
-		CHECK_ARGS
-
-		clearlooks_style = CLEARLOOKS_STYLE (style);
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-		colors = &clearlooks_style->colors;
-
-		STYLE_FUNCTION (draw_icon_view_item) (cr, colors, &params, x, y, width, height);
+		style_functions->draw_icon_view_item (cr, engine, x, y, width, height);
 	}
-	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))
+	else if ((state & GTK_STATE_FLAG_PRELIGHT) &&
+		 (style == CLEARLOOKS_STYLE_GLOSSY || style == CLEARLOOKS_STYLE_GUMMY) &&
+		 (gtk_theming_engine_has_class (engine, "check") || gtk_theming_engine_has_class (engine, "radio")))
 	{
 		/* XXX: Don't draw any check/radiobutton bg in GLOSSY or GUMMY mode. */
 	}
 	else
 	{
-		GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_flat_box (style, cr, state_type,
-		                                        shadow_type,
-		                                        widget, detail,
-		                                        x, y, width, height);
+		GTK_THEMING_ENGINE_CLASS (clearlooks_engine_parent_class)->render_background (engine, cr,
+											      x, y, width, height);
 	}
 }
 
+#if 0
+
 static void
-clearlooks_style_draw_shadow (DRAW_ARGS)
+clearlooks_engine_render_shadow (DRAW_ARGS)
 {
 	ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
 	ClearlooksColors *colors = &clearlooks_style->colors;
@@ -462,34 +448,45 @@ clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
 		                             x, y, width, height);
 	}
 }
+#endif
 
 static void
-clearlooks_style_draw_box (DRAW_ARGS)
+clearlooks_engine_render_frame (GtkThemingEngine *engine,
+				cairo_t          *cr,
+				gdouble           x,
+				gdouble           y,
+				gdouble           width,
+				gdouble           height)
 {
-	ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
-	const ClearlooksColors *colors;
+	ClearlooksStyleFunctions *style_functions;
+	const GtkWidgetPath *path;
+	GtkTextDirection direction;
+	GtkStateFlags state;
 
-	colors = &clearlooks_style->colors;
+	GE_CAIRO_INIT
 
-	CHECK_ARGS
+	clearlooks_lookup_functions (CLEARLOOKS_ENGINE (engine),
+				     &style_functions, NULL);
+	state = gtk_theming_engine_get_state (engine);
+	path = gtk_theming_engine_get_path (engine);
+	direction = gtk_theming_engine_get_direction (engine);
 
-	if (DETAIL ("menubar"))
+	if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENUBAR))
 	{
 		WidgetParameters params;
 		MenuBarParameters menubar;
 		gboolean horizontal;
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
-		menubar.style = clearlooks_style->menubarstyle;
+		menubar.style = 0; //clearlooks_style->menubarstyle;
 
 		horizontal = height < 2*width;
 		/* This is not that great. Ideally we would have a nice vertical menubar. */
-		if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
-			STYLE_FUNCTION(draw_menubar) (cr, colors, &params, &menubar,
-			                              x, y, width, height);
+		if (horizontal)
+			style_functions->draw_menubar (cr, engine, &menubar,
+						       x, y, width, height);
 	}
-	else if (DETAIL ("button") && CHECK_HINT (GE_HINT_TREEVIEW_HEADER))
+	else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) &&
+		 gtk_theming_engine_has_class (engine, GTK_STYLE_REGION_COLUMN_HEADER))
 	{
 		WidgetParameters params;
 		ListViewHeaderParameters header;
@@ -501,10 +498,9 @@ clearlooks_style_draw_box (DRAW_ARGS)
 		columns = 3;
 		column_index = 1;
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
 		params.corners = CR_CORNER_NONE;
 
+#if 0
 		if (GE_IS_TREE_VIEW (gtk_widget_get_parent (widget)))
 		{
 			clearlooks_treeview_get_header_index (GTK_TREE_VIEW(gtk_widget_get_parent (widget)),
@@ -521,24 +517,16 @@ clearlooks_style_draw_box (DRAW_ARGS)
 			header.order |= params.ltr ? CL_ORDER_LAST : CL_ORDER_FIRST;
 
 		gtk_style_apply_default_background (style, cr, gtk_widget_get_window (widget), state_type, x, y, width, height);
+#endif
 
-		STYLE_FUNCTION(draw_list_view_header) (cr, colors, &params, &header,
-		                                       x, y, width, height);
-	}
-	else if (DETAIL ("buttondefault"))
-	{
-		/* We are already checking the default button with the
-		 * "clearlooks_set_widget_parameters" function, so we may occur
-		 * in drawing the button two times. Let's return then.
-		 */
+		style_functions->draw_list_view_header (cr, engine, &header,
+							x, y, width, height);
 	}
-	else if (DETAIL ("button"))
+	else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON))
 	{
-	
 		WidgetParameters params;
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-		params.active = shadow_type == GTK_SHADOW_IN;
 
+#if 0
 		if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY))
 		{
 			if (params.ltr)
@@ -559,46 +547,22 @@ clearlooks_style_draw_box (DRAW_ARGS)
 			if (clearlooks_style->reliefstyle != 0)
 				params.enable_shadow = TRUE;
 		}
+#endif
 
-		if (shadow_type != GTK_SHADOW_ETCHED_IN)
-		{
-			STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, &params,
-			                             x, y, width, height);
-		}
-		else
-		{
-			cairo_save (cr);
-			cairo_move_to (cr, x, y);
-			cairo_line_to (cr, x + width, y);
-			cairo_line_to (cr, x, y + height);
-			cairo_close_path (cr);
-			cairo_clip (cr);
-			params.active = TRUE;
-			params.state_type = GTK_STATE_ACTIVE;
-			STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, &params,
-			                             x, y, width, height);
-			cairo_restore (cr);
-
-			cairo_save (cr);
-			cairo_move_to (cr, x + width, y);
-			cairo_line_to (cr, x + width, y + height);
-			cairo_line_to (cr, x, y + height);
-			cairo_close_path (cr);
-			cairo_clip (cr);
-			params.active = FALSE;
-			params.state_type = GTK_STATE_NORMAL;
-			STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, &params,
-			                             x, y, width, height);
-			cairo_restore (cr);
-		}
+		style_functions->draw_button (cr, engine,
+					      x, y, width, height);
 	}
-	else if (DETAIL ("spinbutton_up") || DETAIL ("spinbutton_down"))
+	else if (gtk_theming_engine_has_class (engine, "spinbutton") &&
+		 gtk_theming_engine_has_class (engine, "button"))
 	{
-		if (state_type == GTK_STATE_ACTIVE)
+		if (state & GTK_STATE_FLAG_ACTIVE)
 		{
-			WidgetParameters params;
-			clearlooks_set_widget_parameters (widget, style, state_type, &params);
+			GtkJunctionSides sides;
+			GtkTextDirection direction;
 
+			sides = gtk_theming_engine_get_junction_sides (engine);
+			direction = gtk_theming_engine_get_direction (engine);
+#if 0
 			if (style->xthickness == 3)
 			{
 				width++;
@@ -606,36 +570,29 @@ clearlooks_style_draw_box (DRAW_ARGS)
 					x--;
 			}
 
-			if (DETAIL ("spinbutton_up"))
+			if (sides & GTK_JUNCTION_BOTTOM)
 			{
 				height+=2;
-				if (params.ltr)
+				if (direction == GTK_TEXT_DIR_LTR)
 					params.corners = CR_CORNER_TOPRIGHT;
 				else
 					params.corners = CR_CORNER_TOPLEFT;
 			}
 			else
 			{
-				if (params.ltr)
+				if (direction == GTK_TEXT_DIR_LTR)
 					params.corners = CR_CORNER_BOTTOMRIGHT;
 				else
 					params.corners = CR_CORNER_BOTTOMLEFT;
 			}
+#endif
 
-			STYLE_FUNCTION(draw_spinbutton_down) (cr, &clearlooks_style->colors, &params, x, y, width, height);
+			style_functions->draw_spinbutton_down (cr, engine, x, y, width, height);
 		}
 	}
-	else if (DETAIL ("spinbutton"))
+	else if (gtk_theming_engine_has_class (engine, "spinbutton"))
 	{
-		WidgetParameters params;
-
-		/* The "spinbutton" box is always drawn with state NORMAL, even if it is insensitive.
-		 * So work around this here. */
-		if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
-			state_type = gtk_widget_get_state (widget);
-
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+#if 0
 		if (params.ltr)
 			params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
 		else
@@ -647,38 +604,41 @@ clearlooks_style_draw_box (DRAW_ARGS)
 				x--;
 			width++;
 		}
+#endif
 
-		STYLE_FUNCTION(draw_spinbutton) (cr, &clearlooks_style->colors, &params,
-		                                 x, y, width, height);
+		style_functions->draw_spinbutton (cr, engine,
+						  x, y, width, height);
 	}
-	else if (detail && g_str_has_prefix (detail, "trough") && CHECK_HINT (GE_HINT_SCALE))
+	else if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE) &&
+		 gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH))
 	{
-		WidgetParameters params;
 		SliderParameters slider;
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
+#if 0
 		params.corners    = CR_CORNER_NONE;
 
 		slider.lower = DETAIL ("trough-lower");
 		slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full");
+#endif
+		slider.lower = FALSE;
+		slider.fill_level = gtk_theming_engine_has_class (engine, "scale");
 
+#if 0
 		if (CHECK_HINT (GE_HINT_HSCALE))
 			slider.horizontal = TRUE;
 		else if (CHECK_HINT (GE_HINT_VSCALE))
 			slider.horizontal = FALSE;
 		else /* Fallback based on the size... */
+#endif
 			slider.horizontal = width >= height;
 
-		STYLE_FUNCTION(draw_scale_trough) (cr, &clearlooks_style->colors,
-		                                   &params, &slider,
-		                                   x, y, width, height);
+		style_functions->draw_scale_trough (cr, engine, &slider,
+						    x, y, width, height);
 	}
-	else if (DETAIL ("trough") && CHECK_HINT (GE_HINT_PROGRESSBAR))
+	else if (gtk_widget_path_is_type (path, GTK_TYPE_PROGRESS_BAR) &&
+		 gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH))
 	{
-		WidgetParameters params;
-
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+#if 0
 		/* Fill the background as it is initilized to base[NORMAL].
 		 * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513476
 		 * The fill only happens if no hint has been added by some application
@@ -689,31 +649,31 @@ clearlooks_style_draw_box (DRAW_ARGS)
 			ge_cairo_set_color (cr, &params.parentbg);
 			cairo_fill (cr);
 		}
-		STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, &params,
-		                                         x, y, width, height);
+#endif
+		style_functions->draw_progressbar_trough (cr, engine,
+							  x, y, width, height);
 	}
-	else if ((DETAIL ("trough-upper") || DETAIL ("trough-lower")) && CHECK_HINT (GE_HINT_SCROLLBAR))
+	else if (gtk_widget_path_is_type (path, GTK_TYPE_SCROLLBAR) &&
+		 gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH))
 	{
-		WidgetParameters params;
 		ScrollBarParameters scrollbar;
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-		params.corners = CR_CORNER_ALL;
-
 		scrollbar.horizontal = TRUE;
-		scrollbar.junction   = clearlooks_scrollbar_get_junction (widget);
-		
+		scrollbar.junction   = 0; //clearlooks_scrollbar_get_junction (widget);
+
+#if 0
 		if (CHECK_HINT (GE_HINT_HSCROLLBAR))
 			scrollbar.horizontal = TRUE;
 		else if (CHECK_HINT (GE_HINT_VSCROLLBAR))
 			scrollbar.horizontal = FALSE;
 		else /* Fallback based on the size  ... */
+#endif
 			scrollbar.horizontal = width >= height;
 
-		STYLE_FUNCTION(draw_scrollbar_trough) (cr, colors, &params, &scrollbar,
-		                                       x, y, width, height);
+		style_functions->draw_scrollbar_trough (cr, engine, &scrollbar,
+							x, y, width, height);
 	}
-	else if (DETAIL ("bar"))
+	else if (gtk_theming_engine_has_class (engine, "progressbar"))
 	{
 		WidgetParameters      params;
 		ProgressBarParameters progressbar;
@@ -729,8 +689,7 @@ clearlooks_style_draw_box (DRAW_ARGS)
 		elapsed = clearlooks_animation_elapsed (widget);
 #endif
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+#if 0
 		if (widget && GE_IS_PROGRESS_BAR (widget))
 		{
                         if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)))
@@ -752,13 +711,14 @@ clearlooks_style_draw_box (DRAW_ARGS)
 			progressbar.pulsing = FALSE;
 		}
 		else
+#endif
 		{
 			progressbar.orientation = CL_ORIENTATION_LEFT_TO_RIGHT;
 			progressbar.value = 0;
 			progressbar.pulsing = FALSE;
 		}
 
-		if (!params.ltr)
+		if (direction == GTK_TEXT_DIR_RTL)
 		{
 			if (progressbar.orientation == CL_ORIENTATION_LEFT_TO_RIGHT)
 				progressbar.orientation = CL_ORIENTATION_RIGHT_TO_LEFT;
@@ -809,23 +769,21 @@ clearlooks_style_draw_box (DRAW_ARGS)
 			cairo_clip (cr);
 		}
 #endif
-
-		STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, &params, &progressbar,
-		                                       x, y, width, height,
-		                                       10 - (int)(elapsed * 10.0) % 10);
+		style_functions->draw_progressbar_fill (cr, engine, &progressbar,
+							x, y, width, height,
+							10 - (int)(elapsed * 10.0) % 10);
 	}
-	else if (DETAIL ("entry-progress"))
+	else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_ENTRY) &&
+		 gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_PROGRESSBAR))
 	{
-		WidgetParameters params;
 		EntryProgressParameters progress;
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
 		progress.max_size_known = FALSE;
 		progress.max_size.x = 0;
 		progress.max_size.y = 0;
 		progress.max_size.width = 0;
 		progress.max_size.height = 0;
+#if 0
 		progress.border.left = style->xthickness;
 		progress.border.right = style->xthickness;
 		progress.border.top = style->ythickness;
@@ -906,72 +864,49 @@ clearlooks_style_draw_box (DRAW_ARGS)
 				}
 			}
 		}
+#endif
 
-		STYLE_FUNCTION(draw_entry_progress) (cr, colors, &params, &progress,
-		                                     x, y, width, height);
-	}
-	else if (DETAIL ("optionmenu"))
-	{
-		WidgetParameters params;
-		OptionMenuParameters optionmenu;
-
-		GtkRequisition indicator_size;
-		GtkBorder indicator_spacing;
-
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
-		if (clearlooks_style->reliefstyle != 0)
-			params.enable_shadow = TRUE;
-
-		ge_option_menu_get_props (widget, &indicator_size, &indicator_spacing);
-
-		if (ge_widget_is_ltr (widget))
-			optionmenu.linepos = width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - 1;
-		else
-			optionmenu.linepos = (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + 1;
-
-		STYLE_FUNCTION(draw_optionmenu) (cr, colors, &params, &optionmenu,
-		                                 x, y, width, height);
+		style_functions->draw_entry_progress (cr, engine, &progress,
+						      x, y, width, height);
 	}
-	else if (DETAIL ("menuitem"))
+	else if (gtk_theming_engine_has_class (engine, "menuitem"))
 	{
-		WidgetParameters params;
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
-		if (CHECK_HINT (GE_HINT_MENUBAR))
+		if (gtk_theming_engine_has_class (engine, "menubar"))
 		{
+#if 0
 			params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
+#endif
 			height += 1;
-			STYLE_FUNCTION(draw_menubaritem) (cr, colors, &params, x, y, width, height);
+			style_functions->draw_menubaritem (cr, engine, x, y, width, height);
 		}
 		else
 		{
+#if 0
 			params.corners = CR_CORNER_ALL;
-			STYLE_FUNCTION(draw_menuitem) (cr, colors, &params, x, y, width, height);
+#endif
+			style_functions->draw_menuitem (cr, engine, x, y, width, height);
 		}
 	}
-	else if (detail && (g_str_has_prefix (detail, "hscrollbar") || g_str_has_prefix (detail, "vscrollbar"))) /* This can't be "stepper" for scrollbars ... */
+	else if (gtk_theming_engine_has_class (engine, "scrollbar"))
 	{
-		WidgetParameters    params;
 		ScrollBarParameters scrollbar;
 		ScrollBarStepperParameters stepper;
-		GdkRectangle this_rectangle;
-
-		this_rectangle.x = x;
-		this_rectangle.y = y;
-		this_rectangle.width  = width;
-		this_rectangle.height = height;
-
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-		params.corners = CR_CORNER_NONE;
+		gboolean colorize_scrollbar;
+		CairoColor *scrollbar_color;
 
 		scrollbar.has_color  = FALSE;
 		scrollbar.horizontal = TRUE;
-		scrollbar.junction   = clearlooks_scrollbar_get_junction (widget);
+		scrollbar.junction   = 0; //clearlooks_scrollbar_get_junction (widget);
+
+		gtk_theming_engine_get (engine, state,
+					"-clearlooks-colorize-scrollbar", &colorize_scrollbar,
+					"-clearlooks-scrollbar-color", &scrollbar_color,
+					NULL);
 
-		if (clearlooks_style->colorize_scrollbar || clearlooks_style->has_scrollbar_color)
+		if (colorize_scrollbar || scrollbar_color)
 			scrollbar.has_color = TRUE;
 
+#if 0
 		scrollbar.horizontal = g_str_has_prefix (detail, "hscrollbar");
 
 		if (g_str_equal(detail + 10, "_start"))
@@ -983,22 +918,24 @@ clearlooks_style_draw_box (DRAW_ARGS)
 		else if (g_str_equal(detail + 10, "_end_inner"))
 			stepper.stepper = CL_STEPPER_END_INNER;
 		else
+#endif
 			stepper.stepper = CL_STEPPER_UNKNOWN;
 
-		STYLE_FUNCTION(draw_scrollbar_stepper) (cr, colors, &params, &scrollbar, &stepper,
-		                                        x, y, width, height);
+		style_functions->draw_scrollbar_stepper (cr, engine, &scrollbar, &stepper,
+							 x, y, width, height);
+
+		gdk_rgba_free ((GdkRGBA *) scrollbar_color);
 	}
-	else if (DETAIL ("toolbar") || DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin"))
+	else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TOOLBAR) ||
+		 gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_DOCK))
 	{
-		WidgetParameters  params;
 		ToolbarParameters toolbar;
 		gboolean horizontal;
 
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-		clearlooks_set_toolbar_parameters (&toolbar, widget, x, y);
-
-		toolbar.style = clearlooks_style->toolbarstyle;
+		//clearlooks_set_toolbar_parameters (&toolbar, widget, x, y);
+		toolbar.style = 0; //clearlooks_style->toolbarstyle;
 
+#if 0
 		if ((DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin")) && GE_IS_BIN (widget))
 		{
 			GtkWidget* child = gtk_bin_get_child ((GtkBin*) widget);
@@ -1008,24 +945,18 @@ clearlooks_style_draw_box (DRAW_ARGS)
 			if (GE_IS_TOOLBAR (child))
 				gtk_widget_style_get (child, "shadow-type", &shadow_type, NULL);
 		}
-		
+#endif
+
 		horizontal = height < 2*width;
 		/* This is not that great. Ideally we would have a nice vertical toolbar. */
-		if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
-			STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
+		if (horizontal)
+			style_functions->draw_toolbar (cr, engine, &toolbar, x, y, width, height);
 	}
-	else if (DETAIL ("trough"))
+	else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENU))
 	{
-		/* Nothing? Why benjamin? */
-	}
-	else if (DETAIL ("menu"))
-	{
-		WidgetParameters params;
-
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
-		STYLE_FUNCTION(draw_menu_frame) (cr, colors, &params, x, y, width, height);
+		style_functions->draw_menu_frame (cr, engine, x, y, width, height);
 	}
+#if 0
 	else if (DETAIL ("hseparator") || DETAIL ("vseparator"))
 	{
 		gchar *new_detail = (gchar*) detail;
@@ -1046,13 +977,13 @@ clearlooks_style_draw_box (DRAW_ARGS)
 			gtk_paint_vline (style, cr, state_type, widget, new_detail,
 			                       y, y + height - 1, x + width/2);
 	}
+#endif
 	else
 	{
-		GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_box (style, cr, state_type, shadow_type,
-		                                   widget, detail, x, y, width, height);
+		GTK_THEMING_ENGINE_CLASS (clearlooks_engine_parent_class)->render_frame (engine, cr,
+											 x, y, width, height);
 	}
 }
-#endif
 
 static void
 clearlooks_engine_render_slider (GtkThemingEngine *engine,
@@ -1766,6 +1697,8 @@ clearlooks_engine_class_init (ClearlooksEngineClass * klass)
 	engine_class->render_check = clearlooks_engine_render_check;
 	engine_class->render_option = clearlooks_engine_render_option;
 	engine_class->render_slider = clearlooks_engine_render_slider;
+	engine_class->render_background = clearlooks_engine_render_background;
+	engine_class->render_frame = clearlooks_engine_render_frame;
 	engine_class->render_layout = clearlooks_engine_render_layout;
 	engine_class->render_icon_pixbuf = clearlooks_engine_render_icon_pixbuf;
 



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