Re: GtkFrame adaption again



Carsten Burstedde <bursted iam uni-bonn de> writes:

> I modified the gtkframe widget to do the following:
> 
> /-----------  frame.allocation -----------\
> |
> |          empty space
> |
> |          /---- frame shadow/line ----\
> |          |      child widget
> |          |
> |
> 
> so that the child widget may change size and is always directly bounded
> by the frame shadow line and centered inside the frame allocation space.
> 
> This works fine until the child widget changes in size: On increase, the
> frame is not told to redraw itself, so the frame shadow can't be drawn
> to fit around the (now bigger) child; the old shadow is overdrawn by the
> child (in my case a drawing area, resized by gtk_drawing_area_size). So
> it is missing. If the widget decreases in size, there is again no call
> to the frame drawing routines, so the old (too big) shadow stays there
> and cannot be overdrawn (I put the necessary background drawing stuff
> inside the frame drawing routine).
> 
> Normal exposes work, then the shadow appears/disappears as appropriate.
> 
> What can I do? Do I have to set up some virtual function (maybe for
> gtkcontainer)?

Try:

 gtk_container_set_reallocate_redraws (GTK_CONTAINER (my_widget), TRUE);

In your init function. The other thing you could do is call
gtk_widget_queue_draw() in your size_allocate() method directly.

Unless told otherwise, GTK+ doesn't redraw a container widget
if it's child widgets change allocation but the container itself
doesn't; this is because the most common containers (e.g., boxes,
tables, etc) don't draw anything themselves, so redrawing the
container's area every time the children change would be a waste.

Regards,
                                        Owen



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