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
impl AppHandle
Sourcepub fn local<T: Default + 'static>(&self) -> Rc<T>
pub fn local<T: Default + 'static>(&self) -> Rc<T>
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).
Sourcepub fn debug_describe(&self) -> Json
pub fn debug_describe(&self) -> Json
The debug bridge’s collectors, their descriptions and actions.
Sourcepub fn debug_capabilities(&self) -> Json
pub fn debug_capabilities(&self) -> Json
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.
Sourcepub fn debug_bridge_mode(&self) -> BridgeMode
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.
Sourcepub fn debug_snapshot(&self) -> Json
pub fn debug_snapshot(&self) -> Json
Every collector’s snapshot.
Sourcepub fn window_group_named(
&self,
window: Option<&str>,
) -> Result<ViewportId, String>
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).
Sourcepub fn command_args_refusal(
&self,
command: &CommandId,
args: &Json,
) -> Option<String>
pub fn command_args_refusal( &self, command: &CommandId, args: &Json, ) -> 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).
Sourcepub fn debug_destructive(
&self,
collector: &str,
action: &str,
args: &Json,
) -> bool
pub fn debug_destructive( &self, collector: &str, action: &str, args: &Json, ) -> 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.
Sourcepub fn debug_mutates(&self, collector: &str, action: &str, args: &Json) -> bool
pub fn debug_mutates(&self, collector: &str, action: &str, args: &Json) -> 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.
Sourcepub fn debug_refusal(
&self,
collector: &str,
action: &str,
args: &Json,
origin: &Origin,
) -> Option<String>
pub fn debug_refusal( &self, collector: &str, action: &str, args: &Json, 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).
Sourcepub fn debug_snapshot_in(&self, window: Option<&str>) -> Result<Json, String>
pub fn debug_snapshot_in(&self, window: Option<&str>) -> Result<Json, 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.
Sourcepub fn debug_call_in(
&self,
window: Option<&str>,
collector: &str,
action: &str,
args: &Json,
origin: Origin,
) -> Feedback
pub fn debug_call_in( &self, window: Option<&str>, collector: &str, action: &str, args: &Json, 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.
Sourcepub fn debug_call(&self, collector: &str, action: &str, args: &Json) -> Feedback
pub fn debug_call(&self, collector: &str, action: &str, args: &Json) -> 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.
Sourcepub fn debug_call_as(
&self,
collector: &str,
action: &str,
args: &Json,
origin: Origin,
) -> Feedback
pub fn debug_call_as( &self, collector: &str, action: &str, args: &Json, 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).
Sourcepub fn key_traces(&self) -> Vec<Trace>
pub fn key_traces(&self) -> Vec<Trace>
The last key resolutions, oldest first.
Sourcepub fn pending_keys(&self) -> Option<String>
pub fn pending_keys(&self) -> Option<String>
The chords of a shortcut in progress.
Sourcepub fn arrangement_strings(&self) -> ArrangementStrings
pub fn arrangement_strings(&self) -> ArrangementStrings
The texts naming an arrangement of the panels, the application’s
(AppBuilder::arrangement_strings) or egui-pop’s.
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The application’s name (AppBuilder::name); empty when none was
given.
Sourcepub fn app_id(&self) -> String
pub fn app_id(&self) -> String
The application’s id (AppBuilder::app_id), reverse-DNS
(org.example.App); empty when none was given.
Sourcepub fn store(&self) -> SharedStore
pub fn store(&self) -> SharedStore
The value store.
Sourcepub fn value<T: Bindable>(&self, path: &str) -> Option<T>
pub fn value<T: Bindable>(&self, path: &str) -> Option<T>
The value at path in the store, as T (None: not declared,
or not a T): app.value::<f64>("swatch/hue").
Sourcepub fn setting<T: Bindable>(&self, id: &SettingId) -> Option<T>
pub fn setting<T: Bindable>(&self, id: &SettingId) -> Option<T>
A setting’s value, as T (None: not declared, or not a T):
app.setting::<bool>(&SHOW_CODE), read at settings/<id>.
Sourcepub fn persist(&self) -> Option<Persist>
pub fn persist(&self) -> Option<Persist>
The persistence directory (AppBuilder::persist), if one was
given.
Sourcepub fn save_later(&self, name: &str, text: String) -> bool
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.
Sourcepub fn saved_already(&self, name: &str, text: &str)
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.
Sourcepub fn flush_documents(&self) -> Vec<(String, Result<(), PersistError>)>
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.
Sourcepub fn pending_documents(&self) -> Vec<String>
pub fn pending_documents(&self) -> Vec<String>
The documents waiting in the debounced writer.
Sourcepub fn publish(&self, source: &str, cause: Option<Seq>, name: &str, data: Json)
pub fn publish(&self, source: &str, cause: Option<Seq>, name: &str, data: Json)
Appends an event to the host’s journal (held until the host is free when published from a command it is running).
Sourcepub fn events_since(&self, seq: Seq) -> Vec<Event>
pub fn events_since(&self, seq: Seq) -> Vec<Event>
The journal’s events after seq (empty while the host is
dispatching), read through the host.
Sourcepub fn can_undo(&self) -> bool
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).
Sourcepub fn undo_label(&self) -> Option<String>
pub fn undo_label(&self) -> Option<String>
What an undo would take back (“exposure change”).
Sourcepub fn redo_label(&self) -> Option<String>
pub fn redo_label(&self) -> Option<String>
What a redo would do again.
Sourcepub fn command_title(&self, spec: &CommandSpec) -> String
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”).
Sourcepub fn command_tooltip(&self, spec: &CommandSpec) -> String
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).
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).
Sourcepub fn undo(&self, origin: &Origin) -> Outcome
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.
Sourcepub fn overlay_rects(&self) -> Vec<OverlayRect>
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.
Sourcepub fn last_event(&self) -> Seq
pub fn last_event(&self) -> Seq
The journal’s last sequence number, as the host says.
Sourcepub fn step(
&self,
step: &StepId,
args: Json,
default: impl FnOnce(&AppHandle, &Json) -> Result<Json, String>,
) -> Outcome
pub fn step( &self, step: &StepId, args: Json, default: impl FnOnce(&AppHandle, &Json) -> Result<Json, 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.
Sourcepub fn steps(&self) -> Vec<StepInfo>
pub fn steps(&self) -> Vec<StepInfo>
The declared steps, with their hooks (owner, kind), in declaration order.
Sourcepub fn step_traces(&self) -> Vec<StepTrace>
pub fn step_traces(&self) -> Vec<StepTrace>
The last runs of steps, oldest first.
Sourcepub fn list_items(&self, name: &str, cx: &WhenContext) -> Vec<ListItem>
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.
Sourcepub fn running(&self, id: &CommandId) -> bool
pub fn running(&self, id: &CommandId) -> bool
Whether a run of this command waits for its result.
Sourcepub fn running_since(&self, id: &CommandId) -> Option<f64>
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.
Sourcepub fn service<T: Send + Sync + 'static>(
&self,
token: &ServiceToken<T>,
) -> Option<Arc<T>>
pub fn service<T: Send + Sync + 'static>( &self, token: &ServiceToken<T>, ) -> Option<Arc<T>>
A service, typed.
Sourcepub fn theme(&self) -> Arc<ThemeService>
pub fn theme(&self) -> Arc<ThemeService>
The theme service.
Sourcepub fn run(&self, command: CommandId, args: Json)
pub fn run(&self, command: CommandId, args: Json)
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.
Sourcepub fn run_as(&self, command: CommandId, args: Json, origin: Origin)
pub fn run_as(&self, command: CommandId, args: Json, 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).
Sourcepub fn acting_origin(&self) -> Origin
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.
Sourcepub fn set_plugin_enabled(&self, plugin: PluginId, enabled: bool)
pub fn set_plugin_enabled(&self, plugin: PluginId, enabled: bool)
Asks for a plugin to be connected or disconnected before the next frame.
Sourcepub fn set_context(&self, key: &str, value: &str)
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.
Sourcepub fn context(&self) -> WhenContext
pub fn context(&self) -> WhenContext
The application-wide context keys.
Sourcepub fn when_context(&self) -> WhenContext
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.
Sourcepub fn window_name(&self, window: ViewportId) -> String
pub fn window_name(&self, window: ViewportId) -> String
A window’s name for agents: main, or its detached panel’s id.
Sourcepub fn describe_windows(&self) -> Json
pub fn describe_windows(&self) -> Json
What the windows collector shows: the active window, each
window’s overlays, where the palette and the popup menu are.
Sourcepub fn window_panel(&self, window: ViewportId) -> Option<PanelId>
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.
Sourcepub fn active_window(&self) -> ViewportId
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).
Sourcepub fn diagnostics(&self) -> Vec<Diagnostic>
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).
The menus declared, by id.
A menu’s items after the hooks.
Sourcepub fn palette(&self) -> Vec<PaletteEntry>
pub fn palette(&self) -> Vec<PaletteEntry>
The palette’s entries after the hooks.
Sourcepub fn palette_search(&self, query: &str) -> Vec<Ranked>
pub fn palette_search(&self, query: &str) -> Vec<Ranked>
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).
Sourcepub fn settings(&self) -> Vec<SettingEntry>
pub fn settings(&self) -> Vec<SettingEntry>
The settings form’s entries after the hooks.
Sourcepub fn command_gone_with(&self, id: &CommandId) -> Option<PluginId>
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.
Sourcepub fn dormant_keys(&self) -> Vec<DormantKey>
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.
Sourcepub fn command(&self, id: &CommandId) -> Option<CommandSpec>
pub fn command(&self, id: &CommandId) -> Option<CommandSpec>
A command’s declaration.
Sourcepub fn icon_set_by(&self, id: &CommandId) -> Option<OwnerId>
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.
Sourcepub fn rebind(&self, command: CommandId, keys: Option<String>)
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.
Sourcepub fn rebind_in(&self, layer: Layer, command: CommandId, keys: Option<String>)
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.
Sourcepub fn rebind_gestures(&self, layer: Layer, command: CommandId, keys: &[&str])
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).
Sourcepub fn reset_keys(&self, command: CommandId)
pub fn reset_keys(&self, command: CommandId)
Asks for a command’s default keys back.
Sourcepub fn reset_keys_in(&self, layer: Layer, command: CommandId)
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.
Sourcepub fn rebound_in(&self, layer: Layer, id: &CommandId) -> bool
pub fn rebound_in(&self, layer: Layer, id: &CommandId) -> bool
Whether layer (the user’s or the workspace’s) changed a
command’s keys.
Sourcepub fn key_sources(&self, id: &CommandId) -> Vec<Binding>
pub fn key_sources(&self, id: &CommandId) -> Vec<Binding>
A command’s live bindings, each with the layer it comes from.
Sourcepub fn offer_workspace_keys(&self, on: bool)
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).
Sourcepub fn workspace_keys_offered(&self) -> bool
pub fn workspace_keys_offered(&self) -> bool
Whether the shortcuts editor offers the workspace’s keys.
Sourcepub fn name_key_sources(&self, f: impl Fn(&Binding) -> Option<String> + 'static)
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).
Sourcepub fn key_source_name(
&self,
ctx: &Context,
binding: &Binding,
) -> Option<String>
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.
Sourcepub fn capture_keys(&self, on: bool)
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).
Sourcepub fn keys_captured(&self) -> bool
pub fn keys_captured(&self) -> bool
Whether a shortcuts editor captures the keys (Self::capture_keys).
Sourcepub fn key_conflicts_by_scope(
&self,
) -> BTreeMap<String, Vec<(Binding, Binding)>>
pub fn key_conflicts_by_scope( &self, ) -> BTreeMap<String, Vec<(Binding, Binding)>>
AppHandle::key_conflicts by scope (global, surface:<name>).
Sourcepub fn declare(&self, owner: &OwnerId, spec: CommandSpec)
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).
Sourcepub fn undeclare(&self, id: &CommandId)
pub fn undeclare(&self, id: &CommandId)
Removes a command declared after build, with its keys and menu items, before the next frame.
Sourcepub fn export_keymap(&self, layer: Layer) -> KeymapDoc
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.
Sourcepub fn load_keymap(&self, doc: KeymapDoc, layer: Layer) -> KeymapDiff
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.
Sourcepub fn key_conflicts(&self) -> Vec<(Binding, Binding)>
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.
Sourcepub fn applies(&self, id: &CommandId, cx: &WhenContext) -> bool
pub fn applies(&self, id: &CommandId, cx: &WhenContext) -> bool
Whether a command applies in a context (its when clause holds).
Sourcepub fn keys_for(&self, id: &CommandId) -> Vec<String>
pub fn keys_for(&self, id: &CommandId) -> Vec<String>
A command’s live key bindings, as shown (Ctrl+K Ctrl+S).
Sourcepub fn system_bindings(&self) -> Vec<Binding>
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).
Sourcepub fn commands(&self) -> Vec<(CommandSpec, OwnerId)>
pub fn commands(&self) -> Vec<(CommandSpec, OwnerId)>
Every command (spec and owner).
Sourcepub fn plugins(&self) -> Vec<PluginInfo>
pub fn plugins(&self) -> Vec<PluginInfo>
The plugins, in connection order.
Sourcepub fn zone_has_blocks(&self, zone: &ZoneId) -> bool
pub fn zone_has_blocks(&self, zone: &ZoneId) -> bool
Whether a zone has blocks to draw.
Sourcepub fn show_zone(&self, ui: &mut Ui, zone: &ZoneId)
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).
Sourcepub fn show_story(&self, ui: &mut Ui, id: &StoryId) -> bool
pub fn show_story(&self, ui: &mut Ui, id: &StoryId) -> bool
Draws a story; false when there is no such story.
Sourcepub fn show_playground(&self, ui: &mut Ui, id: &StoryId) -> bool
pub fn show_playground(&self, ui: &mut Ui, id: &StoryId) -> bool
Draws a story’s playground; false when it has none.
Sourcepub fn edge_to_edge(&self) -> bool
pub fn edge_to_edge(&self) -> bool
Whether the centre is drawn edge to edge.
Sourcepub fn frameless(&self, area: Area) -> bool
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.
Sourcepub fn bare_strip(&self, area: Area) -> bool
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.
Sourcepub fn set_shell_panel_min_size(&self, panel: PanelId, size: Option<ShellSize>)
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);Sourcepub fn set_shell_panel_max_size(&self, panel: PanelId, size: Option<ShellSize>)
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.
Sourcepub fn shell_panel_min_size(&self, panel: &PanelId) -> Option<ShellSize>
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.
Sourcepub fn shell_panel_max_size(&self, panel: &PanelId) -> Option<ShellSize>
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.
Sourcepub fn centre_min_size(&self) -> Option<ShellSize>
pub fn centre_min_size(&self) -> Option<ShellSize>
The centre’s least width the application set
(AppBuilder::centre_min_size).
Sourcepub fn system_text_scale(&self) -> SystemTextScale
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).
Sourcepub fn system_always_shows_scroll_bars(&self) -> bool
pub fn system_always_shows_scroll_bars(&self) -> bool
Whether the system always shows its scroll bars
(AppBuilder::system_always_shows_scroll_bars).
Sourcepub fn system_wheel_lines(&self) -> u32
pub fn system_wheel_lines(&self) -> u32
The system’s lines a wheel’s notch (AppBuilder::system_wheel_lines; 3 when
none was given).
Whether the main menu is drawn as a bar under the title
(AppBuilder::menu_bar).
Sourcepub fn system_file_chooser(&self) -> bool
pub fn system_file_chooser(&self) -> bool
Whether the application allows the system’s file chooser
(AppBuilder::system_file_chooser): off by default.
Sourcepub fn transparent_panel_windows(&self) -> bool
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.
Sourcepub fn rounded_windows(&self) -> bool
pub fn rounded_windows(&self) -> bool
Whether the windows the application decorates are built
transparent for rounded corners (AppBuilder::rounded_windows).
Sourcepub fn panel_visible(&self, id: &PanelId) -> bool
pub fn panel_visible(&self, id: &PanelId) -> bool
Whether a panel is shown (docked or detached, not closed).
Sourcepub fn set_panel_visible(&self, id: &PanelId, visible: bool)
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).
Sourcepub fn layout(&self) -> Layout
pub fn layout(&self) -> Layout
The workbench’s layout as it stands: areas, tabs and splits, detached panels, closed panels.
Sourcepub fn saved_layout(&self) -> SavedLayout
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).
Sourcepub fn set_layout(&self, layout: Layout) -> Vec<String>
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.
Sourcepub fn declared_panels(&self) -> Vec<(PanelSpec, OwnerId)>
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.
Sourcepub fn drop_hint(&self) -> Option<DropHint>
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.
Sourcepub fn window_drop(&self) -> Option<WindowDrop>
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.
Sourcepub fn window_outlines(&self) -> Vec<PanelId>
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.
Sourcepub fn focused_panel(&self) -> Option<PanelId>
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”).
Sourcepub fn change_workbench(&self, change: Change) -> Option<Outcome>
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).
Sourcepub fn set_zen(&self, on: bool) -> Option<Outcome>
pub fn set_zen(&self, on: bool) -> Option<Outcome>
Starts zen mode (only the centre is shown) or ends it
(workbench.zen).
Sourcepub fn set_zen_panel(&self, panel: &PanelId) -> Option<Outcome>
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.
Sourcepub fn zen_panel(&self) -> Option<PanelId>
pub fn zen_panel(&self) -> Option<PanelId>
The panel zen mode shows alone, while it shows one (none: off, or the centre whole).
Sourcepub fn zen_target(&self) -> Option<PanelId>
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.
Sourcepub fn area_rect(&self, area: Area) -> Option<Rect>
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).
Sourcepub fn arrange(&self, panel: &PanelId, how: Arrangement) -> Option<Outcome>
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).
Sourcepub fn fold_area(&self, area: Area, folded: bool) -> Option<Outcome>
pub fn fold_area(&self, area: Area, folded: bool) -> Option<Outcome>
Folds an area to its strip, or unfolds it (workbench.fold).
Sourcepub fn fold_window_area(
&self,
window: &str,
area: Area,
folded: bool,
) -> Option<Outcome>
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.
Sourcepub fn open_flyout(&self, panel: &PanelId, open: bool) -> Option<Outcome>
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).
Sourcepub fn flyout(&self) -> Option<(PanelId, Option<Rect>)>
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).
Sourcepub fn place_area(&self, area: Area, placement: Placement) -> Option<Outcome>
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).
Sourcepub fn area_placement(&self, area: Area) -> Placement
pub fn area_placement(&self, area: Area) -> Placement
Where a side area lies now (beside the centre, or over it).
Sourcepub fn indicators(&self) -> Vec<(Indicator, IndicatorState)>
pub fn indicators(&self) -> Vec<(Indicator, IndicatorState)>
The indicators and their states, lightest first.
Sourcepub fn move_panel(&self, panel: &PanelId, area: Area) -> Option<Outcome>
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.
Sourcepub fn move_to_window(
&self,
panel: &PanelId,
window: &PanelId,
) -> Option<Outcome>
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).
Sourcepub fn detach_panel(&self, panel: &PanelId) -> Option<Outcome>
pub fn detach_panel(&self, panel: &PanelId) -> Option<Outcome>
Moves a panel to a window of its own (workbench.detach).
Sourcepub fn attach_panel(&self, panel: &PanelId) -> Option<Outcome>
pub fn attach_panel(&self, panel: &PanelId) -> Option<Outcome>
Docks a detached panel back in its area (workbench.attach).
Sourcepub fn focus_panel(&self, panel: &PanelId) -> Option<Outcome>
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
impl AppHandle
Sourcepub fn request_window_activate(&self, request: WindowRequest) -> bool
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.
Sourcepub fn active_window_id(&self) -> String
pub fn active_window_id(&self) -> String
The active window’s id in the registry (main, an application
window’s id, panel:<id>).
Sourcepub fn raise_viewport(&self, v: ViewportId, owner: &str) -> bool
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.
Source§impl AppHandle
impl AppHandle
Sourcepub fn set_panel_topology(
&self,
of: impl Fn(&AppHandle, &PanelId, Option<&PanelId>) -> Option<String> + 'static,
)
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.
Source§impl AppHandle
impl AppHandle
Sourcepub fn request_files_drop(&self, drop: FileDrop) -> Vec<String>
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.
Source§impl AppHandle
impl AppHandle
Sourcepub fn report(&self, notice: Notice) -> NoticeId
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.
Sourcepub fn resolve_notice(&self, id: impl Into<NoticeId>)
pub fn resolve_notice(&self, id: impl Into<NoticeId>)
Says a condition ended (pop.notice.resolved).
Sourcepub fn see_notice(&self, id: impl Into<NoticeId>)
pub fn see_notice(&self, id: impl Into<NoticeId>)
Says a notice was read (pop.notice.seen).
Sourcepub fn dismiss_notice(&self, id: impl Into<NoticeId>)
pub fn dismiss_notice(&self, id: impl Into<NoticeId>)
Says the user put a notice away (pop.notice.dismissed).
Sourcepub fn see_notices(&self, ids: impl IntoIterator<Item = NoticeId>)
pub fn see_notices(&self, ids: impl IntoIterator<Item = NoticeId>)
Says notices were read (pop.notice.seen), in one message.
Sourcepub fn dismiss_notices(&self, ids: impl IntoIterator<Item = NoticeId>)
pub fn dismiss_notices(&self, ids: impl IntoIterator<Item = NoticeId>)
Says the user put notices away (pop.notice.dismissed), in one
message.
Sourcepub fn notices(&self) -> Vec<Kept>
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).
Sourcepub fn set_notice_limits(&self, bound: usize, max_age_ms: u64)
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.
Sourcepub fn route_notices(&self, policy: impl NoticeRouting + 'static)
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.
Sourcepub fn notice_route(&self, id: &NoticeId) -> Option<Route>
pub fn notice_route(&self, id: &NoticeId) -> Option<Route>
The route a kept notice was given.
Sourcepub fn notice_badge(&self) -> NoticeBadge
pub fn notice_badge(&self) -> NoticeBadge
What the status bar’s badge counts now.
Sourcepub fn run_reported(
&self,
command: CommandId,
args: Json,
place: impl Into<String>,
)
pub fn run_reported( &self, command: CommandId, args: Json, 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.
Sourcepub fn take_failure(&self, command: &CommandId) -> Option<CommandError>
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"));
}
}Source§impl AppHandle
impl AppHandle
Sourcepub fn name_overlay(
&self,
id: Id,
window: ViewportId,
popup: String,
owner: &str,
)
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.
Source§impl AppHandle
impl AppHandle
Sourcepub fn request_popup_open(&self, request: WindowRequest) -> bool
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.
Sourcepub fn request_popup_close(&self, request: WindowRequest) -> bool
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.
Sourcepub fn request_native_open(&self, request: WindowRequest) -> bool
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.
Sourcepub fn registry_window_of(&self, viewport: ViewportId) -> String
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.
Source§impl AppHandle
impl AppHandle
Sourcepub fn deliver_settings(&self)
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.
Source§impl AppHandle
impl AppHandle
Sourcepub fn request_window_reparent(&self, request: WindowRequest) -> bool
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.
Source§impl AppHandle
impl AppHandle
Sourcepub fn listen_local_in<P: Point>(
&self,
window: &WindowId,
id: impl Into<String>,
opts: ListenOpts,
run: impl Fn(&P::Input, &mut P::Value) -> Result<(), HookError> + 'static,
) -> Result<(), Refused>
pub fn listen_local_in<P: Point>( &self, window: &WindowId, id: impl Into<String>, opts: ListenOpts, run: impl Fn(&P::Input, &mut P::Value) -> Result<(), HookError> + 'static, ) -> Result<(), Refused>
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.
Sourcepub fn wake_window(&self, window: &WindowId)
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.
Sourcepub fn run_pending(&self) -> Vec<PendingRun>
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.
Sourcepub fn ask<P: Point>(&self, input: P::Input, value: P::Value) -> Option<u64>where
P::Value: Clone,
pub fn ask<P: Point>(&self, input: P::Input, value: P::Value) -> Option<u64>where
P::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.
Sourcepub fn drain_asks(&self) -> Vec<PendingRun>
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.
Sourcepub fn asks_waiting(&self) -> usize
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.
Sourcepub fn bus(&self) -> Arc<dyn Bus>
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).
Sourcepub fn windows_list(&self) -> Vec<WindowRecord>
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).
Sourcepub fn bus_order(&self) -> String
pub fn bus_order(&self) -> String
The order the listeners of the window and popup points run in
(order_dump).
Sourcepub fn request_window_close(&self, request: WindowRequest) -> bool
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.
Sourcepub fn bus_order_of(&self, points: &[&str]) -> String
pub fn bus_order_of(&self, points: &[&str]) -> String
The order the listeners of the job and plugin points run in
(order_dump).
Sourcepub fn request_panel_state(&self, ask: PanelStateAsk) -> Vec<String>
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.
Sourcepub fn request_job_rows(&self, ask: JobRowsAsk) -> Vec<String>
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.
Sourcepub fn request_job_source_drop(&self, ask: JobSourceAsk) -> Vec<String>
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.
Sourcepub fn describe_panel(&self, panel: &str) -> Option<PanelDescription>
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.
Sourcepub fn open_panel(&self, ask: PanelOpenAsk) -> Result<Vec<String>, String>
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.
Sourcepub fn retitle_panel(&self, ask: PanelRetitleAsk) -> Result<Vec<String>, String>
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.
Sourcepub fn ui_areas(&self) -> Vec<AreaRecord>
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.
Sourcepub fn zen_choice(&self) -> Option<String>
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.
Sourcepub fn command_text(&self, command: &CommandId) -> CommandText
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.
Sourcepub fn panel_state(&self, panel: &str) -> PanelState
pub fn panel_state(&self, panel: &str) -> PanelState
A panel’s state as last asked (pop.panel.state): ready when never
asked.
Sourcepub fn request_job(&self, ask: JobAsk) -> Vec<String>
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.
Sourcepub fn deliver_events(&self)
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.
Sourcepub fn publish_job(&self, source: &str, kind: JobEventKind, data: Value)
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.
Sourcepub fn job_publisher(&self) -> JobPublisher
pub fn job_publisher(&self) -> JobPublisher
A publisher of job events, for any thread.
Source§impl AppHandle
impl AppHandle
Sourcepub fn group<R, E>(
&self,
origin: &Origin,
label: &str,
f: impl FnOnce(&Group<'_>) -> Result<R, E>,
) -> Result<R, E>
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
impl AppHandle
Sourcepub fn request_run_in(
&self,
command: CommandId,
args: Json,
context: WhenContext,
)
pub fn request_run_in( &self, command: CommandId, args: Json, 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
impl AppHandle
Sourcepub fn mountables(&self) -> Vec<Mountable>
pub fn mountables(&self) -> Vec<Mountable>
Every component declared: this crate’s and egui-pop-core’s,
then those of the connected plugins.
Sourcepub fn host_offers(&self) -> Vec<HostOffer>
pub fn host_offers(&self) -> Vec<HostOffer>
Every host: this crate’s, then those of the connected plugins (the viewport’s overlays among them).
Sourcepub fn where_can(&self, component: &str) -> Result<Vec<Placement>, String>
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.
Sourcepub fn check_mount(&self, component: &str, host: &str) -> Result<Fit, String>
pub fn check_mount(&self, component: &str, host: &str) -> Result<Fit, String>
The verdict for a component in a host, without mounting it.
Sourcepub fn mount(&self, component: &str, host: &str) -> Result<Fit, String>
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§impl AppHandle
impl AppHandle
Sourcepub fn set_empty_window_delay(&self, delay: Option<Duration>)
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.
Sourcepub fn empty_window(&self) -> bool
pub fn empty_window(&self) -> bool
Whether the main window shows the fallback page: it painted nothing for longer than the delay.
Sourcepub fn focus_screen_hole(&self) -> bool
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.
Sourcepub fn screen_state(&self, ctx: &Context) -> Json
pub fn screen_state(&self, ctx: &Context) -> Json
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
impl AppHandle
Sourcepub fn settings_pages(&self) -> Vec<SettingsPage>
pub fn settings_pages(&self) -> Vec<SettingsPage>
The custom pages of the settings window, of the connected plugins, in declaration order.
Sourcepub fn settings_page(&self, id: &str) -> Option<SettingsPage>
pub fn settings_page(&self, id: &str) -> Option<SettingsPage>
A custom page by id.
Source§impl AppHandle
impl AppHandle
Sourcepub fn settled(&self) -> bool
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.
Sourcepub fn orphaned_jobs(&self) -> usize
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§impl AppHandle
impl AppHandle
Sourcepub fn broken_invariants(&self) -> Vec<Broken>
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.
Sourcepub fn invariants_broken_now(&self) -> Vec<(String, String)>
pub fn invariants_broken_now(&self) -> Vec<(String, String)>
The invariants broken now (said and not yet holding again).
Source§impl AppHandle
impl AppHandle
Sourcepub fn open_window(
&self,
spec: WindowSpec,
content: impl FnMut(&mut Ui, &mut WindowUi<'_>) + 'static,
) -> WindowId
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.
Sourcepub fn request_window_open(
&self,
spec: WindowSpec,
owner: &str,
reason: Reason,
content: impl FnMut(&mut Ui, &mut WindowUi<'_>) + 'static,
) -> Vec<String>
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.
Sourcepub fn close_window(&self, id: &WindowId)
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.
Sourcepub fn raise_window(&self, id: &WindowId)
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.
Sourcepub fn windows(&self) -> Vec<WindowInfo>
pub fn windows(&self) -> Vec<WindowInfo>
The open windows: the main one first, then the others in opening order.
Sourcepub fn window_at(&self, viewport: ViewportId) -> Option<WindowId>
pub fn window_at(&self, viewport: ViewportId) -> Option<WindowId>
The application window drawn in a viewport, if one is.
Sourcepub fn window_viewport(&self, id: &WindowId) -> Option<ViewportId>
pub fn window_viewport(&self, id: &WindowId) -> Option<ViewportId>
The viewport an open application window is drawn in.
Sourcepub fn window_group(&self, viewport: ViewportId) -> ViewportId
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.
Sourcepub fn shown_in(&self, group: ViewportId) -> ViewportId
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).
Sourcepub fn current_window_group(&self) -> ViewportId
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.
Sourcepub fn window_of_group(&self, group: ViewportId) -> WindowId
pub fn window_of_group(&self, group: ViewportId) -> WindowId
The application window of a group (see AppHandle::window_group).
Sourcepub fn active_app_window(&self) -> WindowId
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).
Sourcepub fn set_window_title(&self, id: &WindowId, title: impl Into<String>)
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.
Sourcepub fn window_geometry(&self, id: &WindowId) -> Option<Geometry>
pub fn window_geometry(&self, id: &WindowId) -> Option<Geometry>
A window’s geometry kept from an earlier run or seen in this one.
Sourcepub fn main_window(&self) -> WindowId
pub fn main_window(&self) -> WindowId
The main window’s own id, whatever content it shows now: main.
Sourcepub fn quit(&self)
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.
Sourcepub fn quitting(&self) -> bool
pub fn quitting(&self) -> bool
Whether AppHandle::quit was asked and its close not yet seen.
Source§impl AppHandle
impl AppHandle
Sourcepub fn instance_payload(&self, id: &PanelId) -> Json
pub fn instance_payload(&self, id: &PanelId) -> Json
The payload the application keeps for a panel instance (Null
when it has none): as it was set, or as the layout restored it.
Sourcepub fn set_instance_payload(
&self,
id: &PanelId,
payload: Json,
) -> Result<(), String>
pub fn set_instance_payload( &self, id: &PanelId, payload: Json, ) -> 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).
Sourcepub fn set_instance_title(
&self,
id: &PanelId,
title: Option<String>,
) -> Result<(), String>
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.
Sourcepub fn panel_instances(&self, kind: &PanelId) -> Vec<PanelId>
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppHandle
impl !RefUnwindSafe for AppHandle
impl !Send for AppHandle
impl !Sync for AppHandle
impl Unpin for AppHandle
impl UnsafeUnpin for AppHandle
impl !UnwindSafe for AppHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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