Re: How to redraw a widget completely?

"Damon Chaplin" <> 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, 
 gtk_widget_queue_draw (widget);

This will be about 90% effective. 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 queue a redraw "from the ground up". (And widgets
will need to use this themselves as well)
> 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 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:

Drawing the children isn't necessary in any case: 

 gtk_widget_draw (widget, NULL);

will automatically draw the children.


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