demos: Add an image demo for widget paintables

This commit is contained in:
Benjamin Otte 2018-03-31 21:59:41 +02:00
parent 169203951b
commit 139882bc76

View File

@ -325,6 +325,7 @@ do_images (GtkWidget *do_widget)
GtkWidget *image;
GtkWidget *label;
GtkWidget *button;
GdkPaintable *paintable;
GIcon *gicon;
if (!window)
@ -445,6 +446,22 @@ do_images (GtkWidget *do_widget)
gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE);
gtk_container_add (GTK_CONTAINER (frame), video);
/* Widget paintables */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>GtkWidgetPaintable</u>");
gtk_box_pack_start (GTK_BOX (vbox), label);
paintable = gtk_widget_paintable_new (do_widget);
image = gtk_image_new_from_paintable (paintable);
gtk_image_set_can_shrink (GTK_IMAGE (image), TRUE);
gtk_widget_set_size_request (image, 100, 100);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (vbox), image);
/* Sensitivity control */
button = gtk_toggle_button_new_with_mnemonic ("_Insensitive");
gtk_box_pack_start (GTK_BOX (base_vbox), button);