Re: GtkTextView - when the buffer rendering is finished?



Thanks a lot!!!!
 
A while back I recall Owen saying that GtkWidget's 'expose-event' signal
could be relied on as an indication that the idle thread that does the
rendering has completed updating.
http://library.gnome.org/devel/gtk/stable/GtkWidget.html#GtkWidget-expose-event


This works perfectly for me.

Regards,
LUK



2008/11/13 Andrew Cowie <andrew operationaldynamics com>
On Thu, 2008-11-13 at 09:23 +0000, Lukasz Gromotowicz wrote:
> is there any way to check if the whole GtkTextBuffer had been rendered
> to the GtkTextView?

A while back I recall Owen saying that GtkWidget's 'expose-event' signal
could be relied on as an indication that the idle thread that does the
rendering has completed updating.
http://library.gnome.org/devel/gtk/stable/GtkWidget.html#GtkWidget-expose-event

Which certainly makes sense, seeing as how the result of doing all the
line height calculations is to _draw_ the resultant lines, and thence
expose. So that might work for you.

> I want to display the procentage of the data displayed on the screen
> (and update it during scrolling)

I ran into something similar; in my case the problem was the fact that
all the line height calculations and conversions are *wrong* before
[re]validation of the line heights has occurred.

Reading the GtkTextView source code I discovered that the emission of
the 'value-changed' signal on the GtkAdjustment (controlling the
position of the GtkScrollbar) is the internal trigger for the
revalidation to occur.
http://library.gnome.org/devel/gtk/stable/GtkAdjustment.html#GtkAdjustment-value-changed

So, manually emitting that signal can be a mechanism to initiate the
redrawing process. This isn't public API, but it does seem to work.  See
line 53 of
http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/gtktextview.c?view=markup

I wrote about our experience of using it here:
http://java-gnome.sourceforge.net/4.0/doc/api/org/gnome/gtk/TextView.html#height

The issue of validation seems to come up a lot. It's a shame that there
isn't a "force redraw" or "force validate" method on GtkTreeView.

AfC
Sydney

--
Andrew Frederick Cowie

Operational Dynamics is an operations and engineering consultancy
focusing on IT strategy, organizational architecture, systems
review, and effective procedures for change management. We actively
carry out research and development in these areas on behalf of our
clients, and enable successful use of open source in their mission
critical enterprises, worldwide.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]