example-1.c
来自「Developing with Gnome一书examples例子代码」· C语言 代码 · 共 44 行
C
44 行
/* This program displays a simple window and has a simple callback for * when the OK button is clicked. */#include <gtk/gtk.h>#include <glade/glade.h>voidok_button_clicked (GtkWidget *widget, gpointer user_data){ printf ("Thanks for trying out my program.\n"); gtk_main_quit ();}intmain (int argc, char *argv[]){ GladeXML *main_window; GtkWidget *widget; gtk_init (&argc, &argv); /* load the interface */ main_window = glade_xml_new ("example-1.glade", NULL, NULL); /* connect the signals in the interface */ /* Have the ok button call the ok_button_clicked callback */ widget = glade_xml_get_widget (main_window, "OKButton"); g_signal_connect (G_OBJECT (widget), "clicked", G_CALLBACK (ok_button_clicked), NULL); /* Have the delete event (window close) end the program */ widget = glade_xml_get_widget (main_window, "MainWindow"); g_signal_connect (G_OBJECT (widget), "delete_event", G_CALLBACK (gtk_main_quit), NULL); /* start the event loop */ gtk_main (); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?