diff options
author | Kristian Rietveld <kris@gtk.org> | 2003-10-13 18:15:10 +0000 |
---|---|---|
committer | Kristian Rietveld <kristian@src.gnome.org> | 2003-10-13 18:15:10 +0000 |
commit | 9607ba378aaed61e138660ccf6dbe95d4f275de7 (patch) | |
tree | 247ff28daa2367ba7a47dc31fe57e943bf84e881 /demos | |
parent | d4627e1da48b42811c74df955c72ea5bf1246e5b (diff) | |
download | gtk+-9607ba378aaed61e138660ccf6dbe95d4f275de7.tar.gz |
enable GTK_DISABLE_DEPRECATED again, (set_interp_type), (main): port over
Mon Oct 13 20:21:55 2003 Kristian Rietveld <kris@gtk.org>
* demos/testpixbuf-scale.c: enable GTK_DISABLE_DEPRECATED again,
(set_interp_type), (main): port over from option menu to GtkComboBox.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/testpixbuf-scale.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/demos/testpixbuf-scale.c b/demos/testpixbuf-scale.c index 6a90f0b095..c54c4b2549 100644 --- a/demos/testpixbuf-scale.c +++ b/demos/testpixbuf-scale.c @@ -1,4 +1,3 @@ -#undef GTK_DISABLE_DEPRECATED #include <gtk/gtk.h> #include <stdio.h> @@ -12,7 +11,12 @@ GtkWidget *darea; void set_interp_type (GtkWidget *widget, gpointer data) { - interp_type = GPOINTER_TO_UINT (data); + guint types[] = { GDK_INTERP_NEAREST, + GDK_INTERP_BILINEAR, + GDK_INTERP_TILES, + GDK_INTERP_HYPER }; + + interp_type = types[gtk_combo_box_get_active (GTK_COMBO_BOX (widget))]; gtk_widget_queue_draw (darea); } @@ -59,7 +63,7 @@ int main(int argc, char **argv) { GtkWidget *window, *vbox; - GtkWidget *menuitem, *optionmenu, *menu; + GtkWidget *combo_box; GtkWidget *alignment; GtkWidget *hbox, *label, *hscale; GtkAdjustment *adjustment; @@ -96,37 +100,18 @@ main(int argc, char **argv) vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); - menu = gtk_menu_new (); - - menuitem = gtk_menu_item_new_with_label ("NEAREST"); - g_signal_connect (menuitem, "activate", - G_CALLBACK (set_interp_type), - GUINT_TO_POINTER (GDK_INTERP_NEAREST)); - gtk_widget_show (menuitem); - gtk_container_add (GTK_CONTAINER (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("BILINEAR"); - g_signal_connect (menuitem, "activate", - G_CALLBACK (set_interp_type), - GUINT_TO_POINTER (GDK_INTERP_BILINEAR)); - gtk_widget_show (menuitem); - gtk_container_add (GTK_CONTAINER (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("TILES"); - g_signal_connect (menuitem, "activate", - G_CALLBACK (set_interp_type), - GUINT_TO_POINTER (GDK_INTERP_TILES)); - gtk_container_add (GTK_CONTAINER (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("HYPER"); - g_signal_connect (menuitem, "activate", - G_CALLBACK (set_interp_type), - GUINT_TO_POINTER (GDK_INTERP_HYPER)); - gtk_container_add (GTK_CONTAINER (menu), menuitem); - - optionmenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 1); + combo_box = gtk_combo_box_new_text (); + + gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "NEAREST"); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "BILINEAR"); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "TILES"); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "HYPER"); + + gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 1); + + g_signal_connect (combo_box, "changed", + G_CALLBACK (set_interp_type), + NULL); alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.5); gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); @@ -145,7 +130,7 @@ main(int argc, char **argv) gtk_scale_set_digits (GTK_SCALE (hscale), 0); gtk_box_pack_start (GTK_BOX (hbox), hscale, TRUE, TRUE, 0); - gtk_container_add (GTK_CONTAINER (alignment), optionmenu); + gtk_container_add (GTK_CONTAINER (alignment), combo_box); gtk_widget_show_all (vbox); /* Compute the size without the drawing area, so we know how big to make the default size */ |