[gtk-theme-engine-clearlooks/gtk-style-context: 7/21] Implement render_check()



commit 1e575e8cab8cdb24a0a250ed1a39b63943d94f81
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 16 00:52:35 2010 +0100

    Implement render_check()

 src/clearlooks_draw.c   |    7 ++++---
 src/clearlooks_engine.c |   28 +++++++++++++++++-----------
 2 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/src/clearlooks_draw.c b/src/clearlooks_draw.c
index 2cc2acb..db46343 100644
--- a/src/clearlooks_draw.c
+++ b/src/clearlooks_draw.c
@@ -2575,14 +2575,15 @@ clearlooks_draw_checkbox (cairo_t *cr,
 {
 	CairoColor *bg_color, border, dot;
 	gboolean inconsistent = FALSE;
-	gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+	gboolean draw_bullet;
 	GtkStateFlags state;
 	gdouble radius;
 
-	inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
+	state = gtk_theming_engine_get_state (engine);
+	inconsistent = (state & GTK_STATE_FLAG_INCONSISTENT) != 0;
+	draw_bullet = (state & GTK_STATE_FLAG_ACTIVE);
 	draw_bullet |= inconsistent;
 
-	state = gtk_theming_engine_get_state (engine);
 	gtk_theming_engine_get (engine, state,
 				"border-radius", &radius,
 				"background-color", &bg_color,
diff --git a/src/clearlooks_engine.c b/src/clearlooks_engine.c
index aa44709..a95e386 100644
--- a/src/clearlooks_engine.c
+++ b/src/clearlooks_engine.c
@@ -1139,29 +1139,34 @@ clearlooks_style_draw_option (DRAW_ARGS)
 
 	STYLE_FUNCTION(draw_radiobutton) (cr, colors, &params, &checkbox, x, y, width, height);
 }
+#endif
 
 static void
-clearlooks_style_draw_check (DRAW_ARGS)
+clearlooks_engine_render_check (GtkThemingEngine *engine,
+				cairo_t          *cr,
+				gdouble           x,
+				gdouble           y,
+				gdouble           width,
+				gdouble           height)
 {
-	ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
+	ClearlooksStyleFunctions *style_functions;
 	WidgetParameters params;
 	CheckboxParameters checkbox;
 
-	CHECK_ARGS
-
-	clearlooks_set_widget_parameters (widget, style, state_type, &params);
+	GE_CAIRO_INIT
 
 	params.corners = CR_CORNER_ALL;
 
-	checkbox.shadow_type = shadow_type;
-	checkbox.in_cell = DETAIL("cellcheck");
-
-	checkbox.in_menu = (widget && gtk_widget_get_parent (widget) && GTK_IS_MENU(gtk_widget_get_parent (widget)));
+	checkbox.in_cell = gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_CELL);
+	checkbox.in_menu = gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENU);
 
-	STYLE_FUNCTION(draw_checkbox) (cr, &clearlooks_style->colors, &params, &checkbox,
-	                               x, y, width, height);
+	clearlooks_lookup_functions (CLEARLOOKS_ENGINE (engine),
+				     &style_functions, NULL);
+	style_functions->draw_checkbox (cr, engine, &checkbox,
+					x, y, width, height);
 }
 
+#if 0
 static void
 clearlooks_style_draw_vline (GtkStyle               *style,
                              cairo_t                *cr,
@@ -1742,6 +1747,7 @@ clearlooks_engine_class_init (ClearlooksEngineClass * klass)
 	GtkThemingEngineClass *engine_class = GTK_THEMING_ENGINE_CLASS (klass);
 
 	engine_class->render_arrow = clearlooks_engine_render_arrow;
+	engine_class->render_check = clearlooks_engine_render_check;
 	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]