Eduardo M KALINOWSKI wrote: > I have a question concerning how to set which part of a GtkTextBuffer is > displayed when a GtkTextView is resized. > > To explain the situation, consider this sample code: > > ----8<---- > /* gcc -o tvtest tvtest.c `pkg-config --libs --cflags gtk+-2.0` */ > #include <gtk/gtk.h> > > int main(int argc, char *argv[]) > { > GtkWidget *window; > GtkWidget *vpaned; > GtkWidget *text1; > GtkWidget *scr1; > GtkTextBuffer *buffer; > GtkWidget *text2; > GtkWidget *scr2; > > gtk_init(&argc, &argv); > > window = gtk_window_new(GTK_WINDOW_TOPLEVEL); > gtk_widget_set_size_request(window, 500, 300); > g_signal_connect(G_OBJECT(window), "delete-event", > G_CALLBACK(gtk_main_quit), NULL); > > vpaned = gtk_vpaned_new(); > > text1 = gtk_text_view_new(); > buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text1)); > gtk_text_buffer_set_text(buffer, > "Lorem ipsum dolor sit amet,\n" > "consectetur adipisicing elit,\n" > "sed do eiusmod tempor incididunt\n" > "ut labore et dolore magna aliqua.\n" > "Ut enim ad minim veniam,\n" > "quis nostrud exercitation ullamco laboris\n" > "nisi ut aliquip ex ea commodo consequat.\n" > "Duis aute irure dolor in reprehenderit\n" > "in voluptate velit esse cillum dolore\n" > "eu fugiat nulla pariatur.\n" > "Excepteur sint occaecat cupidatat non > proident,\n" > "sunt in culpa qui officia\n" > "deserunt mollit anim id est laborum.", -1); > > text2 = gtk_text_view_new_with_buffer(buffer); > > scr1 = gtk_scrolled_window_new(NULL, NULL); > gtk_container_add(GTK_CONTAINER(scr1), text1); > gtk_paned_add1(GTK_PANED(vpaned), scr1); > > scr2 = gtk_scrolled_window_new(NULL, NULL); > gtk_container_add(GTK_CONTAINER(scr2), text2); > gtk_paned_add2(GTK_PANED(vpaned), scr2); > > gtk_container_add(GTK_CONTAINER(window), vpaned); > > gtk_widget_show_all(window); > gtk_main(); > > return 0; > } > ----8<---- > > When the division in the GtkPaned is moved, what happens is that the top > of the GtkTextViews remains the same (thus keeps displaying the same > thing), while the bottom part shrinks, hiding some text at the bottom if > the widget gets smaller, or displaying more text at the bottom if it is > enlarged. > > What I would like to do is the opposite: for the GtkTextView in the > bottom, I'd like that the bottom of the widget remains the same, but > changes in size are reflected at the top: if the widget shrinks, then > less text at the top should be displayed, if it grows, then more text at > the top should be displayed. The bottom should remain fixed displaying > always the same part. > > Another way to visualize is that by changing the division in the > GtkPaned it should cover more of the top of the bottom GtkTextView, > instead of pushing it down. > >
Sorry to be posting again, but does anyone have any tips? -- Eduardo M KALINOWSKI edua...@kalinowski.com.br _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list