Skip to main content

AppHandle

Struct AppHandle 

Source
pub struct AppHandle(/* private fields */);
Expand description

The application at run time, cheap to clone: blocks, panels, stories and command handlers reach services, the store and the command runner through it.

Implementations§

Source§

impl AppHandle

Source

pub fn local<T>(&self) -> Rc<T>
where T: Default + 'static,

The state of type T kept on the application side, made on first use: one value per type and per application, shared by its windows and gone with it. A plugin or a host keeps its own state there under a type of its own (a private type keeps others out).

Source

pub fn debug_describe(&self) -> Value

The debug bridge’s collectors, their descriptions and actions.

Source

pub fn debug_capabilities(&self) -> Value

Every capability an agent may name, as one list of PROTOCOL 1: { "protocol", "capabilities": [..] }. The collectors’ actions (kind: "action", see DebugBridge::capabilities), then every command (kind: "command", name its id, called through commands.run with { "id", "args" }): description, mutates (not read-only), agent, args (a JSON Schema, or null), example (its free description of the arguments when not a schema), result (null) and call. bridge.describe answers it to an agent.

Source

pub fn debug_bridge_mode(&self) -> BridgeMode

The debug bridge’s mode now (AppBuilder::debug_bridge): what it lets anyone but the user do. A transport out of the process (egui-pop-agent) reads it to refuse snapshots when it is Off.

Source

pub fn debug_snapshot(&self) -> Value

Every collector’s snapshot.

Source

pub fn window_group_named( &self, window: Option<&str>, ) -> Result<ViewportId, String>

The window group an agent’s call names (an application window’s id, main for the main window), or the active window’s without one (ADR 0025).

Source

pub fn command_args_refusal( &self, command: &CommandId, args: &Value, ) -> Option<String>

Why args may not run command: they do not match its JSON Schema (CommandSpec::schema), as refused by pop.command.args: .... None when they match, when its arguments are only described, or for a command that is not there. Every run is checked so before its handler; this asks before (the bridge’s commands.run, to answer an agent at once).

Source

pub fn debug_destructive( &self, collector: &str, action: &str, args: &Value, ) -> bool

Whether this bridge call destroys or discards what cannot easily be had back: an action declared so, commands.run of a destructive command (CommandSpec::destructive) or of a call its arguments make destructive (CommandSpec::destructive_if). The agent socket asks the user before it runs such a call for an agent.

Source

pub fn debug_mutates(&self, collector: &str, action: &str, args: &Value) -> bool

Whether this bridge call changes the application (its collector says so for these arguments); true for an action the bridge does not know, as a call treats it. The agent socket’s grants hold a read-only agent to the calls that do not.

Source

pub fn debug_refusal( &self, collector: &str, action: &str, args: &Value, origin: &Origin, ) -> Option<String>

Why origin may not make this bridge call (its mode, the action’s agent flag), None when it may or when there is no such action. The call itself is refused the same way; this asks before (the agent socket, before asking the user to confirm).

Source

pub fn debug_snapshot_in(&self, window: Option<&str>) -> Result<Value, String>

Every collector’s snapshot, seen from a window (an application window’s id; the active window without one): the dialog shown there, the context its commands run in.

Source

pub fn debug_call_in( &self, window: Option<&str>, collector: &str, action: &str, args: &Value, origin: Origin, ) -> Feedback

Calls a collector’s action for origin in a window (an application window’s id; the active window without one): a command runs in that window’s context (appWindow, modalOpen), and what it opens (a dialog, a toast, the palette) shows there; dialogs.answer answers the dialog shown there.

Source

pub fn debug_call( &self, collector: &str, action: &str, args: &Value, ) -> Feedback

Calls a collector’s action as the agent (Origin::Agent("debug-bridge")); always returns a feedback block. An action not offered to agents is refused, and every call goes through the STEP_DEBUG_CALL step (see AppHandle::debug_call_as). commands.run is queued here (the App runs it before the next frame); App::debug_call runs it at once.

Source

pub fn debug_call_as( &self, collector: &str, action: &str, args: &Value, origin: Origin, ) -> Feedback

Calls a collector’s action for origin: the agent’s calls go through AppHandle::debug_call, the user’s (the devtools panel, a debug page) come here with Origin::User. Only the user may call an action not offered to agents: for anyone else it is refused, in the bridge’s log and on the journal (debug.call.refused, from the caller). Every other call runs through the STEP_DEBUG_CALL step, which a plugin may veto (debug.call.vetoed on the journal).

Source

pub fn debug_log(&self) -> Vec<Feedback>

The feedback blocks of the last bridge calls.

Source

pub fn key_traces(&self) -> Vec<Trace>

The last key resolutions, oldest first.

Source

pub fn pending_keys(&self) -> Option<String>

The chords of a shortcut in progress.

Source

pub fn egui(&self) -> Context

The egui context the application draws in.

Source

pub fn arrangement_strings(&self) -> ArrangementStrings

The texts naming an arrangement of the panels, the application’s (AppBuilder::arrangement_strings) or egui-pop’s.

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

pub fn name(&self) -> String

The application’s name (AppBuilder::name); empty when none was given.

Source

pub fn app_id(&self) -> String

The application’s id (AppBuilder::app_id), reverse-DNS (org.example.App); empty when none was given.

Source

pub fn store(&self) -> Arc<Mutex<Store>>

The value store.

Source

pub fn value<T>(&self, path: &str) -> Option<T>
where T: Bindable,

The value at path in the store, as T (None: not declared, or not a T): app.value::<f64>("swatch/hue").

Source

pub fn setting<T>(&self, id: &SettingId) -> Option<T>
where T: Bindable,

A setting’s value, as T (None: not declared, or not a T): app.setting::<bool>(&SHOW_CODE), read at settings/<id>.

Source

pub fn persist(&self) -> Option<Persist>

The persistence directory (AppBuilder::persist), if one was given.

Source

pub fn save_later(&self, name: &str, text: String) -> bool

Writes a document under the persistence directory about a second after its last change (the debounced writer of egui_pop_core::persist): offering the same text again does nothing, a new one moves the deadline. false without a directory. Pending documents are written at the deadline, by AppHandle::flush_documents and by App::save.

Source

pub fn saved_already(&self, name: &str, text: &str)

Records that a document’s text is on disk (just loaded): AppHandle::save_later writes it again only once it changes.

Source

pub fn flush_documents(&self) -> Vec<(String, Result<(), PersistError>)>

Writes every document waiting in the debounced writer now; what was written and how it went.

Source

pub fn pending_documents(&self) -> Vec<String>

The documents waiting in the debounced writer.

Source

pub fn publish(&self, source: &str, cause: Option<u64>, name: &str, data: Value)

