Skip to main content

Module instances

Module instances 

Source
Expand description

Panel instances: a panel declared with several (PanelSpec::instances, Instances::Multiple) opens as many times as asked.

Experimental: may change in any release (docs/stability.md).

The panel declared is instance 1; each new one is <kind>#<n> (PanelId::instance), still a PanelId, so the dock, the focus, the fault boundary and the panel menu treat it as any panel. One draw function draws them all (Ctx::instance_panel), told which Instance it draws. Each instance holds a payload the application owns (opaque JSON): kept in the layout (Layout::instances), saved with it and handed back on restore (AppHandle::instance_payload, AppHandle::set_instance_payload).

pop.panel.open with instance: "new" opens a new one where it is asked; closing an instance drops it with its payload (closing the panel declared keeps its place, as any panel’s). The journal says both: panel.instance.opened and panel.instance.closed ({ "panel": <id>, "kind": <kind> }).

An instance’s tab title is the kind’s with its number (“Gallery 2”) until the application names it: pop.panel.retitle (AppHandle::set_instance_title) keeps the title in the layout’s instance entry, saved and restored with it, and null gives the generated one back. The journal says panel.instance.retitled ({ "panel": <id>, "kind": <kind>, "title": <title or null> }).

Structs§

Instance
The instance a panel’s draw function draws.

Constants§

EVENT_CLOSED
The journal’s event when an instance closes (its payload dropped).
EVENT_OPENED
The journal’s event when an instance opens.
EVENT_RETITLED
The journal’s event when an instance’s title changes (pop.panel.retitle); title is null when the generated one is back.

Type Aliases§

InstanceDrawFn
Draws an instance of a panel declared with several.