Re: Draw order



On 7/13/06, Atanas Atanasov <thenasko gmail com> wrote:
I would like to explicitly specify the drawing order inside a bin
widget such as GtkFixed or something else similar? However the
documentation does not specify anything particular. Once more I know
that the windows style absolute positioning is against the
architecture of Gtk+, but I would like to be able to implement
something similar to z-order.

My app does this, but it's not really supported.

The trick is to only have GtkEventBox as the children of the GtkFixed,
and to put your actual widgets inside the event boxes. The event boxes
make invisible subwindows which keep the events and drawing for the
children separate and stackable.

You can't control the stacking order directly, but you can do pop-to-front:

 g_object_ref( child )
 gtk_container_remove( fixed, child )
 gtk_fixed_put( fixed, child, x, y )
 g_object_unref( child )

The ref/unref pair stop the child being destroyed when you remove it
from the container.

You can see this in action here:

 http://www.vips.ecs.soton.ac.uk/index.php?title=Image:Screenshot-nip2-7.11.4.jpg

Don't know how clear that is, but the columns can be dragged about by
their title bars and will stack, and will click to front.

It works fine on X and on win32, but of course it may stop working
since this isn;t really allowed.

John



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