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 computation however 
 you need it to be. Did you even looked up the functions I used in the 
 API docs? You would have seen the rest
   

You're right, I was wrong about the requirements.

I've come to the conclusion that what is necessary is to keep the value
(upper - (value + page_size)) constant when resizing happens. This value
represents the size of the part of the scrollable widget (a GtkTextView
in this case) that remains below the currently displayed portion. That
means adjusting the value (which as you said by default is not changed).

Well, upper never changes when resizing a widget, so it's only necessary
to keep (value + page_size) constant. But page_size _does_ change when
resizing happens, so a question very similar to my previous one still
holds: is there a way to know the value that the adjustment's page_size
had before the resize operation, to compare with the new value caused by
the resizing, so that the calculations can be done?

I've been able to solve it by storing page_size in a variable at the end
of the function and reusing it in the next call, but this is far from
elegant. Is there some better way?

-- 
Mere nonexistence is a feeble excuse for declaring a thing unseeable. You
*can* see dragons.  You just have to look in the right direction.
-- John Hasler

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


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,

Todor

On 11/14/2009 07:10 AM, Eduardo M KALINOWSKI wrote:

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 computation however
you need it to be. Did you even looked up the functions I used in the
API docs? You would have seen the rest

 

You're right, I was wrong about the requirements.

I've come to the conclusion that what is necessary is to keep the value
(upper - (value + page_size)) constant when resizing happens. This value
represents the size of the part of the scrollable widget (a GtkTextView
in this case) that remains below the currently displayed portion. That
means adjusting the value (which as you said by default is not changed).

Well, upper never changes when resizing a widget, so it's only necessary
to keep (value + page_size) constant. But page_size _does_ change when
resizing happens, so a question very similar to my previous one still
holds: is there a way to know the value that the adjustment's page_size
had before the resize operation, to compare with the new value caused by
the resizing, so that the calculations can be done?

I've been able to solve it by storing page_size in a variable at the end
of the function and reusing it in the next call, but this is far from
elegant. Is there some better way?

   

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list