5 /* XPM data of Open-File icon */
6 static const char * xpm_data[] = {
29 /* when invoked (via signal delete_event), terminates the application.
31 gint close_application( GtkWidget *widget,
40 /* is invoked when the button is clicked. It just prints a message.
42 void button_clicked( GtkWidget *widget,
44 g_print ("button clicked\n");
50 /* GtkWidget is the storage type for widgets */
51 GtkWidget *window, *pixmapwid, *button;
56 /* create the main window, and attach delete_event signal to terminating
58 gtk_init (&argc, &argv);
59 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
60 g_signal_connect (G_OBJECT (window), "delete_event",
61 G_CALLBACK (close_application), NULL);
62 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
63 gtk_widget_show (window);
65 /* now for the pixmap from gdk */
66 style = gtk_widget_get_style (window);
67 pixmap = gdk_pixmap_create_from_xpm_d (window->window, &mask,
68 &style->bg[GTK_STATE_NORMAL],
71 /* a pixmap widget to contain the pixmap */
72 pixmapwid = gtk_image_new_from_pixmap (pixmap, mask);
73 gtk_widget_show (pixmapwid);
75 /* a button to contain the pixmap widget */
76 button = gtk_button_new ();
77 gtk_container_add (GTK_CONTAINER (button), pixmapwid);
78 gtk_container_add (GTK_CONTAINER (window), button);
79 gtk_widget_show (button);
81 g_signal_connect (G_OBJECT (button), "clicked",
82 G_CALLBACK (button_clicked), NULL);