[gtk-list] Re: How to redraw a widget completely?\
- From: Patrice Fortier <Patrice Fortier aquarel fr>
- To: gtk-list redhat com
- Subject: [gtk-list] Re: How to redraw a widget completely?\
- Date: Fri, 7 Aug 1998 19:08:04 +0200 (MET DST)
>
>
> "Damon Chaplin" <DAChaplin@email.msn.com> writes:
>
> > How do I get a widget redrawn completely, including its background
> > (which might be a pixmap) and its children?
> > (I asked this question a while back but got no answer)
>
> For current GTK+, your best hope is:
>
> gdk_window_clear_area (widget->window,
> widget->allocation.x,
> widget->allocation.y,
> widget->allocation.width,
> widget->allocation.height);
> gtk_widget_queue_draw (widget);
>
> This will be about 90% effective.
What are the other 10%?
> The theming code rationalizes
> all this, and when that makes it into GTK+ proper, you'll
> be able to simply do:
>
> gtk_widget_queue_clear (widget);
which will flush the drawing queue (+resize queue?) ?
If this is the case, each time a widget call gtk_widget_queue_clear()
the queue(s) is (are) flushed.
> Which will queue a redraw "from the ground up". (And widgets
> will need to use this themselves as well)
>
When should this function be used? As far as I can understand it
will replace gtk_*_queue_draw?
>From where (in the application widget hierarchy) the redrawing
will begin?
> > The problem is that in Glade you can select widgets and it draws
> > a black rectangle around them. So when the widget is deselected
> > I need to redraw the widget completely.
the black rectangle is drawn in the selected widget or in its parent?
I'm not talking of technical window stuff, just about "widget".
ie: is the rectangle larger than the widget or inside? :)
> > The best I can do at the moment is paint a filled rectangle in the
> > widget's parent's window in the widget's background colour, and then
> > draw the widget and its children explicitly. But this doesn't work
> > with background pixmaps, and I feel its a kludge anyway:
Yep, this is because in gtk+ some (most?) widgets don't have their own
window (X window I mean) to draw on. The drawings are made on their
parent widget.
So in your case, as you seems to draw your black rectangle (and clear it)
in the parent widget, you also need to redraw the NO_WINDOW widget too.
Note that this is also the case for expose events.
I really don't like this and made a patch to make all widgets have their
own window (except some specila cases like pixmap, separator, label...).
You can find it on the ftp site if you want to test it (it's
gtl-fortier-somthing:).
I guess it won't be included in the next release as Owen found the
NO_WINDOW thing interesting for the _shaped_ window theming stuff
(shaped window (real one I mean) are much slower).
A normal behaviour (maybe the one you expected) would have been to
clear the black rectangle under your widget. Period.
> Drawing the children isn't necessary in any case:
>
> gtk_widget_draw (widget, NULL);
>
> will automatically draw the children.
...which is called by gtk_widget_queue_draw().
Clear the area on the parent (as you do) and call gtk_widget_queue_draw
with your widget.
gtk_widget_draw is used to draw thing _immediatly_ and avoid paint race
conditions (at least in the current implementation of gtk).
I know Owen knows that but you may be interested to know it as well :).
Lokh.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]