Skip to main content

AppWidget

Trait AppWidget 

pub trait AppWidget: Widget {
Show 25 methods // Required methods fn app_kind(&self) -> AppKind; fn app_title(&self) -> &str; fn app_icon(&self) -> IconDescriptor; // Provided methods fn capture_application_view( &self, ) -> Result<Option<ApplicationLocalView>, ThawError> { ... } fn restore_application_view( &mut self, _local: &ApplicationLocalView, _doc: &AutoCommit, ) -> Result<ApplicationFocusRestore, ThawError> { ... } fn finish_application_view_restore(&mut self) -> Result<(), ThawError> { ... } fn permission_hint(&self) -> Option<AppKind> { ... } fn commands(&self) -> Vec<AppCommand> { ... } fn record_save_status(&mut self, _status: RecordSaveStatus) { ... } fn record_refused(&mut self, _refusal: &RecordRefusal) { ... } fn take_notices(&mut self) -> Vec<String> { ... } fn record_said(&mut self, _text: &str) { ... } fn device_shell_operation( &mut self, _operation: &DeviceShellOperation, ) -> Result<Value, String> { ... } fn request_device_shell(&mut self) -> bool { ... } fn take_save_retry(&mut self) -> bool { ... } fn take_host_intent(&mut self) -> Option<AppHostIntent> { ... } fn take_component_replacement(&mut self) -> Option<ComponentReplacement> { ... } fn min_window_width(&self) -> Option<f64> { ... } fn max_window_width(&self) -> Option<f64> { ... } fn set_live_resize_anchor(&mut self, _fixed: Option<WindowEdge>) { ... } fn release_live_resize_anchor(&mut self) { ... } fn device_local_resources(&self) -> Option<Vec<ResourceSpec>> { ... } fn invoke_device_local_action( &mut self, address: &ActionAddress, _arguments: &Map<String, Value>, ) -> Result<ResourceOperationStart, DoorError> { ... } fn window_search(&self) -> Option<WindowPublication> { ... } fn run_window_control( &mut self, invocation: ControlInvocation, ) -> Result<(), ControlInvocation> { ... }
}
Expand description

Trait every in-process app implements so the shell can host it inside a TileContent::App. AppWidget: Widget means the shell always falls through to the widget contract for layout, draw, and events.

Required Methods§

fn app_kind(&self) -> AppKind

fn app_title(&self) -> &str

fn app_icon(&self) -> IconDescriptor

Provided Methods§

fn capture_application_view( &self, ) -> Result<Option<ApplicationLocalView>, ThawError>

Capture app-owned local presentation alongside the ordinary View.

fn restore_application_view( &mut self, _local: &ApplicationLocalView, _doc: &AutoCommit, ) -> Result<ApplicationFocusRestore, ThawError>

Prepare current topology from an immutable latest-record loan.

§Errors

A payload requires explicit application support and validation.

fn finish_application_view_restore(&mut self) -> Result<(), ThawError>

Finish after ordinary View restoration and before any mount or capture.

§Errors

Applications may reject a prepared local plan without publishing a partial view.

fn permission_hint(&self) -> Option<AppKind>

Which role permission governs this app. Default None: ungated.

fn commands(&self) -> Vec<AppCommand>

Command-palette contributions. Default is none.

fn record_save_status(&mut self, _status: RecordSaveStatus)

Framework-owned durability, delivered only after the record loan ends.

fn record_refused(&mut self, _refusal: &RecordRefusal)

The room refused a change this record made, and the record withdrew it: the action is refused as one refused on this device is. Delivered, like Self::record_save_status, after the record loan ends.

fn take_notices(&mut self) -> Vec<String>

What the app said it did since last asked (“Added Buy milk”), for the record to hold until the room keeps it (crate::record::RecordStore::hold_notice).

fn record_said(&mut self, _text: &str)

The room kept what text says the app did: say it now. Delivered, like Self::record_refused, after the record loan ends.

fn device_shell_operation( &mut self, _operation: &DeviceShellOperation, ) -> Result<Value, String>

Answer a device-owner operation from the authenticated hosting shell. This is not an app action and never grants access to a host shell.

§Errors

Refuses unsupported or unavailable device-shell operations.

fn request_device_shell(&mut self) -> bool

Handle the trusted shell owner selecting the device shell, without granting it.

fn take_save_retry(&mut self) -> bool

Whether the person asked to try a failed record save again (crate::SaveAction::Retry on the crate::SaveStatusSurface), once. The host that owns the record submits its changes again before it next reports Self::record_save_status.

fn take_host_intent(&mut self) -> Option<AppHostIntent>

Drain a one-shot request for shell-owned chrome.

fn take_component_replacement(&mut self) -> Option<ComponentReplacement>

The component to show in this one’s place, built now: what a root shown before its record (crate::application::HostContext::record_opening) answers once the record is had. Asked, as a component’s own request to show another is, before the window syncs, so the window shows this root until it shows the new one.

fn min_window_width(&self) -> Option<f64>

The narrowest window this app is still usable in, in logical px: a Tilo app’s compact layout, a client’s xdg_toplevel min-size hint. Resizing a window stops its edge here rather than squeezing the app (widget::edge_resize). By default what the app’s tree says (crate::widget::minimum_window_width: a NavShell states its compact layout’s minimum), so an app in the shell’s process is stopped where its own window would be. None says nothing, and the strip’s floor applies.

fn max_window_width(&self) -> Option<f64>

The widest window this app can fill, in logical px: a client’s xdg_toplevel max-size hint. None: no maximum.

fn set_live_resize_anchor(&mut self, _fixed: Option<WindowEdge>)

A person is dragging one edge of this app’s window; fixed is the edge that holds still on screen (None once nothing holds). An app that draws a frame of another size than its window until it catches up, a Wayland client answering a configure, draws that frame against the fixed edge, at its own scale, rather than stretched or slid.

fn release_live_resize_anchor(&mut self)

The edge drag ended. An app holding a frame against the fixed edge keeps doing so until its content has the window’s size again, then lets go of it.

fn device_local_resources(&self) -> Option<Vec<ResourceSpec>>

What a private window offers its own device: the resources and actions its door publishes, for the host to list and invoke for this device’s person without publishing them to any room. None for a window that is not private, whose actions reach automation through its collaboration route instead.

fn invoke_device_local_action( &mut self, address: &ActionAddress, _arguments: &Map<String, Value>, ) -> Result<ResourceOperationStart, DoorError>

Invoke one of Self::device_local_resources’ actions as the window’s own person, through its door.

§Errors

Refuses a window that offers no device-local actions, and whatever the door refuses.

What an app keeping its own document publishes for the search of its window: its resources and its search providers, which its host cannot read through its widgets. None for an app whose host reads them directly (crate::widget::published_resources).

fn run_window_control( &mut self, invocation: ControlInvocation, ) -> Result<(), ControlInvocation>

Run invocation, chosen in the search of this window, as the app’s own control would, for an app keeping its own document. Gives it back when the app takes no controls this way.

§Errors

The invocation itself, when the app did not take it.

Trait Implementations§

§

impl AsDynWidget for dyn AppWidget

§

fn as_dyn_widget(&self) -> &dyn Widget

This widget as a trait object.

Implementors§

§

impl AppWidget for EmbeddedApp

Source§

impl AppWidget for HostedActions

§

impl AppWidget for WebView

A web view is a window of its own where a page is all there is to show: a browser tab a host streams to this desktop. It keeps no record here.