Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/side_panel.h

SidePanel: a drawer that slides in over the editor from one edge.

#include <sonore/gfx/side_panel.h>
On this page

Design notes

What it is for here

Settings, a preset list, a burger menu: the things an editor wants on hand without giving them permanent room. The drawer comes in over the content rather than pushing it aside, so opening it never re-lays out the controls under it -- a knob the user was about to grab stays where it was.

The pieces

The SidePanel covers its parent, like an Overlay, and dims what is behind in proportion to how far the drawer is in. A press on the dimmed part closes it, as does Escape and the close button on its title bar, and dragging the title bar back towards the edge throws it away.

The clock is an argument

The slide is Animator's, and like every timed thing in this SDK it moves only when tick(now) is called -- from the editor's 33 ms clock, which also passes setInputClock(now) so that a click starts its slide from the right moment. Which is what makes "a fifth of the way through closing, the drawer is here and the dim is this dark" an exact test rather than a sleep.

Types 1

class SidePanel : public Overlay

A drawer with a title bar that slides in over its parent from the left or right edge, dimming what is behind -- the reference's SidePanel, drawn inside the editor. The file comment covers how it closes and why it has no clock of its own.

Add it as a child of the component it should cover (usually the editor's root) and open it with showOrHide(true, now). The owner calls setInputClock(now) and tick(now) on every frame, or the slide never moves. The content is not owned and must outlive the panel or be replaced first. Message thread only.

↑↓ to move↵ to openEvery public name in the headers, and every guide