[gtk+] Add an activity example



commit 8d951476bfc7c3886c383796f2c7a67141fe11cc
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Nov 23 17:00:20 2010 -0500

    Add an activity example
    
    This doesn't work, since it trips up on num-steps not being
    available for GtkEventBox.

 tests/styleexamples.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/tests/styleexamples.c b/tests/styleexamples.c
index c43336f..248ca64 100644
--- a/tests/styleexamples.c
+++ b/tests/styleexamples.c
@@ -172,6 +172,27 @@ draw_cb_frame (GtkWidget *widget, cairo_t *cr)
   return TRUE;
 }
 
+/* FIXME: this doesn't work */
+static gboolean
+draw_cb_activity (GtkWidget *widget, cairo_t *cr)
+{
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (widget);
+  gtk_style_context_save (context);
+
+  gtk_style_context_add_class (context, "spinner");
+  gtk_style_context_set_state (context, 0);
+  gtk_render_activity (context, cr, 12, 12, 12, 12);
+  gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE);
+  gtk_render_activity (context, cr, 36, 12, 12, 12);
+
+  gtk_style_context_restore (context);
+
+  return TRUE;
+}
+
+
 static char *what;
 
 static gboolean
@@ -189,6 +210,8 @@ draw_cb (GtkWidget *widget, cairo_t *cr)
     return draw_cb_background (widget, cr);
   else if (strcmp (what, "frame") == 0)
     return draw_cb_frame (widget, cr);
+  else if (strcmp (what, "activity") == 0)
+    return draw_cb_activity (widget, cr);
 
   return FALSE;
 }



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