[gtk+] Add a test for interpretation of mark positions



commit 57fa43d44b1b35b975c9b360a1961752bd0c7d0f
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Mar 3 13:48:34 2011 -0500

    Add a test for interpretation of mark positions

 tests/testscale.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/tests/testscale.c b/tests/testscale.c
index 0756607..6acb497 100755
--- a/tests/testscale.c
+++ b/tests/testscale.c
@@ -53,6 +53,9 @@ int main (int argc, char *argv[])
     "<span color='Red' size='small'>Hot</span>" 
   };
 
+  gdouble pos_marks[4] = { 0.0, 33.3, 66.6, 100.0 };
+  const gchar *pos_labels[4] = { "Left", "Right", "Top", "Bottom" };
+
   gtk_init (&argc, &argv);
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -107,6 +110,17 @@ int main (int argc, char *argv[])
   gtk_container_add (GTK_CONTAINER (frame), scale);
   gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
 
+  frame = gtk_frame_new ("Positions");
+  scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
+                                    0, 100, 1);
+  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[0], GTK_POS_LEFT, pos_labels[0]);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[1], GTK_POS_RIGHT, pos_labels[1]);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[2], GTK_POS_TOP, pos_labels[2]);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[3], GTK_POS_BOTTOM, pos_labels[3]);
+  gtk_container_add (GTK_CONTAINER (frame), scale);
+  gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
+
   frame = gtk_frame_new ("Show/hide trough");
   box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
   scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
@@ -171,6 +185,17 @@ int main (int argc, char *argv[])
   gtk_container_add (GTK_CONTAINER (frame), scale);
   gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
 
+  frame = gtk_frame_new ("Positions");
+  scale = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL,
+                                    0, 100, 1);
+  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[0], GTK_POS_LEFT, pos_labels[0]);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[1], GTK_POS_RIGHT, pos_labels[1]);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[2], GTK_POS_TOP, pos_labels[2]);
+  gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[3], GTK_POS_BOTTOM, pos_labels[3]);
+  gtk_container_add (GTK_CONTAINER (frame), scale);
+  gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
+
   gtk_container_add (GTK_CONTAINER (window), box);
   gtk_widget_show_all (window);
 



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