[gtk+/gtk-style-context: 198/206] GtkThemingEngine: Animate checkboxes activation.



commit adb20c1cf978e8c98a614304ffc7aa4d748bc8b0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 19 22:47:02 2010 +0200

    GtkThemingEngine: Animate checkboxes activation.

 gtk/gtkthemingengine.c |   61 ++++++++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 25 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 8797ff8..cbf57bd 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -570,33 +570,44 @@ gtk_theming_engine_render_check (GtkThemingEngine *engine,
 		       line_thickness);
       cairo_fill (cr);
     }
-  else if (gtk_theming_engine_is_state_set (engine, GTK_STATE_ACTIVE, NULL))
+  else
     {
-      cairo_translate (cr,
-		       x + pad, y + pad);
-
-      cairo_scale (cr, interior_size / 7., interior_size / 7.);
-
-      cairo_move_to  (cr, 7.0, 0.0);
-      cairo_line_to  (cr, 7.5, 1.0);
-      cairo_curve_to (cr, 5.3, 2.0,
-		      4.3, 4.0,
-		      3.5, 7.0);
-      cairo_curve_to (cr, 3.0, 5.7,
-		      1.3, 4.7,
-		      0.0, 4.7);
-      cairo_line_to  (cr, 0.2, 3.5);
-      cairo_curve_to (cr, 1.1, 3.5,
-		      2.3, 4.3,
-		      3.0, 5.0);
-      cairo_curve_to (cr, 1.0, 3.9,
-		      2.4, 4.1,
-		      3.2, 4.9);
-      cairo_curve_to (cr, 3.5, 3.1,
-		      5.2, 2.0,
-		      7.0, 0.0);
+      gdouble progress;
+      gboolean active;
 
-      cairo_fill (cr);
+      active = gtk_theming_engine_is_state_set (engine, GTK_STATE_ACTIVE, &progress);
+
+      if (active || progress > 0)
+        {
+          cairo_translate (cr,
+                           x + pad, y + pad);
+
+          cairo_scale (cr, interior_size / 7., interior_size / 7.);
+
+          cairo_rectangle (cr, 0, 0, 7 * progress, 7);
+          cairo_clip (cr);
+
+          cairo_move_to  (cr, 7.0, 0.0);
+          cairo_line_to  (cr, 7.5, 1.0);
+          cairo_curve_to (cr, 5.3, 2.0,
+                          4.3, 4.0,
+                          3.5, 7.0);
+          cairo_curve_to (cr, 3.0, 5.7,
+                          1.3, 4.7,
+                          0.0, 4.7);
+          cairo_line_to  (cr, 0.2, 3.5);
+          cairo_curve_to (cr, 1.1, 3.5,
+                          2.3, 4.3,
+                          3.0, 5.0);
+          cairo_curve_to (cr, 1.0, 3.9,
+                          2.4, 4.1,
+                          3.2, 4.9);
+          cairo_curve_to (cr, 3.5, 3.1,
+                          5.2, 2.0,
+                          7.0, 0.0);
+
+          cairo_fill (cr);
+        }
     }
 
   cairo_restore (cr);



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