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