Use gtk_scale_new_with_range() instead gtk_[v|h]scale_new_with_range()

This commit is contained in:
Javier Jardón 2010-10-30 02:01:27 +02:00
parent b3a7d401a1
commit 8177ad320e
7 changed files with 34 additions and 19 deletions

View File

@ -561,7 +561,8 @@ do_offscreen_window (GtkWidget *do_widget)
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
vbox = gtk_vbox_new (0, FALSE);
scale = gtk_hscale_new_with_range (0, G_PI/2, 0.01);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0, G_PI/2, 0.01);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
button = gtk_button_new_with_label ("A Button");

View File

@ -947,10 +947,12 @@ create_scales (void)
vbox = gtk_vbox_new (FALSE, 3);
hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox),
gtk_hscale_new_with_range (0.0, 100.0, 1.0),
gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0.0, 100.0, 1.0),
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox),
gtk_vscale_new_with_range (0.0, 100.0, 1.0),
gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL,
0.0, 100.0, 1.0),
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox),

View File

@ -76,7 +76,8 @@ test_slider_ranges (void)
{
GtkWidget *child;
GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: gtk_test_warp_slider");
GtkWidget *hscale = gtk_hscale_new_with_range (-50, +50, 5);
GtkWidget *hscale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
-50, +50, 5);
child = gtk_bin_get_child (GTK_BIN (window));
gtk_container_add (GTK_CONTAINER (child), hscale);

View File

@ -137,7 +137,8 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), vbox);
combo = gtk_combo_box_text_new ();
scale = gtk_hscale_new_with_range (0, 360, 1);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0, 360, 1);
label = gtk_label_new ("This label may be ellipsized\nto make it fit.");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "NONE");

View File

@ -2107,7 +2107,8 @@ create_rotated_label (GtkWidget *widget)
gtk_label_set_markup (GTK_LABEL (scale_label), "<i>Angle: </i>");
gtk_box_pack_start (GTK_BOX (scale_hbox), scale_label, FALSE, FALSE, 0);
hscale = gtk_hscale_new_with_range (0, 360, 5);
hscale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0, 360, 5);
g_signal_connect (hscale, "value-changed",
G_CALLBACK (on_angle_scale_changed), label);

View File

@ -310,9 +310,8 @@ main (int argc,
vbox = gtk_vbox_new (0, FALSE);
gtk_container_add (GTK_CONTAINER (window), vbox);
scale = gtk_hscale_new_with_range (0,
G_PI * 2,
0.01);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0, G_PI * 2, 0.01);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Remove child 2");

View File

@ -49,13 +49,15 @@ int main (int argc, char *argv[])
box = gtk_vbox_new (FALSE, 5);
frame = gtk_frame_new ("No marks");
scale = gtk_hscale_new_with_range (0, 100, 1);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0, 100, 1);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Simple marks");
scale = gtk_hscale_new_with_range (0, 100, 1);
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), marks[0], GTK_POS_BOTTOM, NULL);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, NULL);
@ -64,7 +66,8 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Labeled marks");
scale = gtk_hscale_new_with_range (0, 100, 1);
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), marks[0], GTK_POS_BOTTOM, labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, labels[1]);
@ -73,7 +76,8 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Some labels");
scale = gtk_hscale_new_with_range (0, 100, 1);
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), marks[0], GTK_POS_BOTTOM, labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, NULL);
@ -82,7 +86,8 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Above and below");
scale = gtk_hscale_new_with_range (0, 100, 1);
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), bath_marks[0], GTK_POS_TOP, bath_labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[1], GTK_POS_BOTTOM, bath_labels[1]);
@ -95,13 +100,15 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (box), box2, TRUE, TRUE, 0);
frame = gtk_frame_new ("No marks");
scale = gtk_vscale_new_with_range (0, 100, 1);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL,
0, 100, 1);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Simple marks");
scale = gtk_vscale_new_with_range (0, 100, 1);
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), marks[0], GTK_POS_LEFT, NULL);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_LEFT, NULL);
@ -110,7 +117,8 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Labeled marks");
scale = gtk_vscale_new_with_range (0, 100, 1);
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), marks[0], GTK_POS_LEFT, labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_LEFT, labels[1]);
@ -119,7 +127,8 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Some labels");
scale = gtk_vscale_new_with_range (0, 100, 1);
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), marks[0], GTK_POS_LEFT, labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_LEFT, NULL);
@ -128,7 +137,8 @@ int main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (box2), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Right and left");
scale = gtk_vscale_new_with_range (0, 100, 1);
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), bath_marks[0], GTK_POS_RIGHT, bath_labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[1], GTK_POS_LEFT, bath_labels[1]);