forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Add a slider to the menu example See merge request GNOME/gtk!3733
This commit is contained in:
commit
e6cce283a7
@ -21,8 +21,10 @@ do_menu (GtkWidget *do_widget)
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
|
GtkWidget *box;
|
||||||
GtkWidget *sw;
|
GtkWidget *sw;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
GtkWidget *scale;
|
||||||
|
|
||||||
window = gtk_window_new ();
|
window = gtk_window_new ();
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Menu");
|
gtk_window_set_title (GTK_WINDOW (window), "Menu");
|
||||||
@ -31,11 +33,23 @@ do_menu (GtkWidget *do_widget)
|
|||||||
gtk_widget_get_display (do_widget));
|
gtk_widget_get_display (do_widget));
|
||||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||||
|
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new ();
|
sw = gtk_scrolled_window_new ();
|
||||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
gtk_widget_set_vexpand (sw, TRUE);
|
||||||
|
gtk_box_append (GTK_BOX (box), sw);
|
||||||
|
|
||||||
widget = demo3_widget_new ("/transparent/portland-rose.jpg");
|
widget = demo3_widget_new ("/transparent/portland-rose.jpg");
|
||||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), widget);
|
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), widget);
|
||||||
|
|
||||||
|
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.01, 10.0, 0.1);
|
||||||
|
gtk_range_set_value (GTK_RANGE (scale), 1.0);
|
||||||
|
gtk_box_append (GTK_BOX (box), scale);
|
||||||
|
|
||||||
|
g_object_bind_property (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
|
||||||
|
widget, "scale",
|
||||||
|
G_BINDING_BIDIRECTIONAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
Loading…
Reference in New Issue
Block a user