[egg-list-box/flow-box-enhancements] Add focus tests to test-flow-box



commit ca5e40627af35fb1652e8c796054d091977b3344
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 28 01:22:14 2013 -0400

    Add focus tests to test-flow-box

 test-flow-box.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/test-flow-box.c b/test-flow-box.c
index cbe5b5b..21129b0 100644
--- a/test-flow-box.c
+++ b/test-flow-box.c
@@ -22,6 +22,7 @@
 
 enum {
   SIMPLE_ITEMS = 0,
+  FOCUS_ITEMS,
   WRAPPY_ITEMS,
   STOCK_ITEMS,
   IMAGE_ITEMS
@@ -66,6 +67,54 @@ populate_flowbox_simple (EggFlowBox *flowbox)
 }
 
 static void
+populate_flowbox_focus (EggFlowBox *flowbox)
+{
+  GtkWidget *widget, *frame, *box;
+  gint i;
+  gboolean sensitive;
+
+  for (i = 0; i < 10; i++)
+    {
+      sensitive = TRUE;
+      frame = gtk_frame_new (NULL);
+
+      box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+      gtk_container_add (GTK_CONTAINER (frame), box);
+
+      widget = gtk_label_new ("Label");
+      gtk_container_add (GTK_CONTAINER (box), widget);
+
+      switch (i % 4)
+        {
+        case 0:
+          widget = gtk_entry_new ();
+          break;
+        case 1:
+          widget = gtk_button_new_with_label ("Button");
+          break;
+        case 2:
+          widget = gtk_label_new ("bla");
+          break;
+        case 3:
+          widget = gtk_label_new ("bla");
+          sensitive = FALSE;
+          break;
+        }
+
+      gtk_container_add (GTK_CONTAINER (box), widget);
+
+      if (i == 4)
+        gtk_container_add (GTK_CONTAINER (box), gtk_switch_new ());
+
+      gtk_widget_show_all (frame);
+
+      gtk_container_add (GTK_CONTAINER (flowbox), frame);
+      if (!sensitive)
+        gtk_widget_set_sensitive (gtk_widget_get_parent (frame), FALSE);
+    }
+}
+
+static void
 populate_flowbox_wrappy (EggFlowBox *flowbox)
 {
   GtkWidget *widget, *frame;
@@ -175,6 +224,8 @@ populate_items (EggFlowBox *flowbox)
 
   if (items_type == SIMPLE_ITEMS)
     populate_flowbox_simple (flowbox);
+  else if (items_type == FOCUS_ITEMS)
+    populate_flowbox_focus (flowbox);
   else if (items_type == WRAPPY_ITEMS)
     populate_flowbox_wrappy (flowbox);
   else if (items_type == STOCK_ITEMS)
@@ -581,6 +632,7 @@ create_window (void)
   /* Add Items control */
   widget = gtk_combo_box_text_new ();
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Simple");
+  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Focus");
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Wrappy");
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Stock");
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Images");


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