Appends an event to the host’s journal (held until the host is free when published from a command it is running).

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

pub fn events_since(&self, seq: u64) -> Vec<Event>

The journal’s events after seq (empty while the host is dispatching), read through the host.

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

pub fn can_undo(&self) -> bool

Whether Ctrl+Z would undo something now, in the history focus picks (crate::history::target; false while the host dispatches a command).

Source

pub fn can_redo(&self) -> bool

Whether Ctrl+Shift+Z would redo something now.

Source

pub fn undo_label(&self) -> Option<String>

What an undo would take back (“exposure change”).

Source

pub fn redo_label(&self) -> Option<String>

What a redo would do again.

Source

pub fn command_title(&self, spec: &CommandSpec) -> String

A command’s title as menus show it now, in the interface’s language: the application’s live title when it gives one on pop.command.label (command_text); else the declared title, undo and redo naming what they would do (“Undo exposure change”).

Source

pub fn command_tooltip(&self, spec: &CommandSpec) -> String

A command’s tooltip as menus show it now: the application’s live tooltip when it gives one on pop.command.label (command_text), else the declared description, translated (empty stays empty).

Source

pub fn command_menu_title(&self, spec: &CommandSpec) -> String

A command’s title as a menu, a toolbar or the tray shows it: its command_title without the trailing hint of its arguments, which the palette keeps (strings::without_argument_hint).

Source

pub fn undo(&self, origin: &Origin) -> Outcome

Undoes through the STEP_UNDO step, in the history focus picks (crate::history::undo): its hooks, then (unless a run-hook replaces it) the owner’s undo; the journal says how it went. What edit.undo runs.

Source

pub fn redo(&self, origin: &Origin) -> Outcome

Redoes through the STEP_REDO step.

Source

pub fn overlay_rects(&self) -> Vec<OverlayRect>

Every overlay on screen, bottom first, with where it was drawn last: dialogs, modals, popovers and menus of the overlay stack, the toast stack, then egui’s popups. What an application keeps its own hit-testing and pictures right with, without egui-pop’s internal ids. They are the window’s being drawn (the main window outside a pass): each window has its own overlays.

Source

pub fn last_event(&self) -> u64

The journal’s last sequence number, as the host says.

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

pub fn step( &self, step: &StepId, args: Value, default: impl FnOnce(&AppHandle, &Value) -> Result<Value, String>, ) -> Outcome

Runs a step (ADR 0011): its before-hooks (veto, redirect), its run-hook or default, its after-hooks; publishes the step on the journal and keeps a trace. Hooks run without any registry borrowed: they may run other steps or ask for commands.

Source

pub fn steps(&self) -> Vec<StepInfo>

The declared steps, with their hooks (owner, kind), in declaration order.

Source

pub fn step_traces(&self) -> Vec<StepTrace>

The last runs of steps, oldest first.

Source

pub fn list_items(&self, name: &str, cx: &WhenContext) -> Vec<ListItem>

The entries of a list (MenuItem::list), asked of its provider (the last registered for the name) in a context; empty without one. Menus ask when they open; what it gave is kept for the lists collector.

Source

pub fn lists(&self) -> Value

The list providers (name, owner) and what each gave last.

Source

pub fn running(&self, id: &CommandId) -> bool

Whether a run of this command waits for its result.

Source

pub fn running_since(&self, id: &CommandId) -> Option<f64>

When the command’s waiting runs started, by the motion clock (egui_pop_core::motion::now): what a busy indicator’s delay counts from. None when no run waits.

Source

pub fn service<T>(&self, token: &ServiceToken<T>) -> Option<Arc<T>>
where T: Send + Sync + 'static,

A service, typed.

Source

pub fn theme(&self) -> Arc<ThemeService>

The theme service.

Source

pub fn run(&self, command: CommandId, args: Value)

Asks for a command, run before the next frame for whoever the code asking acts for (AppHandle::acting_origin): the user, or the origin of the command whose handler asks. A command an agent started runs the commands it starts as that agent.

Source

pub fn run_as(&self, command: CommandId, args: Value, origin: Origin)

Asks for a command with an origin. While a command runs for anyone but the user, its handler may not claim the user’s origin, and one running for an agent may not claim any other than an agent’s: such a request is refused, on the journal (command.refused, from the origin acting) and in the log. To act for the user, ask the user (a dialog: the user’s answer runs its command as the user).

Source

pub fn acting_origin(&self) -> Origin

Who the code running now acts for: the origin of the innermost command whose handler (or host dispatch) is running, else the user. A command’s handler gets it as Call::origin too.

Source

pub fn set_plugin_enabled(&self, plugin: PluginId, enabled: bool)

Asks for a plugin to be connected or disconnected before the next frame.

Source

pub fn set_context(&self, key: &str, value: &str)

Sets an application-wide context key (depth 0), for when clauses. The context stack’s own keys (place, placeDepth, modePushed, mode.*) are its projection’s: a plugin setting one by hand is reported (contexts::hand_writes, a diagnostic) while the stack is connected.

Source

pub fn context(&self) -> WhenContext

The application-wide context keys.

Source

pub fn when_context(&self) -> WhenContext

