gfx/viewport.h
A window onto something bigger than itself, and the bar that moves it.
#include <sonore/gfx/viewport.h>- 2types
- Guides: The native editor
On this page
Design notes
Why a plugin needs one
GenericEditor lays out one row per parameter. A plugin with forty of them makes an editor taller than a screen, and a host given that size either clips it or refuses it -- either way the last parameters cannot be reached. The same is true of any list a plugin wants to show: presets, samples, modulation slots.
How the scroll actually happens
By moving the viewed component to a NEGATIVE position inside the viewport, and letting the component tree do the rest. paintTree already translates by a child's bounds and clips to them before recursing, and hitTest already subtracts the same offset -- so scrolling needs no special case in either. A viewport that reimplemented clipping would be a second set of rules to keep in step with the first.
Types 2
class ScrollBar : public Widget
A scroll bar.
Usable on its own -- a mixer strip wants one without a viewport around it -- which is why it takes a range rather than a component.
class Viewport : public Widget
A clipped window onto a larger component, with bars.
The viewed component is NOT owned. A viewport that owned it would decide the lifetime of something a caller usually keeps a pointer to, and every existing container here is non-owning for the same reason.