Re: GtkLabel as a child of a windowless widget

On Mon, 2006-06-19 at 16:10 +0200, Alberto Mardegan wrote:
> Hi all!
>   I'm creating a Widget based on GtkFrame, with little differences:
> 1) It's not a container
> 2) It has the GTK_NO_WINDOW flag set.
> I'm going to use this widget inside a GtkFixed container, with the only
> goal of having it paint its frame (and draw its label) on the screen.
> I want it windowless, so that I can insert other widgets which will
> appear to be inside it, but which will be actually be owned by the
> GtkFixed.

First, can you simply use a GtkFrame inside a GtkFixed, and just not put
a child inside the frame?

> The problem I have, is that the frame label isn't drawn. I'm not sure if
> there are any operation I should do on it... I just create it, and call
> gtk_widget_set_parent().
> On size_allocate, I'm not sure whether the child's x and y members of
> the size_allocation struct should be relative to (0,0) or to the parent
> widget's x and y allocation (since the parent is windowless, too). But
> this won't work in any case...

Allocations are always with respect to the parent window.  So if you
have a windowed parent, then inside it a no-window container at
(10, 20), and a child of that container which is supposed to be offset
(3, 4) pixels from the container's top-left corner, then the child's
allocation will be at (13, 24).


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