1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | | 10 | | | 11 | | | 12 | | | 13 | | | 14 | | | 15 | | | 16 | | | 17 | | | 18 | | | 19 | | | 20 | | | 21 | | | 22 | | | 23 | | | 24 | | |
| | #include <gtk/gtk.h> | | static void b_clicked(GtkWidget *b, gpointer user_data) | | { | | gtk_main_quit(); | | } | | void button_widget_sample(GtkWidget *w) | | { | | GtkWidget *b; | | b = gtk_button_new_with_label("PUSH TO EXIT"); | | g_signal_connect(G_OBJECT(b), "clicked", G_CALLBACK(b_clicked), NULL); | | gtk_container_add(GTK_CONTAINER(w), b); | | } | | int main(int argc, char** argv) | | { | | GtkWidget *w; | | gtk_init(&argc,&argv); | | w = gtk_window_new(GTK_WINDOW_TOPLEVEL); | | gtk_widget_set_size_request(w,300,200); | | button_widget_sample(w); | | g_signal_connect(w, "destroy", G_CALLBACK(gtk_main_quit), NULL); | | gtk_widget_show_all(w); | | gtk_main(); | | return 0; | | } |
|