gfx/tooltip.h
Tooltips, and the corner you drag to resize an editor.
#include <sonore/gfx/tooltip.h>- 3types
- Guides: The native editor
On this page
Design notes
Why tooltips matter more in a plugin
A plugin has almost no room for words. Every control is a knob with a four-letter label, and the difference between "Drive" meaning input gain and "Drive" meaning saturation amount is a sentence nobody has space to print. In an application you would open a manual; nobody opens a manual for a plugin.
Why the clock is passed in
A tooltip is defined by TIME: it appears after the pointer has been still for a while and disappears after a while longer. Reading a clock inside would make every one of those rules untestable except by sleeping, and a test that sleeps is a test that is slow and flaky at once. So now is an argument, the peer passes its own clock, and a test passes whatever it likes.
Types 3
Decides when a tooltip should be up, and what it should say.
Owns no window. The peer that has one asks this what to show and does the showing -- the same split as everywhere else in this UI, and the reason all the timing rules below can be checked with no display at all.
Limits on how big an editor may be, and how it must be shaped.
A host resizing a plugin editor is not asking politely -- it sets a size and expects the plugin to cope. The constrainer is what a wrapper answers adjust_size with, so a host learns the limits BEFORE it commits to a window rather than after.
class ResizableCorner : public Widget
The grip in the corner.
Reports a WANTED size rather than resizing anything itself. A plugin editor does not own its window -- the host does -- so the only correct thing a grip can do is ask, through clap_gui_request_resize or the VST3 equivalent, and let the host decide.