Re: Control what happens when GtkTextView is resized: keep the bottom part visible

2009-11-14 Thread Todor Todorov
I don't believe there is a way to get the size before the change. I do not believe that there is much requirement for that. If you are looking for a more elegant solution, you would have to reimplement GtkViewport or GtkScrolledWindow to keep track of the visible view now and before. Regards,

Re: Control what happens when GtkTextView is resized: keep the bottom part visible

2009-11-14 Thread Eduardo M KALINOWSKI
Todor Todorov wrote: > Well, since resizing the widget by itself does not do any scrolling, > whichever value you get from the adjustment _is_ the current scroll > value. In the same way you have the function *_get_upper(), you have > *_get_lower() and *_get_value()... Just change the computatio

Re: Control what happens when GtkTextView is resized: keep the bottom part visible

2009-11-13 Thread Todor Todorov
Well, since resizing the widget by itself does not do any scrolling, whichever value you get from the adjustment _is_ the current scroll value. In the same way you have the function *_get_upper(), you have *_get_lower() and *_get_value()... Just change the computation however you need it to be.

Re: Control what happens when GtkTextView is resized: keep the bottom part visible

2009-11-13 Thread Eduardo M KALINOWSKI
Todor Todorov wrote: > Bind a callback to the "size-allocate" signal of the scrolled window: > > #include > > void cb_autoscroll_to_end( GtkWidget* widget, GtkAllocation* allocation, > gpointer user_data) > { > > } > > After you create the scroll window in main(), connect like: > > g_signal_conn

Re: Control what happens when GtkTextView is resized: keep the bottom part visible

2009-11-12 Thread Todor Todorov
Bind a callback to the "size-allocate" signal of the scrolled window: #include void cb_autoscroll_to_end( GtkWidget* widget, GtkAllocation* allocation, gpointer user_data) { GtkAdjustment*vericalAdjust; GtkAllocation hscrollAlloc; GtkWidget *hscrollBar; /* the h

Re: Control what happens when GtkTextView is resized: keep the bottom part visible

2009-11-11 Thread Eduardo M KALINOWSKI
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

Control what happens when GtkTextView is resized: keep the bottom part visible

2009-11-09 Thread Eduardo M KALINOWSKI
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 int main(int argc, char *argv[]) { GtkW