日期:2014-05-16 浏览次数:20881 次
#include <gtk/gtk.h> int main(int argc,char *argv[]) { GtkWidget *window; GtkWidget *text; GtkTextBuffer *buffer; gtk_init(&argc,&argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window),"ChatRoom"); gtk_window_set_default_size(GTK_WINDOW(window),200,200); g_signal_connect(GTK_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL); text = gtk_text_view_new(); buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); gtk_text_buffer_set_text(buffer,"",-1); gtk_container_add(GTK_CONTAINER(window),text); gtk_widget_show_all(window); gtk_main(); return 0; }