blob: 9dd223b55561367b97d1e49fcd5f606b3faab7b8 [file] [log] [blame]
// link viewportLayer to scrollable control: 1) for pixel area, 2) to listen for scroll events
// the question is, how?
// the viewportLayer control should actually be *created* by the viewportLayer when it is rendered
// the control impacts the viewportLayer when it is resized (pixelArea changes) or when it is scrolled (update viewport origin)
// the viewportLayer may also want to impact its control (e.g. if it is programmatically updated)
// so: i want a renderer-agnostic way of doing this
// renderer can know about layer (fine) and attach itself as a listener to the layer
// so: layer needs an event system
// actually, swt pixel area for viewport should take into account its position within lateral composites in addition to outer control area.
// how to do this? in ntbl1 this is done by calling setClientAreaProvider from the top level and having it bubble down.
// this works because outer layer knows its area and knows the relative subareas of its constituent parts.
// of course, it also means we have to do some explicit setup in the beginning, which would be nice to avoid if possible.
// Q: can we bubble up instead? remember we can have diamond vertical composition..
// QQ: do layers know who their parents are?
// for the viewport it does not make sense for it to be included in multiple locations in the hierarchy for the purposes of pixel area because they may occupy different areas
The event and command mechanisms are dependent on the propagation logic.
Both are depth-first.
Might become a bit problematic if complex layouts are used, e.g. large layer underlying a composite.
Is there another way to handle that kind of situation?
Command propagation can be short-circuited by returning a boolean value.
Event propagation goes everywhere.
Visitor pattern to propagate events/commands in order to externalize propagation? Hmm..
* Choose layer renderer based on layer. Implicit/explicit mapping
* Make composite layer renderer defer rendering of sublayers to sublayer layer renderers