Re: Struggling to understand how to render to GtkLayout in a GtkScrolledWindow
- From: Tristan Van Berkom <tristan upstairslabs com>
- To: Paul Davis <paul linuxaudiosystems com>
- Cc: Oliver Charles <ollie ocharles org uk>, ML-gtk <gtk-list gnome org>
- Subject: Re: Struggling to understand how to render to GtkLayout in a GtkScrolledWindow
- Date: Tue, 07 Oct 2014 11:55:58 +0900
On Mon, 2014-10-06 at 16:44 -0400, Paul Davis wrote:
On Mon, Oct 6, 2014 at 4:05 PM, Oliver Charles <ollie ocharles org uk>
wrote:
On Mon, Oct 6, 2014 at 7:11 PM, Paul Davis
<paul linuxaudiosystems com> wrote
GtkLayout is NOT a canvas.
You need a canvas widget. Unfortunately, there is no
blessed canvas widget.
Ok, then I think I was mislead by the documentation for
GtkLayout, which states:
GtkLayout is similar to GtkDrawingArea in that it’s a
“blank slate” and doesn’t do anything but paint a
blank background by default
GktLayout is intended to "layout" other GTK widgets in a scrollable
space. This has a useful purpose all of its own.
Unlike a canvas order, it has no notion of z-axis order, so if any of
your widgets overlap, the result is not well defined (for either
drawing or event handling). Obviously something will happen, and it
may be the right thing. But that will be mostly an accident.
In addition, if you just draw on it, the things you draw are not
event-sensitive in the way that widgets would be.
And the synopsis:
GtkLayout: Infinite scrollable area containing child
widgets and/or custom drawing
So if GtkLayout isn't the way to go for a large, scrollable
canvas... what is?
Once upon a time, there was GnomeCanvas. Discontinued. Other people
created foocanvas, goocanvas and various others. For Ardour, we've
recently (within the last year) implemented out own canvas (which does
*not* handle child widgets, by design).
What you need depends a great deal on what you actually to do. If you
want a bunch of non-overlapping widgets with non-event-handling drawn
elements between them, then GtkLayout should be fine. If you want
event-sensitive drawn elements or want a defined z-axis order for
overlapping elements (widgets or otherwise),then it will probably
prove problematic.
Honestly I have never used goocanvas for any serious project, but
played around with the demo and I still *intend* to use it to replace
something I used clutter for (no it's not similar to clutter, I just
made a bad choice and should have used a canvas all along).
Anyway, I would recommend you at least checkout the goocanvas code
and try it out... depending on the state of GTK+3 the demo might be
rough around the edges (I recall some weird glitches that turned up
in later versions of GTK+3, maybe it was a passing bug), but giver her
a spin and see what you think :)
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]