The context keys at this moment: application-wide, then the focus chain’s, the overlays’. They are the window’s being drawn: in a detached panel’s window, its focus chain and its overlays, and window holds the panel’s id (empty in the main window); appWindow names the application window (ADR 0025); focusedPanel is the window group’s own: the workbench’s focused panel in the main window and its detached panels, an application window’s last focused panel in it (empty when none); focusedPanelKind, that panel’s kind (PanelId::kind: the panel’s own id, or app.gallery for its instance app.gallery#2); modalOpen says whether a modal is open in the window’s group (an application window’s own, or the main window’s with its detached panels: a modal in one application window does not make !modalOpen refuse in another). Asked for another window group than the one being drawn (a command a window’s content asked for, an agent’s call naming a window), appWindow, window and modalOpen are that group’s; the focus chain’s keys stay the window being drawn’s; overlayOpen, whether egui-pop’s overlay stack holds anything or an egui popup (a menu, a combo box’s list) is open.

Source

pub fn window_name(&self, window: ViewportId) -> String

A window’s name for agents: main, or its detached panel’s id.

Source

pub fn describe_windows(&self) -> Value

What the windows collector shows: the active window, each window’s overlays, where the palette and the popup menu are.

Source

pub fn window_panel(&self, window: ViewportId) -> Option<PanelId>

The panel a window shows: the detached panel of a detached panel’s window (workbench::window_id); None for the main window, or a window that is no longer open.

Source

pub fn active_window(&self) -> ViewportId

The window the user worked in last (focused, clicked or typed in), still open: the main window (ViewportId::ROOT), a detached panel’s or an application window’s. A dialog opens over it. The registry holds it (pop.window.activate, AppHandle::active_window_id).

Source

pub fn diagnostics(&self) -> Vec<Diagnostic>

The diagnostics collected (registration, zones, hooks), then the store’s (writes from plugins that are not a path’s writers).

Source

pub fn menu_ids(&self) -> Vec<MenuId>

The menus declared, by id.

Source

pub fn menu(&self, menu: &MenuId) -> Vec<MenuItem>

A menu’s items after the hooks.

Source

pub fn palette(&self) -> Vec<PaletteEntry>

The palette’s entries after the hooks.

What the command palette lists for query, best first: the entries that apply now, matched on their label in the interface’s language (Category: Title), the recent ones winning ties, as the palette ranks them (palette::rank_with).

Source

pub fn settings(&self) -> Vec<SettingEntry>

The settings form’s entries after the hooks.

Source

pub fn command_gone_with(&self, id: &CommandId) -> Option<PluginId>

The plugin a command went with, when it was declared by a plugin now disconnected (ADR 0028): what a toast’s greyed action and a refused run name.

Source

pub fn dormant_keys(&self) -> Vec<DormantKey>

The key bindings kept dormant (ADR 0028): those of the user, the workspace or another plugin whose command went with a plugin now disconnected, each with that plugin. They take no key (it goes to the next binding of it) and are live again when the plugin reconnects; a shortcuts editor lists them apart.

Source

pub fn command(&self, id: &CommandId) -> Option<CommandSpec>

A command’s declaration.

Source

pub fn icon_set_by(&self, id: &CommandId) -> Option<OwnerId>

The plugin that set a command’s icon over its declaration (Ctx::command_icon), if one did.

Source

pub fn rebind(&self, command: CommandId, keys: Option<String>)

Asks for a command’s keys to be the user’s own (None: no key), saved in the user’s keymap; applied before the next frame.

Source

pub fn rebind_in(&self, layer: Layer, command: CommandId, keys: Option<String>)

Asks for a command’s keys in layer: the user’s (saved in the user’s keymap) or the workspace’s (kept by the application, which reads it back with AppHandle::export_keymap); applied before the next frame, through the keys.rebind step. Another layer is refused there.

Source

pub fn rebind_gestures(&self, layer: Layer, command: CommandId, keys: &[&str])

Asks for a command’s keys in layer, several at once (a pointer gesture’s triggers: Wheel, Ctrl+Scroll, Pinch; none: no key), through the keys.rebind step (keys an array).

Source

pub fn reset_keys(&self, command: CommandId)

Asks for a command’s default keys back.

Source

pub fn reset_keys_in(&self, layer: Layer, command: CommandId)

Takes back what layer (the user’s or the workspace’s) changed of a command’s keys, before the next frame.

Source

pub fn rebound_in(&self, layer: Layer, id: &CommandId) -> bool

Whether layer (the user’s or the workspace’s) changed a command’s keys.

Source

pub fn key_sources(&self, id: &CommandId) -> Vec<Binding>

A command’s live bindings, each with the layer it comes from.

Source

pub fn offer_workspace_keys(&self, on: bool)

Whether the shortcuts editor offers to change keys for the workspace as well as for the user (off by default: an application with workspaces turns it on, and keeps the workspace’s layer).

Source

pub fn workspace_keys_offered(&self) -> bool

Whether the shortcuts editor offers the workspace’s keys.

Source

pub fn name_key_sources(&self, f: impl Fn(&Binding) -> Option<String> + 'static)

How the shortcuts editor names where a binding comes from: f gives a name, in the interface’s language, or None for the default one (AppHandle::key_source_name).

Source

pub fn key_source_name( &self, ctx: &Context, binding: &Binding, ) -> Option<String>

Where a binding comes from, as the shortcuts editor says it after its keys: the host’s name for it, else workspace or user; nothing for the application’s defaults.

Source

pub fn capture_keys(&self, on: bool)

While on, key presses reach the interface instead of the key dispatcher (a shortcuts editor capturing new keys).

Source

pub fn keys_captured(&self) -> bool

Whether a shortcuts editor captures the keys (Self::capture_keys).

Source

pub fn key_conflicts_by_scope( &self, ) -> BTreeMap<String, Vec<(Binding, Binding)>>

AppHandle::key_conflicts by scope (global, surface:<name>).

Source

pub fn declare(&self, owner: &OwnerId, spec: CommandSpec)

Declares a command after build, owned by owner (a host’s own registry changing at run time), with the rules and traces of Ctx::declare: its keys, menus and palette entry follow before the next frame, with no plugin reconnected. A refusal is logged and published (command.declare_failed).

Source

pub fn undeclare(&self, id: &CommandId)

Removes a command declared after build, with its keys and menu items, before the next frame.

Source

pub fn export_keymap(&self, layer: Layer) -> KeymapDoc

A layer’s bindings, whoever declared them, as a keymap document (scopes, when clauses, every key): a profile to save.

Source

pub fn load_keymap(&self, doc: KeymapDoc, layer: Layer) -> KeymapDiff

Loads a keymap document into the user’s (or the workspace’s) layer, replacing what was loaded there, before the next frame (the keys.load step). Returns what it will change against the layer as it stands; conflicts are published once applied (keys.conflict). App::load_keymap does it at once.

Source

pub fn key_conflicts(&self) -> Vec<(Binding, Binding)>

Bindings losing to another on the same keys (loser, winner): what a shortcuts editor shows as conflicts.

Source

pub fn rebound(&self, id: &CommandId) -> bool

Whether the user changed a command’s keys.

Source

pub fn applies(&self, id: &CommandId, cx: &WhenContext) -> bool

Whether a command applies in a context (its when clause holds).

Source

pub fn keys_for(&self, id: &CommandId) -> Vec<String>

A command’s live key bindings, as shown (Ctrl+K Ctrl+S).

Source

pub fn system_bindings(&self) -> Vec<Binding>

The live key bindings of the system scope (BindOptions::system()): what a plugin registers with the desktop as global shortcuts, current after each rebuild (On::Rebuilt).

Source

pub fn commands(&self) -> Vec<(CommandSpec, OwnerId)>

Every command (spec and owner).

Source

pub fn history(&self) -> Vec<Run>

The last command runs, oldest first.

Source

pub fn plugins(&self) -> Vec<PluginInfo>

The plugins, in connection order.

Source

pub fn zones(&self) -> Vec<ZoneInfo>

The zones with their resolved blocks.

Source

pub fn services(&self) -> Vec<(String, OwnerId, &'static str)>

The services: id, owner, type.

Source

pub fn zone_has_blocks(&self, zone: &ZoneId) -> bool

Whether a zone has blocks to draw.

Source

pub fn show_zone(&self, ui: &mut Ui, zone: &ZoneId)

Draws a zone’s blocks, each in a fault boundary. A zone nobody declared draws nothing (and was reported when zones were resolved).

Source

pub fn stories(&self) -> Vec<StoryInfo>

The stories, by group then weight.

Source

pub fn show_story(&self, ui: &mut Ui, id: &StoryId) -> bool

Draws a story; false when there is no such story.

Source

pub fn show_playground(&self, ui: &mut Ui, id: &StoryId) -> bool

Draws a story’s playground; false when it has none.

Source

pub fn edge_to_edge(&self) -> bool

Whether the centre is drawn edge to edge.

Source

pub fn frameless(&self, area: Area) -> bool

Whether an area is drawn without a frame (AppBuilder::frameless): no margin around it, its panels’ bodies without margin, border or rounded corners.

Source

pub fn bare_strip(&self, area: Area) -> bool

Whether a side area’s folded strip is bare (AppBuilder::bare_strips): its grip alone, no icon per panel.

Source

pub fn set_shell_panel_min_size(&self, panel: PanelId, size: Option<ShellSize>)

Sets a shell panel’s least size across its area while the application runs, as AppBuilder::shell_panel_min_size does at build time: a size its content needs, measured with the fonts and the text size of the moment (a header’s row of buttons), set each frame or when it changes. The area widens to it on the next pass, in the main window or in the application window that holds the panel; the user’s drag stops there. None puts back the panel’s own least (PanelSpec::min_size, or egui-pop’s).

use egui_pop_api::App;
use egui_pop_api::workbench::PANEL_SIDE_BAR;

let app = App::builder().build(&egui::Context::default()).unwrap();
let handle = app.handle();
handle.set_shell_panel_min_size(PANEL_SIDE_BAR, Some(341.0.into()));
assert_eq!(handle.shell_panel_min_size(&PANEL_SIDE_BAR), Some(341.0.into()));
handle.set_shell_panel_min_size(PANEL_SIDE_BAR, None);
assert_eq!(handle.shell_panel_min_size(&PANEL_SIDE_BAR), None);
Experimental: may change in any release (docs/stability.md).
Source

pub fn set_shell_panel_max_size(&self, panel: PanelId, size: Option<ShellSize>)

Sets a shell panel’s largest size across its area while the application runs, as AppBuilder::shell_panel_max_size does at build time; None: no largest size.

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

pub fn shell_panel_min_size(&self, panel: &PanelId) -> Option<ShellSize>

A shell panel’s least size the application set, at build time or since; None when it set none.

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

pub fn shell_panel_max_size(&self, panel: &PanelId) -> Option<ShellSize>

A shell panel’s largest size the application set, at build time or since; None when it set none.

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

pub fn centre_min_size(&self) -> Option<ShellSize>

The centre’s least width the application set (AppBuilder::centre_min_size).

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

pub fn system_text_scale(&self) -> SystemTextScale

The system’s text scaling the text size was seeded from (AppBuilder::system_text_scale; 1 when none was given).

Source

pub fn system_always_shows_scroll_bars(&self) -> bool

Whether the system always shows its scroll bars (AppBuilder::system_always_shows_scroll_bars).

Source

pub fn system_wheel_lines(&self) -> u32

The system’s lines a wheel’s notch (AppBuilder::system_wheel_lines; 3 when none was given).

Source

pub fn menu_bar(&self) -> bool

Whether the main menu is drawn as a bar under the title (AppBuilder::menu_bar).

Source

pub fn system_file_chooser(&self) -> bool

Whether the application allows the system’s file chooser (AppBuilder::system_file_chooser): off by default.

Source

pub fn transparent_panel_windows(&self) -> bool

Whether detached panels’ windows are built transparent where the platform gives a surface below them (AppBuilder::transparent_panel_windows): off by default.

Source

pub fn rounded_windows(&self) -> bool

Whether the windows the application decorates are built transparent for rounded corners (AppBuilder::rounded_windows).

Source

pub fn panel_visible(&self, id: &PanelId) -> bool

Whether a panel is shown (docked or detached, not closed).

Source

pub fn set_panel_visible(&self, id: &PanelId, visible: bool)

Shows or closes a panel (the workbench.show and workbench.hide steps; a palette opens through palette.open).

Source

pub fn layout(&self) -> Layout

The workbench’s layout as it stands: areas, tabs and splits, detached panels, closed panels.

Source

pub fn saved_layout(&self) -> SavedLayout

The layout as saved: AppHandle::layout and the places kept for panels no longer declared, which go back there when declared again (ADR 0028).

Source

pub fn set_layout(&self, layout: Layout) -> Vec<String>

Puts in a layout (loaded, or an arrangement), repaired against today’s panels and screens; says what the repair changed.

Source

pub fn panels(&self) -> Vec<PanelSpec>

The declared panels.

Source

pub fn declared_panels(&self) -> Vec<(PanelSpec, OwnerId)>

Every declared panel with the plugin that declared it (its OwnerId), in declaration order: the application’s panels and those of the plugins it connected, egui-pop’s among them (the jobs centre, egui_pop.jobs; the devtools). A host that checks layouts or templates against its own panels accepts these too, so a template may place a plugin’s panel. Unlike Self::panels, a zone shown as a panel is listed even while it has no blocks.

Source

pub fn drop_hint(&self) -> Option<DropHint>

The drop hint on screen, while a tab is dragged (where it would land, in its area or another) or a palette over an area it docks in.

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

pub fn window_drop(&self) -> Option<WindowDrop>

The detached window under a dragged tab, where letting it go moves it (as a tab), found in the last pass: None while no tab is dragged over one.

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

pub fn window_outlines(&self) -> Vec<PanelId>

The detached windows outlined in the last pass: a tab is dragged out of the main window, where the system hides window positions (Wayland), and these windows may take it, though none can tell the pointer is over it until it is let go.

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

pub fn focused_panel(&self) -> Option<PanelId>

The panel the keys obey, the context key focusedPanel: the last that held the widget focus, had the pointer pressed in it or was given the keyboard (crate::workbench’s “The focused panel”).

Source

pub fn change_workbench(&self, change: Change) -> Option<Outcome>

Changes the workbench through its step (ADR 0011): None when asked while the areas are drawn (it is done at the frame’s end).

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

pub fn set_zen(&self, on: bool) -> Option<Outcome>

Starts zen mode (only the centre is shown) or ends it (workbench.zen).

Source

pub fn set_zen_panel(&self, panel: &PanelId) -> Option<Outcome>

Starts zen mode on one panel (workbench.zen with panel): the panel alone, full size, in the window holding it, a detached window’s included; the layout is left as it is, so leaving zen mode (Self::set_zen with false) draws it unchanged. A panel that is not open is refused. None when asked while the areas are drawn: it runs at the frame’s end.

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

pub fn zen(&self) -> bool

Whether zen mode is on.

Source

pub fn zen_panel(&self) -> Option<PanelId>

The panel zen mode shows alone, while it shows one (none: off, or the centre whole).

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

pub fn zen_target(&self) -> Option<PanelId>

The panel zen mode would show now, without one named: the focused panel when it is a view or mixed one, else the application’s choice (pop.zen.panel), else the centre’s active tab; each one open. None: the centre whole.

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

pub fn area_rect(&self, area: Area) -> Option<Rect>

Where an area was drawn in the last pass (none while it is not shown, folded included).

Source

pub fn arrange(&self, panel: &PanelId, how: Arrangement) -> Option<Outcome>

Lays out the row, column or grid holding a panel’s group again (workbench.arrange; refused for a group alone in its area).

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

pub fn fold_area(&self, area: Area, folded: bool) -> Option<Outcome>

Folds an area to its strip, or unfolds it (workbench.fold).

Source

pub fn fold_window_area( &self, window: &str, area: Area, folded: bool, ) -> Option<Outcome>

Folds an application window’s area to its strip, or unfolds it (workbench.fold with window): a side area keeps a strip with its panels’ icons, each opening its panel as a flyout; the bottom goes out of sight. Refused for a window without areas and for the centre; window the main window’s id folds the main window’s.

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

pub fn open_flyout(&self, panel: &PanelId, open: bool) -> Option<Outcome>

Opens a folded side area’s panel alone over the centre, as a click on its strip icon does, or closes it (workbench.flyout; refused for a panel not in a folded side area).

Source

pub fn flyout(&self) -> Option<(PanelId, Option<Rect>)>

The panel shown as a flyout, and where it was drawn in the last pass (none before it is drawn).

Source

pub fn place_area(&self, area: Area, placement: Placement) -> Option<Outcome>

Lays a side area beside the centre or over it (workbench.place; refused for the centre and the bottom area).

Source

pub fn area_placement(&self, area: Area) -> Placement

Where a side area lies now (beside the centre, or over it).

Source

pub fn indicators(&self) -> Vec<(Indicator, IndicatorState)>

The indicators and their states, lightest first.

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

pub fn move_panel(&self, panel: &PanelId, area: Area) -> Option<Outcome>

Moves a panel to an area (workbench.move); refused when its rules keep it out.

Source

pub fn move_to_window( &self, panel: &PanelId, window: &PanelId, ) -> Option<Outcome>

Moves a panel into the detached window holding window (a panel of it), as a tab (workbench.join_window).

Source

pub fn detach_panel(&self, panel: &PanelId) -> Option<Outcome>

Moves a panel to a window of its own (workbench.detach).

Source

pub fn attach_panel(&self, panel: &PanelId) -> Option<Outcome>

Docks a detached panel back in its area (workbench.attach).

Source

pub fn focus_panel(&self, panel: &PanelId) -> Option<Outcome>

Shows a panel and gives it the keyboard (workbench.focus): it is the focused panel at once, and in the next pass the panel itself holds the focus (its own stop, from which Tab enters its widgets), or the widget it named with focus::prefer (crate::workbench’s “The focused panel”).

Source§

impl AppHandle

Source

pub fn request_window_activate(&self, request: WindowRequest) -> bool

Asks for a window to become the active one, the window worked in (pop.window.activate, ADR 0029): the registry holds it as active, and with the reason command it is brought to the front. Its listeners run now, in their declared order; window.activated is said after the last one when the active window changed. A window not in the registry is refused, said as window.refused. Whether it ran.

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

pub fn active_window_id(&self) -> String

The active window’s id in the registry (main, an application window’s id, panel:<id>).

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

pub fn raise_viewport(&self, v: ViewportId, owner: &str) -> bool

Asks the window a viewport draws (the main window, a detached panel’s, an application window’s) to the front: pop.window.activate with the reason command, as Self::request_window_activate does for a registry id. Use it rather than ViewportCommand::Focus, which would leave the registry’s active window behind. Whether it ran: false for a viewport no window of the registry draws.

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

impl AppHandle

Source

pub fn set_panel_topology( &self, of: impl Fn(&AppHandle, &PanelId, Option<&PanelId>) -> Option<String> + 'static, )

Says which topology the application puts a panel in, for DrawingPanel::topology: given the panel and the window holding it, a name of the application’s (a group of panels working together), or None. Called only when a reader asks.

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

impl AppHandle

Source

pub fn request_files_drop(&self, drop: FileDrop) -> Vec<String>

Asks for files dropped on a window (pop.files.drop): its listeners run now, in their declared order, each that takes them saying so; then files.dropped is said with what they did, or files.refused when none took them or the window is not open. What they did, one line each.

Every window’s pass asks it for the files the system dropped on it; an application or a test may ask it too.

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

impl AppHandle

Source

pub fn report(&self, notice: Notice) -> NoticeId

Raises a notice (pop.notice.raised): the one call for a message to the user. Given no id, it gets the next of the application’s (n<seq>); given no time, now. Its id. The routing policy (AppHandle::route_notices) picks the views that show it.

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

pub fn resolve_notice(&self, id: impl Into<NoticeId>)

Says a condition ended (pop.notice.resolved).

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

pub fn see_notice(&self, id: impl Into<NoticeId>)

Says a notice was read (pop.notice.seen).

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

pub fn dismiss_notice(&self, id: impl Into<NoticeId>)

Says the user put a notice away (pop.notice.dismissed).

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

pub fn see_notices(&self, ids: impl IntoIterator<Item = NoticeId>)

Says notices were read (pop.notice.seen), in one message.

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

pub fn dismiss_notices(&self, ids: impl IntoIterator<Item = NoticeId>)

Says the user put notices away (pop.notice.dismissed), in one message.

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

pub fn notices(&self) -> Vec<Kept>

The last notices raised, oldest first, as NOTICE_STORE keeps them (at most NoticeStore::DEFAULT_BOUND, none older than NoticeStore::DEFAULT_MAX_AGE_MS but errors not seen yet).

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

pub fn set_notice_limits(&self, bound: usize, max_age_ms: u64)

How many notices the store keeps (500 by default) and for how long, in milliseconds (30 days by default); an error not seen yet stays until it is seen.

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

pub fn route_notices(&self, policy: impl NoticeRouting + 'static)

Installs the application’s routing policy in place of egui-pop’s (default_route): it picks the views of each notice raised from now on. A closure Fn(&Notice, &RouteCx) -> Route is one.

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

pub fn notice_route(&self, id: &NoticeId) -> Option<Route>

The route a kept notice was given.

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

pub fn notice_badge(&self) -> NoticeBadge

What the status bar’s badge counts now.

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

pub fn run_reported( &self, command: CommandId, args: Value, place: impl Into<String>, )

Runs a command for the user, as AppHandle::run does; if it fails, its failure is reported (a CommandError made a notice, origin user) at place, where the routing policy shows it (by default, a note in the notice site of place if one is drawn, else a toast). A failure is never silent.

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

pub fn take_failure(&self, command: &CommandId) -> Option<CommandError>

The failure of command’s last run, structured, once its result is in: the CommandError its handler told with Call::fail (headline, reason, hint, details), or one made from the text of any other failure (user off). Taken: a second call returns None, and a run that succeeds clears it.

App::run and AppHandle::run give a failure’s text only (Result<Json, String>); this gives the rest, for an application that reports the failure itself:

fn restore(app: &mut App, command: &CommandId) {
    let reply = app.run(command, serde_json::json!({}), Origin::User);
    if let Some(Err(_)) = reply.now()
        && let Some(err) = app.handle().take_failure(command)
    {
        app.handle().report(err.to_notice("The restore did not work"));
    }
}
Experimental: may change in any release (docs/stability.md).
Source§

impl AppHandle

Source

pub fn name_overlay( &self, id: Id, window: ViewportId, popup: String, owner: &str, )

Names the popup an overlay of the stack (or an egui popup it follows) is in the registry while shown in window, and its owner: palette@main, egui_pop.palette. Call it before showing it; a popup not named is overlay:<id>@<window>, owned by OVERLAY_OWNER.

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

impl AppHandle

Source

pub fn request_popup_open(&self, request: WindowRequest) -> bool

Asks for a popup (pop.popup.open, kind WindowKind::Popup) in its parent window, which must be open, with an owner: its listeners all run now, the registry holding it, and popup.opened follows. A popup of that id already held is held again under this request. A refusal is said as popup.refused. Whether it opened.

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

pub fn request_popup_close(&self, request: WindowRequest) -> bool

Asks for a popup’s close (pop.popup.close): its listeners all run now, its owner’s first (what it showed ends: a dialog or a file choice cancelled), then the registry; popup.closed follows. A popup not open is refused (popup.refused). Whether it closed.

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

pub fn request_native_open(&self, request: WindowRequest) -> bool

Asks for a native window egui does not paint (pop.window.open, kind WindowKind::Native: the system’s file chooser, a web view’s own window) as a child of an open window, with an owner: the registry holds it and window.opened follows. It closes by its pop.window.close (AppHandle::request_window_close), and with its parent. A refusal is said as window.refused. Whether it opened.

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

pub fn registry_window_of(&self, viewport: ViewportId) -> String

The registry id of the window a viewport shows: the main window, an application window, a detached panel’s window; the main window’s when none is held for it. The parent to name for a popup or a native window opened from a pass of that viewport.

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

impl AppHandle

Source

pub fn deliver_settings(&self)

Says each setting changed since the last time as pop.settings.changed, once, in the order the value store wrote them: its listeners run now, on this thread. A listener writing a setting is followed in the same call. Asked from inside a delivery, it returns at once: the delivery running takes it.

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

impl AppHandle

Source

pub fn request_window_reparent(&self, request: WindowRequest) -> bool

Asks for a window’s content to move to another window (pop.window.reparent): parent main moves an application window’s content into the main window (its own window goes); no parent moves the content the main window holds back to a window of its own. Its listeners all run now, in their declared order; a before-hook on the window.reparent step may veto it (window.refused). Whether it moved.

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

impl AppHandle

Source

pub fn listen_local_in<P>( &self, window: &WindowId, id: impl Into<String>, opts: ListenOpts, run: impl Fn(&<P as Point>::Input, &mut <P as Point>::Value) -> Result<(), HookError> + 'static, ) -> Result<(), Refused>
where P: Point,

Registers a local listener on P under id for the window window: each time it runs, that window is woken, so what it changed is drawn there within one frame. Bound to the calling thread (the interface’s), as [bus_contract::Bus::listen_local_any].

An emit on this thread runs it inline and asks for a pass of the window. An emit from another thread queues it: the bus waker asks for the main window’s pass, which runs it (AppHandle::run_pending; a request asked for after the drawing is heard at the main window’s drain), and its run then asks for the window’s pass. The main window is woken as before; the window is woken as well, rather than redrawn by hand. A window drawn in the main one (the main window itself, a detached panel’s, every window where the windows are embedded: the web, kittest) and a window not open wake the main window.

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

pub fn wake_window(&self, window: &WindowId)

Asks for a pass of the window window: its own viewport’s when it is an open application window with a system window of its own; else the main window’s, where it is drawn (or nothing is). Asked by a listener AppHandle::run_pending runs in the main window’s pass, the main window’s pass is not asked for: that pass has not drawn yet, so it draws what the listener changed.

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

pub fn run_pending(&self) -> Vec<PendingRun>

Runs the local listeners ([bus_contract::Bus::listen_local_any]) that emits on other threads queued for this thread, in their order, with this application as asking; their failures logged. The application calls it once per pass, before the On::Pass handlers; an emit that queues some asks for a pass.

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

pub fn ask<P>( &self, input: <P as Point>::Input, value: <P as Point>::Value, ) -> Option<u64>
where P: Point, <P as Point>::Value: Clone,

Asks the request P now and hears it after the drawing: its listeners run at the bus’s next drain on this thread (AppHandle::drain_asks), which the application makes once per pass after the panels and windows are drawn, and once more before it quits. For code that cannot be re-entered while it draws (a panel with its state borrowed). The ask’s number; None when the application’s bus does not offer the Defer capability ([bus_contract_defer::BusDefer::defer]), the caller then asking it at once or keeping it.

Asked in a detached panel’s window, drawn inside the main window’s pass, it is heard at the end of that pass. Asked in an application window (a deferred viewport, drawn on the same thread after the main window), it waits in the same queue for the main window’s next pass, which is asked for.

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

pub fn drain_asks(&self) -> Vec<PendingRun>

Runs the requests asked on this thread for after the drawing (AppHandle::ask, or [bus_contract_defer::Defer] on the application’s bus), in ask order, with this application as asking; what each did, failures logged and refusals noted. An ask made by a listener while it runs waits for the next drain. A drain that ran something asks for a pass, so what it changed is drawn. Empty when nothing waits or the bus has no Defer.

The application calls it once per pass after the panels and windows are drawn (crate::App::show) and before it quits (crate::App::exit); a host drawing the application in its own way may call it too.

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

pub fn asks_waiting(&self) -> usize

How many requests wait for this thread’s next drain (AppHandle::drain_asks): zero when the bus has no Defer.

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

pub fn bus(&self) -> Arc<dyn Bus>

The application’s bus: the one given to AppBuilder::bus, or the hook kernel egui-pop made, where its requests’ listeners are registered (ADR 0029, ADR 0030). A part that cares about a window closing listens to WindowClose under a name of its own, declaring its place (after / before the listeners of this module).

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

pub fn windows_list(&self) -> Vec<WindowRecord>

The windows and popups on screen, as the registry holds them: the main window first, then in opening order (windows.list).

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

pub fn bus_order(&self) -> String

The order the listeners of the window and popup points run in ([order_dump]).

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

pub fn request_window_close(&self, request: WindowRequest) -> bool

Asks for an application window’s close (pop.window.close): its listeners all run now, in their declared order, the owner’s state closing with it; window.closed is said after the last one. A before-hook on the window.close step may veto it, and a window not open is refused: both said as window.refused. Whether it closed.

The system window itself goes at the main window’s next pass, which no longer declares it; a pass of it in between draws its last page.

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

pub fn bus_order_of(&self, points: &[&str]) -> String

The order the listeners of the job and plugin points run in ([order_dump]).

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

pub fn request_panel_state(&self, ask: PanelStateAsk) -> Vec<String>

Asks a panel’s state (pop.panel.state): its listeners run now, in their declared order (the workbench’s keeps it for the panel’s chrome). What they did, one line each. An application holding the bus may ask it there, from any thread.

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

pub fn request_job_rows(&self, ask: JobRowsAsk) -> Vec<String>

Declares a row source in the jobs list, or replaces its rows (pop.jobs.rows): its listeners run now (the jobs plugin’s keeps them for the list). What they did, one line each. An application holding the bus may ask it there, from any thread.

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

pub fn request_job_source_drop(&self, ask: JobSourceAsk) -> Vec<String>

Takes a row source away from the jobs list (pop.jobs.source.drop), its rows with it.

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

pub fn describe_panel(&self, panel: &str) -> Option<PanelDescription>

Describes a declared panel (pop.panel.describe): its listeners run now (the workbench’s fills it from the declaration, its kind included); None for a panel nobody knows.

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

pub fn open_panel(&self, ask: PanelOpenAsk) -> Result<Vec<String>, String>

Opens a panel (pop.panel.open): its listeners run now (the workbench’s runs the workbench.show step, or queues it while the areas are drawn); what they did, one line each, or why it did not open.

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

pub fn retitle_panel(&self, ask: PanelRetitleAsk) -> Result<Vec<String>, String>

Retitles an open panel instance (pop.panel.retitle): its listeners run now (the workbench’s keeps the title in the layout’s instance entry); what they did, one line each, or why it was refused. AppHandle::set_instance_title asks it from code.

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

pub fn ui_areas(&self) -> Vec<AreaRecord>

The interactive areas of each window’s last pass (pop.ui.areas): what each writes, an edit area’s control, value and grips, and whether it is inert.

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

pub fn zen_choice(&self) -> Option<String>

The application’s choice of the panel zen mode shows (pop.zen.panel): None while no listener picks one.

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

pub fn command_text(&self, command: &CommandId) -> CommandText

What the application says of a command’s title and tooltip now (pop.command.label): empty while no listener answers.

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

pub fn panel_state(&self, panel: &str) -> PanelState

A panel’s state as last asked (pop.panel.state): ready when never asked.

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

pub fn request_job(&self, ask: JobAsk) -> Vec<String>

Asks about a job (pop.job.cancel, pop.job.pause, pop.job.resume, pop.job.retry): its listeners run now, in their declared order (the jobs plugin’s: the job shows as asked, then whoever runs it is asked); the answer comes as the runner’s job events. What they did, one line each; with nobody listening (no jobs plugin) it is refused, said as job.refused.

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

pub fn deliver_events(&self)

Delivers the journal’s events not delivered yet to the event points’ listeners (JobEvents), in journal order, once each. Each pass does it before its handlers run; a read that must see every event up to the last (a wait, a plugin going) does it first. Asked from inside a delivery, it returns at once: the delivery running goes on, and what it did not take waits for the next.

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

pub fn publish_job(&self, source: &str, kind: JobEventKind, data: Value)

Says a job event on pop.job.event (JobPublisher::publish): recorded and delivered at the next delivery.

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

pub fn job_publisher(&self) -> JobPublisher

A publisher of job events, for any thread.

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

impl AppHandle

Source

pub fn group<R, E>( &self, origin: &Origin, label: &str, f: impl FnOnce(&Group<'_>) -> Result<R, E>, ) -> Result<R, E>

Runs f in a history group labelled label: its writes are one undo step, written as origin. The group is ended when f returns Ok, cancelled (its writes put back) when it returns Err or panics. It goes through the host (Host::begin_group), or, from inside a command, through Host::groups.

Source§

impl AppHandle

Source

pub fn request_run_in( &self, command: CommandId, args: Value, context: WhenContext, )

Asks for a command to run as the user in a given context (a menu opened there), before the next frame.

Source§

impl AppHandle

Source

pub fn mountables(&self) -> Vec<Mountable>

Every component declared: this crate’s and egui-pop-core’s, then those of the connected plugins.

Source

pub fn host_offers(&self) -> Vec<HostOffer>

Every host: this crate’s, then those of the connected plugins (the viewport’s overlays among them).

Source

pub fn where_can(&self, component: &str) -> Result<Vec<Placement>, String>

Every host and its verdict for a component (ADR 0013): where it fits, under which conditions, and why not elsewhere.

Source

pub fn check_mount(&self, component: &str, host: &str) -> Result<Fit, String>

The verdict for a component in a host, without mounting it.

Source

pub fn mount(&self, component: &str, host: &str) -> Result<Fit, String>

Mounts a component in a host: recorded with its conditions (the mounts collector shows it), or refused with its rule, reported as a diagnostic (mount-refused) and returned as the error.

Source

pub fn unmount(&self, component: &str, host: &str) -> bool

Takes a component out of a host; false when it was not mounted there.

Source

pub fn mounts(&self) -> Vec<Mounted>

What is mounted where, in mounting order.

Source§

impl AppHandle

Source

pub fn set_empty_window_delay(&self, delay: Option<Duration>)

How long the main window may paint nothing (no text, no image, no overlay) before an error is logged and the fallback page shown; None turns the watch off (an application whose window is empty on purpose). DEFAULT_DELAY to start with.

Source

pub fn empty_window(&self) -> bool

Whether the main window shows the fallback page: it painted nothing for longer than the delay.

Source

pub fn focus_screen_hole(&self) -> bool

Whether a wizard is stored as a focus screen while no page of it is drawn: the shell is drawn instead of hidden.

Source

pub fn screen_state(&self, ctx: &Context) -> Value

What holds the screen, for the log: the place stack and the modes, the Settings app and its wizard, the overlays held, the layout’s areas with their panels.

Source§

impl AppHandle

Source

pub fn settings_pages(&self) -> Vec<SettingsPage>

The custom pages of the settings window, of the connected plugins, in declaration order.

Source

pub fn settings_page(&self, id: &str) -> Option<SettingsPage>

A custom page by id.

Source§

impl AppHandle

Source

pub fn settled(&self) -> bool

Whether the application is settled: no command queued for the next frame or running (a host’s later reply), every job idle, and no repaint asked for. An orphaned job (its plugin is disconnected) is not waited on: it may never end; AppHandle::orphaned_jobs counts it.

Source

pub fn orphaned_jobs(&self) -> usize

The orphaned jobs still going on: left by a disconnected plugin, not waited on by AppHandle::settled; 0 without the jobs plugin. Read from the jobs model, the bus having delivered the journal’s job.* events up to the last one.

Source

pub fn wait_met(&self, until: &WaitFor, since: u64) -> Option<Waited>

Whether until holds now, for events after since; what made it hold. Never blocks (see the module).

Source§

impl AppHandle

Source

pub fn broken_invariants(&self) -> Vec<Broken>

Every window invariant broken since the application started, oldest first (the last 256): the rule, the window, its owner, its state. Empty in a healthy application.

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

pub fn invariants_broken_now(&self) -> Vec<(String, String)>

The invariants broken now (said and not yet holding again).

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

impl AppHandle

Source

pub fn open_window( &self, spec: WindowSpec, content: impl FnMut(&mut Ui, &mut WindowUi<'_>) + 'static, ) -> WindowId

Opens an application window, or brings it to the front when one of that id is open (its content is then left as it was). content draws it each pass of its own; it may hold Rc state. The main window’s id (main, or a window moved into it) cannot be opened again.

It is the pop.window.open request (AppHandle::request_window_open) with the application (app) as its owner.

Source

pub fn request_window_open( &self, spec: WindowSpec, owner: &str, reason: Reason, content: impl FnMut(&mut Ui, &mut WindowUi<'_>) + 'static, ) -> Vec<String>

The pop.window.open request of an application window its owner asks for (ADR 0029): opened, or, open already, brought to the front; either way its listeners run now, in their declared order (the owner’s first), and window.opened is said after the last one when it opened. What they did, one line each. The owner (a plugin’s id, app) is who the window’s closes are asked for and whose listener on pop.window.close closes the state it shows.

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

pub fn close_window(&self, id: &WindowId)

Closes an application window (the main one: as its close button does, another window moving into it when one is open).

A window’s close is the pop.window.close request (AppHandle::request_window_close): its owner’s state closes with it, in this call.

Source

pub fn raise_window(&self, id: &WindowId)

Brings a window to the front and gives it the keyboard focus. The system may refuse: on Wayland a window cannot take the focus from another application’s, and may only be marked as wanting it.

The main window’s own id (WindowId::main) while another window’s content holds it (moved in when the main window was closed): that content goes back to a window of its own (its id, title and saved geometry), and the main window draws the application’s shell again, at its next pass.

Source

pub fn windows(&self) -> Vec<WindowInfo>

The open windows: the main one first, then the others in opening order.

Source

pub fn window_at(&self, viewport: ViewportId) -> Option<WindowId>

The application window drawn in a viewport, if one is.

Source

pub fn window_viewport(&self, id: &WindowId) -> Option<ViewportId>

The viewport an open application window is drawn in.

Source

pub fn window_group(&self, viewport: ViewportId) -> ViewportId

The window group a viewport belongs to: an application window is a group of its own; the main window and its detached panels are the main window’s (ViewportId::ROOT), and so is a window no longer open. A group’s dialogs, toasts and palette are its own, and a modal open in it blocks it alone (modalOpen is per group).

Where the windows are embedded in the main one (the web, kittest), they are all the main window’s group.

Source

pub fn shown_in(&self, group: ViewportId) -> ViewportId

The window a group’s dialogs, toasts and palette show in: an application window itself; in the main window’s group, the window of it worked in last (the main window, or a detached panel’s).

Source

pub fn current_window_group(&self) -> ViewportId

The window group what opens now belongs to: the window being drawn, the one the running command was asked in (its appWindow), the one an agent’s call names; else the active window’s.

Source

pub fn window_of_group(&self, group: ViewportId) -> WindowId

The application window of a group (see AppHandle::window_group).

Source

pub fn active_app_window(&self) -> WindowId

The application window the user worked in last (a detached panel’s window counts as the main window’s).

Source

pub fn set_window_title(&self, id: &WindowId, title: impl Into<String>)

Sets a window’s title (the content of a window usually sets its own, through WindowUi::set_title). The main window’s title is the application’s name until set.

Source

pub fn window_geometry(&self, id: &WindowId) -> Option<Geometry>

A window’s geometry kept from an earlier run or seen in this one.

Source

pub fn main_window(&self) -> WindowId

The main window’s own id, whatever content it shows now: main.

Source

pub fn quit(&self)

Quits the application: the main window closes, and the other windows with it, none moving into the main window as closing it does otherwise. It is the pop.window.close request of the main window with the reason quit: each other window is closed by its own pop.window.close (quit), its owner’s state with it. A close vetoed (a before-hook on the window.close step: unsaved work) leaves the application as it was.

Source

pub fn quitting(&self) -> bool

Whether AppHandle::quit was asked and its close not yet seen.

Source§

impl AppHandle

Source

pub fn instance_payload(&self, id: &PanelId) -> Value

The payload the application keeps for a panel instance (Null when it has none): as it was set, or as the layout restored it.

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

pub fn set_instance_payload( &self, id: &PanelId, payload: Value, ) -> Result<(), String>

Sets the payload of a panel instance open now (or of the panel declared, instance 1, of a kind declared with several), saved with the layout. The layout’s change is said (pop.layout.changed).

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

pub fn set_instance_title( &self, id: &PanelId, title: Option<String>, ) -> Result<(), String>

Names the tab title of a panel instance open now (<kind>#<n>), through pop.panel.retitle; None gives the generated title back (“Gallery 2”). The title is kept in the layout’s instance entry, saved and restored with it, and read by the tab, the panel menu, the View menu, accessibility and Instance::title. The panel declared, a panel declared once and an instance not open are refused with the reason, as a blank title is.

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

pub fn panel_instances(&self, kind: &PanelId) -> Vec<PanelId>

The instances of a panel declared with several, open now, the panel declared first when it shows.

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

Trait Implementations§

Source§

impl Clone for AppHandle

Source§

fn clone(&self) -> AppHandle

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AppHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Finish for T

§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

§

fn to_owned_table(&self) -> U

§

impl<T> TryClone for T
where T: Clone,

§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,