Add a test for interpretation of mark positions

This commit is contained in:
Matthias Clasen 2011-03-03 13:48:34 -05:00
parent 1442fe9694
commit 57fa43d44b

View File

@ -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);