1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | | 10 | | | 11 | | | 12 | | | 13 | | | 14 | | | 15 | | | 16 | | | 17 | | | 18 | | | 19 | | | 20 | | | 21 | | | 22 | | |
| | #include <gtk/gtk.h> | | void text_widget_sample(GtkWidget *w) | | { | | GtkWidget *v; | | GtkTextBuffer *b; | | v = gtk_text_view_new(); | | b = gtk_text_view_get_buffer(GTK_TEXT_VIEW(v)); | | gtk_text_buffer_set_text(b,"HELLO1\nHELLO2\n",-1); | | gtk_container_add(GTK_CONTAINER(w), v); | | } | | 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); | | text_widget_sample(w); | | g_signal_connect(w, "destroy", G_CALLBACK(gtk_main_quit), NULL); | | gtk_widget_show_all(w); | | gtk_main(); | | return 0; | | } |
|