📄 example-1.c
字号:
/* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -