Re: Struggling to understand how to render to GtkLayout in a GtkScrolledWindow





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.


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