Drawing a widget to offscreen



Hi all,
I have a GtkTreeView associated to a model that doesn't change very often, but whose rendering might be computationally expensive. For this reason, I'd like to render the GtkTreeView to an offscreen pixmap (in its full size, no cropping), and then show this pixmap in a scrolled window. In this way, scrolling would be fast, and the CPU load minimized as the pixmap would be generated only when the model changes (I don't need any interaction with the user, that's why I'd just use a pixmap).

How can I achieve this?

I was thinking of creating an invisible GtkContainer widget (into which I'd embed the GtkTreeView) which would grant to its child whatever size is being requested, and then grab a copy of it's child pixmap. But I don't know if/how this would be possible. Such a container widget could be useful for other projects, too; anyone has already coded it?

The last possibility I have is to get rid of the GtkTreeView completely, and just draw to an offscreen pixmap via Pango/Cairo primitives; but the GtkTreeView is so convenient, since it computes the column sizes itself...

Ciao,
  Alberto

--
http://www.mardy.it <-- Geek in un lingua international!



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