pub trait Backend: TextMeasure {
type NativeHandle;
Show 160 methods
// Required methods
fn create_widget(&mut self, spec: &WidgetSpec) -> GuiResult<()>;
fn create_menu(&mut self, menu_id: MenuId) -> GuiResult<()>;
fn add_submenu(
&mut self,
parent_id: MenuId,
submenu_id: MenuId,
slot_id: MenuItemId,
text: &str,
) -> GuiResult<()>;
fn create_menu_item(
&mut self,
menu_id: MenuId,
item_id: MenuItemId,
text: &str,
shortcut: Option<&str>,
) -> GuiResult<()>;
fn attach_menu_to_window(
&mut self,
window_id: WidgetId,
menu_id: MenuId,
) -> GuiResult<()>;
fn attach_context_menu(
&mut self,
widget_id: WidgetId,
menu_id: MenuId,
) -> GuiResult<()>;
fn set_text(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>;
fn set_checked(
&mut self,
widget_id: WidgetId,
checked: bool,
) -> GuiResult<()>;
fn set_value(&mut self, widget_id: WidgetId, value: i32) -> GuiResult<()>;
fn set_range(
&mut self,
widget_id: WidgetId,
min: i32,
max: i32,
) -> GuiResult<()>;
fn set_step(&mut self, widget_id: WidgetId, step: i32) -> GuiResult<()>;
fn set_selected_index(
&mut self,
widget_id: WidgetId,
index: usize,
) -> GuiResult<()>;
fn set_tab_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()>;
fn set_selected_indices(
&mut self,
widget_id: WidgetId,
indices: &[usize],
) -> GuiResult<()>;
fn set_row_drag(
&mut self,
widget_id: WidgetId,
source: bool,
target: bool,
) -> GuiResult<()>;
fn set_size(
&mut self,
widget_id: WidgetId,
width: i32,
height: i32,
) -> GuiResult<()>;
fn set_data_list_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()>;
fn set_data_grid_rows(
&mut self,
widget_id: WidgetId,
rows: Arc<Vec<Vec<String>>>,
) -> GuiResult<()>;
fn set_data_grid_model(
&mut self,
widget_id: WidgetId,
model: Box<dyn DataGridModel>,
) -> GuiResult<()>;
fn set_data_grid_row_height(
&mut self,
widget_id: WidgetId,
row: usize,
height: i32,
) -> GuiResult<()>;
fn set_data_grid_col_width(
&mut self,
widget_id: WidgetId,
col: usize,
width: i32,
) -> GuiResult<()>;
fn set_data_grid_frozen_panes(
&mut self,
widget_id: WidgetId,
rows: usize,
cols: usize,
) -> GuiResult<()>;
fn set_data_grid_selection(
&mut self,
widget_id: WidgetId,
selection: &[(usize, usize)],
) -> GuiResult<()>;
fn set_tree_items(
&mut self,
widget_id: WidgetId,
items: &[TreeItem],
) -> GuiResult<()>;
fn set_position(
&mut self,
widget_id: WidgetId,
x: i32,
y: i32,
) -> GuiResult<()>;
fn set_background_color(
&mut self,
widget_id: WidgetId,
color: Color,
) -> GuiResult<()>;
fn set_alert_level(
&mut self,
widget_id: WidgetId,
level: AlertLevel,
) -> GuiResult<()>;
fn set_image_source(
&mut self,
widget_id: WidgetId,
source: &str,
) -> GuiResult<()>;
fn set_date_value(
&mut self,
widget_id: WidgetId,
iso_date: &str,
) -> GuiResult<()>;
fn set_link_url(&mut self, widget_id: WidgetId, url: &str) -> GuiResult<()>;
fn set_container_direction(
&mut self,
widget_id: WidgetId,
direction: ContainerDirection,
) -> GuiResult<()>;
fn set_container_scroll(
&mut self,
widget_id: WidgetId,
vertical: bool,
horizontal: bool,
) -> GuiResult<()>;
fn set_container_gap(
&mut self,
widget_id: WidgetId,
gap: i32,
) -> GuiResult<()>;
fn set_container_padding(
&mut self,
widget_id: WidgetId,
padding: i32,
) -> GuiResult<()>;
fn draw_demo_cube(&mut self, widget_id: WidgetId) -> GuiResult<()>;
fn set_canvas_scene(
&mut self,
widget_id: WidgetId,
scene: &CanvasScene,
) -> GuiResult<()>;
fn native_handle(
&self,
widget_id: WidgetId,
) -> GuiResult<Self::NativeHandle>;
fn add_child(&mut self, parent: WidgetId, child: WidgetId) -> GuiResult<()>;
fn show(&mut self, widget_id: WidgetId) -> GuiResult<()>;
fn hide(&mut self, widget_id: WidgetId) -> GuiResult<()>;
fn remove(&mut self, widget_id: WidgetId) -> GuiResult<()>;
fn set_enabled(
&mut self,
widget_id: WidgetId,
enabled: bool,
) -> GuiResult<()>;
fn activate(&mut self, widget_id: WidgetId) -> GuiResult<()>;
fn data_dir(&self) -> GuiResult<PathBuf>;
fn set_tooltip(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>;
fn poll_event(&mut self) -> GuiResult<Option<UiEvent>>;
fn wait_event(&mut self) -> GuiResult<UiEvent>;
fn show_confirm_dialog(
&mut self,
token: u64,
title: &str,
message: &str,
) -> GuiResult<()>;
// Provided methods
fn set_label_alignment(
&mut self,
widget_id: WidgetId,
alignment: LabelAlignment,
) -> GuiResult<()> { ... }
fn set_label_wrap(
&mut self,
widget_id: WidgetId,
wrap: LabelWrap,
) -> GuiResult<()> { ... }
fn text_selection(&self, _widget_id: WidgetId) -> GuiResult<(usize, usize)> { ... }
fn set_text_selection(
&mut self,
widget_id: WidgetId,
start: usize,
end: usize,
) -> GuiResult<()> { ... }
fn set_text_completion_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()> { ... }
fn drag_capabilities(&self) -> DragCapabilities { ... }
fn set_drag_source_options(
&mut self,
widget_id: WidgetId,
options: &DragSourceOptions,
) -> GuiResult<()> { ... }
fn set_drag_target_options(
&mut self,
widget_id: WidgetId,
options: &DragTargetOptions,
) -> GuiResult<()> { ... }
fn set_file_drop_target(
&mut self,
widget_id: WidgetId,
enabled: bool,
) -> GuiResult<()> { ... }
fn set_drop_target(
&mut self,
widget_id: WidgetId,
enabled: bool,
) -> GuiResult<()> { ... }
fn set_min_size(
&mut self,
widget_id: WidgetId,
width: i32,
height: i32,
) -> GuiResult<()> { ... }
fn set_layout_size(
&mut self,
widget_id: WidgetId,
width: i32,
height: i32,
expand_width: bool,
expand_height: bool,
) -> GuiResult<()> { ... }
fn natural_size(&self, widget_id: WidgetId) -> Option<(i32, i32)> { ... }
fn min_compressed_size(&self, widget_id: WidgetId) -> Option<(i32, i32)> { ... }
fn apply_flow_padding(
&mut self,
widget_id: WidgetId,
padding: [i32; 4],
) -> GuiResult<()> { ... }
fn host_advanced_control(
&mut self,
host: WidgetId,
family: AdvancedFamily,
) -> GuiResult<AdvancedHostCapabilities> { ... }
fn set_combo_box_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()> { ... }
fn set_list_columns(
&mut self,
widget_id: WidgetId,
columns: &[ColumnSpec],
) -> GuiResult<()> { ... }
fn set_list_rows(
&mut self,
widget_id: WidgetId,
rows: &[Vec<String>],
) -> GuiResult<()> { ... }
fn clear_selection(&mut self, widget_id: WidgetId) -> GuiResult<()> { ... }
fn visible_anchor_index(
&self,
widget_id: WidgetId,
) -> GuiResult<Option<usize>> { ... }
fn scroll_to_row(
&mut self,
widget_id: WidgetId,
index: usize,
) -> GuiResult<()> { ... }
fn rows_end_visible(&self, widget_id: WidgetId) -> GuiResult<bool> { ... }
fn apply_row_delta(
&mut self,
widget_id: WidgetId,
ops: &[RowOp],
) -> GuiResult<()> { ... }
fn set_layout_position(
&mut self,
widget_id: WidgetId,
x: i32,
y: i32,
) -> GuiResult<()> { ... }
fn image_resource_capabilities(&self) -> ImageResourceCapabilities { ... }
fn load_image_resource(
&mut self,
_resource: ImageResourceId,
_data: &ImageData,
) -> GuiResult<()> { ... }
fn release_image_resource(
&mut self,
_resource: ImageResourceId,
) -> GuiResult<()> { ... }
fn set_image_fit(
&mut self,
_widget_id: WidgetId,
_fit: ImageFit,
) -> GuiResult<()> { ... }
fn set_file_chooser_mode(
&mut self,
_widget_id: WidgetId,
_mode: FileChooserMode,
) -> GuiResult<()> { ... }
fn set_icon(
&mut self,
_widget_id: WidgetId,
_icon: Option<IconRole>,
) -> GuiResult<()> { ... }
fn set_color_dialog_data(
&mut self,
_widget_id: WidgetId,
_data: &ColorDialogData,
) -> GuiResult<()> { ... }
fn set_font_dialog_data(
&mut self,
_widget_id: WidgetId,
_data: &FontDialogData,
) -> GuiResult<()> { ... }
fn set_toolbar_items(
&mut self,
_widget_id: WidgetId,
_items: &[ToolbarItem],
) -> GuiResult<()> { ... }
fn set_toolbar_orientation(
&mut self,
_widget_id: WidgetId,
_orientation: ToolbarOrientation,
) -> GuiResult<()> { ... }
fn set_calendar_selected_dates(
&mut self,
_widget_id: WidgetId,
_dates: &[CalendarDate],
) -> GuiResult<()> { ... }
fn set_calendar_bounds(
&mut self,
_widget_id: WidgetId,
_min_date: Option<CalendarDate>,
_max_date: Option<CalendarDate>,
) -> GuiResult<()> { ... }
fn set_calendar_first_day_of_week(
&mut self,
_widget_id: WidgetId,
_first_day: CalendarFirstDayOfWeek,
) -> GuiResult<()> { ... }
fn set_calendar_selection_mode(
&mut self,
_widget_id: WidgetId,
_mode: CalendarSelectionMode,
) -> GuiResult<()> { ... }
fn set_container_wrap(
&mut self,
widget_id: WidgetId,
wrap: ContainerWrap,
) -> GuiResult<()> { ... }
fn create_gpu_fallback(
&mut self,
_spec: &WidgetSpec,
_policy: GpuDegradationPolicy,
) -> GuiResult<()> { ... }
fn set_canvas_surface(
&mut self,
_widget_id: WidgetId,
_surface: &CanvasSurface,
) -> GuiResult<()> { ... }
fn metal_canvas_handle(
&self,
_widget_id: WidgetId,
) -> GuiResult<MetalCanvasHandle> { ... }
fn reparent(
&mut self,
child: WidgetId,
new_parent: WidgetId,
) -> GuiResult<()> { ... }
fn backend_name(&self) -> &'static str { ... }
fn capture_window_rgba(
&self,
_widget_id: WidgetId,
_include_decorations: bool,
) -> GuiResult<(u32, u32, Vec<u8>)> { ... }
fn capture_widget_rgba(
&self,
_widget_id: WidgetId,
) -> GuiResult<(u32, u32, Vec<u8>)> { ... }
fn native_read_text(
&self,
_widget_id: WidgetId,
) -> GuiResult<Option<String>> { ... }
fn native_read_checked(
&self,
_widget_id: WidgetId,
) -> GuiResult<Option<bool>> { ... }
fn native_click(&self, _widget_id: WidgetId) -> GuiResult<bool> { ... }
fn native_type_text(
&self,
_widget_id: WidgetId,
_text: &str,
) -> GuiResult<bool> { ... }
fn native_close(&self, _widget_id: WidgetId) -> GuiResult<bool> { ... }
fn e2e_capability(
&self,
_widget_id: WidgetId,
_operation: Operation,
) -> GuiResult<Capability> { ... }
fn e2e_click(&mut self, _widget_id: WidgetId) -> GuiResult<()> { ... }
fn e2e_type_text(
&mut self,
_widget_id: WidgetId,
_text: &str,
) -> GuiResult<()> { ... }
fn e2e_check(
&mut self,
_widget_id: WidgetId,
_checked: bool,
) -> GuiResult<()> { ... }
fn e2e_text(&self, _widget_id: WidgetId) -> GuiResult<String> { ... }
fn e2e_checked(&self, _widget_id: WidgetId) -> GuiResult<bool> { ... }
fn e2e_poll_event(&mut self) -> GuiResult<Option<UiEvent>> { ... }
fn set_clipboard_text(&mut self, _text: &str) -> GuiResult<()> { ... }
fn clipboard_text(&mut self) -> GuiResult<Option<String>> { ... }
fn paste_image_from_clipboard(
&mut self,
) -> GuiResult<Option<ClipboardImage>> { ... }
fn set_accessible_name(
&mut self,
_widget_id: WidgetId,
_name: &str,
) -> GuiResult<()> { ... }
fn set_accessible_description(
&mut self,
_widget_id: WidgetId,
_description: &str,
) -> GuiResult<()> { ... }
fn post_accessible_notification(
&mut self,
widget_id: WidgetId,
notification: AccessibleNotification,
) -> GuiResult<()> { ... }
fn set_focus(&mut self, _widget_id: WidgetId) -> GuiResult<()> { ... }
fn set_focusable(
&mut self,
_widget_id: WidgetId,
_focusable: bool,
) -> GuiResult<()> { ... }
fn set_theme(&mut self, _theme: &Theme) -> GuiResult<()> { ... }
fn set_theme_override(
&mut self,
_widget_id: WidgetId,
_theme_override: ThemeOverride,
) -> GuiResult<()> { ... }
fn clear_theme_overrides(&mut self, _widget_id: WidgetId) -> GuiResult<()> { ... }
fn theme_capabilities(&self) -> ThemeCapabilities { ... }
fn system_theme_mode(&self) -> Option<ThemeMode> { ... }
fn system_high_contrast(&self) -> bool { ... }
fn art_capabilities(&self) -> ArtCapabilities { ... }
fn native_stock_icon(
&self,
role: IconRole,
size: IconSize,
) -> GuiResult<StockIcon> { ... }
fn display_capabilities(&self) -> DisplayCapabilities { ... }
fn gpu_surface_capabilities(&self) -> GpuSurfaceCapabilities { ... }
fn displays(&self) -> GuiResult<Vec<DisplayInfo>> { ... }
fn primary_display(&self) -> GuiResult<Option<DisplayInfo>> { ... }
fn widget_scale_factor(&self, _widget_id: WidgetId) -> f64 { ... }
fn wake_handle(&self) -> Option<Arc<dyn Fn() + Send + Sync>> { ... }
fn show_file_dialog(
&mut self,
token: u64,
request: &FileDialog,
) -> GuiResult<()> { ... }
fn native_window_handle(
&self,
window_id: WidgetId,
) -> GuiResult<NativeWindowHandle> { ... }
fn set_close_guard(
&mut self,
_widget_id: WidgetId,
_guarded: bool,
) -> GuiResult<()> { ... }
fn window_capabilities(&self) -> WindowCapabilities { ... }
fn set_window_options(
&mut self,
widget_id: WidgetId,
options: &WindowOptions,
) -> GuiResult<()> { ... }
fn dismiss_popup(&mut self, widget_id: WidgetId) -> GuiResult<()> { ... }
fn timer_capabilities(&self) -> TimerCapabilities { ... }
fn motion_capabilities(&self) -> MotionCapabilities { ... }
fn start_timer(&mut self, timer: TimerId, spec: TimerSpec) -> GuiResult<()> { ... }
fn start_widget_timer(
&mut self,
timer: TimerId,
widget_id: WidgetId,
spec: TimerSpec,
stop_policy: TimerStopPolicy,
) -> GuiResult<()> { ... }
fn cancel_timer(&mut self, timer: TimerId) -> GuiResult<()> { ... }
fn set_menu_item_enabled(
&mut self,
_item_id: MenuItemId,
_enabled: bool,
) -> GuiResult<()> { ... }
fn set_menu_item_text(
&mut self,
_item_id: MenuItemId,
_text: &str,
) -> GuiResult<()> { ... }
fn insert_menu_item(
&mut self,
_menu_id: MenuId,
_item_id: MenuItemId,
_index: usize,
_text: &str,
_shortcut: Option<&str>,
) -> GuiResult<()> { ... }
fn remove_menu_item(&mut self, _item_id: MenuItemId) -> GuiResult<()> { ... }
fn remove_submenu(&mut self, _submenu_id: MenuId) -> GuiResult<()> { ... }
fn set_window_min_size(
&mut self,
_widget_id: WidgetId,
_w: u32,
_h: u32,
) -> GuiResult<()> { ... }
fn set_resizable(
&mut self,
_widget_id: WidgetId,
_resizable: bool,
) -> GuiResult<()> { ... }
fn set_placeholder_text(
&mut self,
_widget_id: WidgetId,
_text: &str,
) -> GuiResult<()> { ... }
fn set_rich_text_runs(
&mut self,
_widget_id: WidgetId,
_runs: &[TextRun],
) -> GuiResult<()> { ... }
fn set_rich_text_images(
&mut self,
_widget_id: WidgetId,
_images: &[RichTextImage],
) -> GuiResult<()> { ... }
fn set_spell_check(
&mut self,
_widget_id: WidgetId,
_enabled: bool,
) -> GuiResult<()> { ... }
fn set_monospace(
&mut self,
_widget_id: WidgetId,
_monospace: bool,
) -> GuiResult<()> { ... }
fn set_font(
&mut self,
_widget_id: WidgetId,
_font: Option<&FontDescriptor>,
) -> GuiResult<()> { ... }
fn set_row_icons(
&mut self,
_widget_id: WidgetId,
_icons: &[Option<IconRole>],
) -> GuiResult<()> { ... }
fn create_tray_icon(
&mut self,
_spec: &TrayIconSpec,
) -> GuiResult<TrayIconId> { ... }
fn destroy_tray_icon(&mut self, _id: TrayIconId) -> GuiResult<()> { ... }
fn set_tray_icon_tooltip(
&mut self,
_id: TrayIconId,
_tooltip: &str,
) -> GuiResult<()> { ... }
fn set_tray_icon_menu(
&mut self,
_id: TrayIconId,
_menu: Option<MenuId>,
) -> GuiResult<()> { ... }
fn set_tray_icon_visible(
&mut self,
_id: TrayIconId,
_visible: bool,
) -> GuiResult<()> { ... }
fn set_tray_icon_icon(
&mut self,
_id: TrayIconId,
_icon_bytes: Option<Vec<u8>>,
) -> GuiResult<()> { ... }
}Expand description
Backend contract implemented by platform-specific renderers.
§Method Groups
The trait carries 162 items: 160 methods declared here, the inherited
TextMeasure::measure_text supertrait method, and the
Self::NativeHandle associated type. They fall into seventeen subsystems;
the groups are stable, and a new method joins an existing group or argues
for a new one (see docs/guides/backend-development.md section 10 for the
expansion governance and Chapter 17 of the book for the narrative
walkthrough).
| Group | Items | Covers |
|---|---|---|
| Lifecycle & hierarchy | 8 | create, attach child, reparent, show/hide, remove, enable, activate |
| Menus & menu items | 10 | menu structure, attachment, item enablement/labels, dynamic insert/remove |
| Text & input properties | 12 | text, label alignment/wrap, text selection, completion, placeholder, rich-text runs/images, monospace, explicit font, live selection readback, native spell checking |
| Value & selection properties | 8 | checked, value/range/step, tab labels, selected index/indices, link URL |
| Layout, containers & flow | 13 | size/min size/layout size, natural size, compressed-size floor, position, flow padding, container direction/wrap/scroll/gap/padding |
| Collections, grids & trees | 18 | list items, runtime combo-box items, list columns/rows, per-row art-provider icons, selection clearing, anchor/scroll/end visibility, row drag, grid rows/model/metrics/selection, row deltas, tree items |
| Calendar & date | 5 | selected dates, bounds, first day of week, selection mode, date value |
| Presentation & tool strips | 10 | background, tooltip, alert level, image source/fit, toolbar items/orientation, typed image resources |
| System tray & status icons | 6 | tray icon lifecycle, pixels, tooltip, context menu, visibility |
| Dialogs & windowing | 11 | confirm dialog, function-style file dialog, close guard, file-chooser mode, color/font dialog data, window min size/resizable, extended window capabilities/options, popup dismissal |
| Clipboard, drops & data directory | 9 | clipboard text/image, paste image, app data directory, file/URL/text drop targets, MIME drag capabilities/source/target options |
| Focus & accessibility | 5 | focus/focusable, accessible name/description, post notification |
| Theming & stock art | 9 | theme apply/override/capabilities, system mode/high contrast, stock-art icon set/query, art capabilities |
| Events, tasks & lane introspection | 10 | event polling/blocking, wake hook, advanced-control hosting, backend name, timer and motion capabilities/start/scoped start/cancel |
| Canvas, GPU & displays | 10 | scenes/surfaces, demo cube, GPU fallback/surface capabilities, display capabilities/enumeration/scale |
| Native handles & text measurement | 4 | Vulkan-canvas native handle and its associated type, top-level window handle, inherited measure_text |
| Screenshot & E2E adapters | 14 | window/widget capture, native readbacks and simulated input, E2E capability/actions/poll |
§Maintenance
The counts are verified mechanically - from the repository root:
python -c "import re;s=open('crates/native-gui-core/src/ui.rs',encoding='utf-8').read();b=s.split('\npub trait Backend: TextMeasure {',1)[1].split('\n}\n',1)[0];t=s.split('\npub trait TextMeasure {',1)[1].split('\n}\n',1)[0];f=lambda x:len(re.findall(r'(?m)^ (?:unsafe )?fn \w+',x));a=len(re.findall(r'(?m)^ type \w+',b));print('Backend %d fns + %d assoc type + %d supertrait fn = %d trait items'%(f(b),a,f(t),f(b)+a+f(t)))"It must print Backend 160 fns + 1 assoc type + 1 supertrait fn = 162 trait items; adding, removing, or renaming a method updates this
inventory (count and table) in the same commit - see “Backend work” in
CONTRIBUTING.md.
§Operational contract (Pre / Post / Inv)
Every method obeys the same operational semantics; the deterministic
contract tests in tests/functional_flow.rs and the unit
tests in this module pin them:
- Pre-conditions. The widget id names a live widget; a kind-restricted
operation is offered only when the kind is inside the property’s
WidgetProperty::applicable_kindsrow; validated values reject before any mutation (min <= max, positive sizes/steps, finite canvas extents,start <= end). - Post-conditions. A successful call mirrors the new value on the
shared
WidgetSpecexactly once and forwards the same value to the native control; an unrelated widget and unrelated native handles are never touched. A refused call is transactional: the shared spec and the backend record are byte-identical to the pre-call state. - Invariants. Parent links form a strict acyclic forest (single
parentage);
WidgetIds are monotonic and never reused, including after removal; a removed widget takes its whole subtree with it (Ui::remove); and the shared spec stays in exact sync with the native value the backend reports (the Mock lane asserts full spec equality).
§FFI memory boundary and ownership
Chapter 17’s first structural invariant (lossless strings, bounded
closures) is asserted here so every lane implements the same seam; the
digest lives in docs/reference/architecture.md:
- String encodings. Every
&str/Stringcrossing this trait is Rust UTF-8, and a lane transcodes it losslessly to its native format at the call site: Win32 builds UTF-16 (NUL-terminated) buffers through itsto_widehelper, GTK consumes UTF-8 through gtk-rs (which owns the native conversion), and Cocoa buildsNSStrings from UTF-8. Borrowed text is strictly call-scoped: a lane must copy whatever it retains, no borrowed pointer outlives the call, and theWidgetSpecon the shared side stays the authoritative text. - Closure lifetimes. The trait takes and retains no closures.
Application callbacks are
'staticvalues registered onUi(Ui::on_window_close,Ui::on_window_resize,Ui::on_menu_item_selected, therun_until_closed*handlers), owned by theUiand dispatched from its staged event pump - never invoked directly inside a native signal handler. A lane that reaches a native event loop bridges through state owned for the widget’s lifetime (GTKRc<RefCell<...>>captures, Win32 window properties plusWM_BRIDGED_*messages), so the native loop can never dispatch into freed application state and no application closure is stored in aWNDPROCor a native delegate. - Ownership and release.
Uiowns the widget tree and every value throughWidgetSpec; a lane’s per-widget state is an implementation record keyed byWidgetId(never a second source of truth, see the coherence invariant above), and everyremovepath releases the native handles, models, brushes, and parked properties it allocated.
Required Associated Types§
Sourcetype NativeHandle
type NativeHandle
Returns backend-native handle information for a Vulkan canvas widget.
Required Methods§
Sourcefn create_widget(&mut self, spec: &WidgetSpec) -> GuiResult<()>
fn create_widget(&mut self, spec: &WidgetSpec) -> GuiResult<()>
Creates a native widget from a shared specification.
spec is borrowed for the duration of the call: the lane copies
every value it retains (strings included - see the trait’s FFI memory
boundary section), while Ui keeps owning the authoritative spec.
Creates a native menu container.
Creates a submenu under parent_id.
slot_id names the submenu’s row inside the parent’s ordered list;
it is minted from the item-id space so a submenu
row can never be mistaken for a real item, and lanes that record
order (Mock) store it next to the items.
Creates a native menu item under an existing menu.
Attaches a menu to a window.
Attaches a menu as a right-click context menu on a widget.
Sourcefn set_text(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>
fn set_text(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>
Sets text/value-like content for a widget.
Sourcefn set_checked(&mut self, widget_id: WidgetId, checked: bool) -> GuiResult<()>
fn set_checked(&mut self, widget_id: WidgetId, checked: bool) -> GuiResult<()>
Sets checked state for check-capable widgets.
Sourcefn set_value(&mut self, widget_id: WidgetId, value: i32) -> GuiResult<()>
fn set_value(&mut self, widget_id: WidgetId, value: i32) -> GuiResult<()>
Sets numeric value for value-capable widgets.
Sourcefn set_range(
&mut self,
widget_id: WidgetId,
min: i32,
max: i32,
) -> GuiResult<()>
fn set_range( &mut self, widget_id: WidgetId, min: i32, max: i32, ) -> GuiResult<()>
Sets numeric range for widgets supporting min/max semantics.
Sourcefn set_step(&mut self, widget_id: WidgetId, step: i32) -> GuiResult<()>
fn set_step(&mut self, widget_id: WidgetId, step: i32) -> GuiResult<()>
Sets numeric step for widgets supporting step semantics.
Sourcefn set_selected_index(
&mut self,
widget_id: WidgetId,
index: usize,
) -> GuiResult<()>
fn set_selected_index( &mut self, widget_id: WidgetId, index: usize, ) -> GuiResult<()>
Sets selected index for widgets exposing item/page selection.
Sourcefn set_tab_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()>
fn set_tab_items( &mut self, widget_id: WidgetId, items: &[String], ) -> GuiResult<()>
Sets page labels for a tabs widget.
Labels follow the attached pages in attach order. Backends relabel pages they have already applied (Win32 strip items, GTK notebook pages, Cocoa tab-view items) and use the labels for pages attached later; pages without a label keep the backend placeholder header.
Sourcefn set_selected_indices(
&mut self,
widget_id: WidgetId,
indices: &[usize],
) -> GuiResult<()>
fn set_selected_indices( &mut self, widget_id: WidgetId, indices: &[usize], ) -> GuiResult<()>
Sets multiple selected indices for multi-select list/tree widgets.
Sourcefn set_row_drag(
&mut self,
widget_id: WidgetId,
source: bool,
target: bool,
) -> GuiResult<()>
fn set_row_drag( &mut self, widget_id: WidgetId, source: bool, target: bool, ) -> GuiResult<()>
Enables/disables row drag-source and drop-target behavior on a row widget.
Sourcefn set_size(
&mut self,
widget_id: WidgetId,
width: i32,
height: i32,
) -> GuiResult<()>
fn set_size( &mut self, widget_id: WidgetId, width: i32, height: i32, ) -> GuiResult<()>
Sets preferred dimensions for widgets.
Sourcefn set_data_list_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()>
fn set_data_list_items( &mut self, widget_id: WidgetId, items: &[String], ) -> GuiResult<()>
Sets items for a data list widget.
Sourcefn set_data_grid_rows(
&mut self,
widget_id: WidgetId,
rows: Arc<Vec<Vec<String>>>,
) -> GuiResult<()>
fn set_data_grid_rows( &mut self, widget_id: WidgetId, rows: Arc<Vec<Vec<String>>>, ) -> GuiResult<()>
Sets row-major cell data for a data grid widget (legacy string matrix).
The matrix is shared as one Arc between the manager’s spec and the
backend, so neither keeps a private resident copy.
Sourcefn set_data_grid_model(
&mut self,
widget_id: WidgetId,
model: Box<dyn DataGridModel>,
) -> GuiResult<()>
fn set_data_grid_model( &mut self, widget_id: WidgetId, model: Box<dyn DataGridModel>, ) -> GuiResult<()>
Sets a virtual data model for a data grid widget.
Sourcefn set_data_grid_row_height(
&mut self,
widget_id: WidgetId,
row: usize,
height: i32,
) -> GuiResult<()>
fn set_data_grid_row_height( &mut self, widget_id: WidgetId, row: usize, height: i32, ) -> GuiResult<()>
Sets the height of a specific row in a data grid widget.
Sourcefn set_data_grid_col_width(
&mut self,
widget_id: WidgetId,
col: usize,
width: i32,
) -> GuiResult<()>
fn set_data_grid_col_width( &mut self, widget_id: WidgetId, col: usize, width: i32, ) -> GuiResult<()>
Sets the width of a specific column in a data grid widget.
Sourcefn set_data_grid_frozen_panes(
&mut self,
widget_id: WidgetId,
rows: usize,
cols: usize,
) -> GuiResult<()>
fn set_data_grid_frozen_panes( &mut self, widget_id: WidgetId, rows: usize, cols: usize, ) -> GuiResult<()>
Sets the number of frozen rows and columns in a data grid widget.
Sourcefn set_data_grid_selection(
&mut self,
widget_id: WidgetId,
selection: &[(usize, usize)],
) -> GuiResult<()>
fn set_data_grid_selection( &mut self, widget_id: WidgetId, selection: &[(usize, usize)], ) -> GuiResult<()>
Sets the selected cells for a DataGrid.
Sourcefn set_tree_items(
&mut self,
widget_id: WidgetId,
items: &[TreeItem],
) -> GuiResult<()>
fn set_tree_items( &mut self, widget_id: WidgetId, items: &[TreeItem], ) -> GuiResult<()>
Sets hierarchical items for a tree view widget.
Sourcefn set_position(&mut self, widget_id: WidgetId, x: i32, y: i32) -> GuiResult<()>
fn set_position(&mut self, widget_id: WidgetId, x: i32, y: i32) -> GuiResult<()>
Sets preferred position for widgets.
Sourcefn set_background_color(
&mut self,
widget_id: WidgetId,
color: Color,
) -> GuiResult<()>
fn set_background_color( &mut self, widget_id: WidgetId, color: Color, ) -> GuiResult<()>
Sets background color for a widget.
Sourcefn set_alert_level(
&mut self,
widget_id: WidgetId,
level: AlertLevel,
) -> GuiResult<()>
fn set_alert_level( &mut self, widget_id: WidgetId, level: AlertLevel, ) -> GuiResult<()>
Sets alert severity for an alert dialog widget.
Sourcefn set_image_source(
&mut self,
widget_id: WidgetId,
source: &str,
) -> GuiResult<()>
fn set_image_source( &mut self, widget_id: WidgetId, source: &str, ) -> GuiResult<()>
Sets image source for image-capable widgets.
Sourcefn set_date_value(
&mut self,
widget_id: WidgetId,
iso_date: &str,
) -> GuiResult<()>
fn set_date_value( &mut self, widget_id: WidgetId, iso_date: &str, ) -> GuiResult<()>
Sets date value (YYYY-MM-DD) for date-capable widgets.
Sourcefn set_link_url(&mut self, widget_id: WidgetId, url: &str) -> GuiResult<()>
fn set_link_url(&mut self, widget_id: WidgetId, url: &str) -> GuiResult<()>
Sets URL for link-capable widgets.
Sourcefn set_container_direction(
&mut self,
widget_id: WidgetId,
direction: ContainerDirection,
) -> GuiResult<()>
fn set_container_direction( &mut self, widget_id: WidgetId, direction: ContainerDirection, ) -> GuiResult<()>
Sets stacking direction for container widgets.
Sourcefn set_container_scroll(
&mut self,
widget_id: WidgetId,
vertical: bool,
horizontal: bool,
) -> GuiResult<()>
fn set_container_scroll( &mut self, widget_id: WidgetId, vertical: bool, horizontal: bool, ) -> GuiResult<()>
Sets scroll capability for container widgets.
Sourcefn set_container_gap(&mut self, widget_id: WidgetId, gap: i32) -> GuiResult<()>
fn set_container_gap(&mut self, widget_id: WidgetId, gap: i32) -> GuiResult<()>
Sets the uniform spacing between a flow container’s children.
Sourcefn set_container_padding(
&mut self,
widget_id: WidgetId,
padding: i32,
) -> GuiResult<()>
fn set_container_padding( &mut self, widget_id: WidgetId, padding: i32, ) -> GuiResult<()>
Sets the uniform inset between a container’s edges and its children.
Sourcefn draw_demo_cube(&mut self, widget_id: WidgetId) -> GuiResult<()>
fn draw_demo_cube(&mut self, widget_id: WidgetId) -> GuiResult<()>
Draws a built-in colored 3D cube demo into a Vulkan canvas widget.
Sourcefn set_canvas_scene(
&mut self,
widget_id: WidgetId,
scene: &CanvasScene,
) -> GuiResult<()>
fn set_canvas_scene( &mut self, widget_id: WidgetId, scene: &CanvasScene, ) -> GuiResult<()>
Sets the scene content for a WidgetKind::Canvas widget.
fn native_handle(&self, widget_id: WidgetId) -> GuiResult<Self::NativeHandle>
Sourcefn add_child(&mut self, parent: WidgetId, child: WidgetId) -> GuiResult<()>
fn add_child(&mut self, parent: WidgetId, child: WidgetId) -> GuiResult<()>
Adds a child widget to a parent widget.
Sourcefn remove(&mut self, widget_id: WidgetId) -> GuiResult<()>
fn remove(&mut self, widget_id: WidgetId) -> GuiResult<()>
Removes a widget and its native counterpart.
Sourcefn set_enabled(&mut self, widget_id: WidgetId, enabled: bool) -> GuiResult<()>
fn set_enabled(&mut self, widget_id: WidgetId, enabled: bool) -> GuiResult<()>
Enables or disables a widget.
Sourcefn activate(&mut self, widget_id: WidgetId) -> GuiResult<()>
fn activate(&mut self, widget_id: WidgetId) -> GuiResult<()>
Programmatically activates a clickable widget, as if it were clicked.
Sourcefn data_dir(&self) -> GuiResult<PathBuf>
fn data_dir(&self) -> GuiResult<PathBuf>
Returns the platform-specific application data directory.
Sourcefn set_tooltip(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>
fn set_tooltip(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>
Sets tooltip text for a widget.
Sourcefn poll_event(&mut self) -> GuiResult<Option<UiEvent>>
fn poll_event(&mut self) -> GuiResult<Option<UiEvent>>
Blocks until the next UI event is available.
Unlike poll_event, this parks the thread inside the platform’s
event system instead of busy-polling.
Sourcefn wait_event(&mut self) -> GuiResult<UiEvent>
fn wait_event(&mut self) -> GuiResult<UiEvent>
Blocks until the next UI event is available and returns it.
Provided Methods§
Sourcefn set_label_alignment(
&mut self,
widget_id: WidgetId,
alignment: LabelAlignment,
) -> GuiResult<()>
fn set_label_alignment( &mut self, widget_id: WidgetId, alignment: LabelAlignment, ) -> GuiResult<()>
Sets horizontal alignment for a Label.
Lanes without a native alignment mapping report the typed
label_alignment capability error.
Sourcefn set_label_wrap(
&mut self,
widget_id: WidgetId,
wrap: LabelWrap,
) -> GuiResult<()>
fn set_label_wrap( &mut self, widget_id: WidgetId, wrap: LabelWrap, ) -> GuiResult<()>
Sets line wrapping for a Label.
Lanes without the requested wrapping behavior report the typed
label_wrap capability error.
Sourcefn text_selection(&self, _widget_id: WidgetId) -> GuiResult<(usize, usize)>
fn text_selection(&self, _widget_id: WidgetId) -> GuiResult<(usize, usize)>
Reads the native text selection as ordered Unicode character offsets. Unlike WidgetSpec’s last programmatic selection, this reflects mouse selection and caret navigation in the live text control.
Sourcefn set_text_selection(
&mut self,
widget_id: WidgetId,
start: usize,
end: usize,
) -> GuiResult<()>
fn set_text_selection( &mut self, widget_id: WidgetId, start: usize, end: usize, ) -> GuiResult<()>
Selects a character range (start inclusive, end exclusive) in a text control.
Backends without a native text-selection mapping report
GuiError::UnsupportedWidget instead of silently dropping the
call, so per-lane coverage stays accurate.
Sourcefn set_text_completion_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()>
fn set_text_completion_items( &mut self, widget_id: WidgetId, items: &[String], ) -> GuiResult<()>
Sets the completion/suggestion item list for a TextInput.
items is the full suggestion list; lanes filter it for the current
text (case-insensitive prefix by default) and own their popup.
Backends without a completion mapping report
GuiError::UnsupportedCapability with the "text_completion"
identifier instead of silently ignoring the request.
Sourcefn drag_capabilities(&self) -> DragCapabilities
fn drag_capabilities(&self) -> DragCapabilities
Reports support for the additive text/custom-MIME drag surface.
Sourcefn set_drag_source_options(
&mut self,
widget_id: WidgetId,
options: &DragSourceOptions,
) -> GuiResult<()>
fn set_drag_source_options( &mut self, widget_id: WidgetId, options: &DragSourceOptions, ) -> GuiResult<()>
Configures text/custom-MIME payloads offered by a source.
Sourcefn set_drag_target_options(
&mut self,
widget_id: WidgetId,
options: &DragTargetOptions,
) -> GuiResult<()>
fn set_drag_target_options( &mut self, widget_id: WidgetId, options: &DragTargetOptions, ) -> GuiResult<()>
Configures accepted payloads and the target’s requested drop effect.
Sourcefn set_file_drop_target(
&mut self,
widget_id: WidgetId,
enabled: bool,
) -> GuiResult<()>
fn set_file_drop_target( &mut self, widget_id: WidgetId, enabled: bool, ) -> GuiResult<()>
Enables/disables accepting external file drops from the OS shell.
Sourcefn set_drop_target(
&mut self,
widget_id: WidgetId,
enabled: bool,
) -> GuiResult<()>
fn set_drop_target( &mut self, widget_id: WidgetId, enabled: bool, ) -> GuiResult<()>
Enables/disables drop target support for files, URLs, and text.
Sourcefn set_min_size(
&mut self,
widget_id: WidgetId,
width: i32,
height: i32,
) -> GuiResult<()>
fn set_min_size( &mut self, widget_id: WidgetId, width: i32, height: i32, ) -> GuiResult<()>
Records a layout size floor for a widget.
Forwarded by Ui::set_min_size. Backends with a native flow layout
consult the recorded minimum as a lower bound when they place
auto-sized children, so a widget the app sized with a minimum never
lays out smaller than that floor. Lanes that place every child from
the shared computed layout keep this default no-op, because the shared
layout pass already honours set_min_size; (0, 0) clears the floor.
Sourcefn set_layout_size(
&mut self,
widget_id: WidgetId,
width: i32,
height: i32,
expand_width: bool,
expand_height: bool,
) -> GuiResult<()>
fn set_layout_size( &mut self, widget_id: WidgetId, width: i32, height: i32, expand_width: bool, expand_height: bool, ) -> GuiResult<()>
Applies computed layout dimensions and GTK-style expansion semantics.
Backends with native flow layouts can use the expansion flags while
retaining set_size’s explicit-size behavior. The default preserves
existing backend behavior.
Sourcefn natural_size(&self, widget_id: WidgetId) -> Option<(i32, i32)>
fn natural_size(&self, widget_id: WidgetId) -> Option<(i32, i32)>
Natural (preferred) size of a leaf widget, when the backend can
measure it. Ui::compute_layout seeds layout leaf styles with this so
auto-sized rows and labels get real heights instead of measuring
zero; None keeps the node’s flex style untouched.
Sourcefn min_compressed_size(&self, widget_id: WidgetId) -> Option<(i32, i32)>
fn min_compressed_size(&self, widget_id: WidgetId) -> Option<(i32, i32)>
Smallest size, (width, height) in logical pixels, a visible leaf
may be compressed to when its window is too small for its natural
content.
Ui::compute_layout resets every non-root min_size to the app’s own
minimum so natural sizes stay a shrinkable basis and rows compress to
the window. That suits lanes that can paint a control at any size. A
lane with quantized geometry (the TUI cell grid paints every widget
in whole cells) returns a floor here so compressed siblings cannot
land on the same cells and overprint each other or lose their labels.
The height floor always applies; the width floor applies only in row
parents, the same rule that seeds a leaf’s natural width. None
(the default) keeps the shrink-to-zero behaviour.
Sourcefn apply_flow_padding(
&mut self,
widget_id: WidgetId,
padding: [i32; 4],
) -> GuiResult<()>
fn apply_flow_padding( &mut self, widget_id: WidgetId, padding: [i32; 4], ) -> GuiResult<()>
Mirrors a declarative container’s flexbox padding ([top, right, bottom, left], logical pixels) onto lanes whose containers lay their
children out natively (GTK boxes). Lanes that place children
from the computed layout already honour the computed layout style and keep this
default no-op. The declarative gap is deliberately not mirrored: a
native box cannot shrink controls below their native minimum, so a
wide layout gap would push trailing controls out of their row; apps
opt in with Ui::set_container_gap.
Sourcefn host_advanced_control(
&mut self,
host: WidgetId,
family: AdvancedFamily,
) -> GuiResult<AdvancedHostCapabilities>
fn host_advanced_control( &mut self, host: WidgetId, family: AdvancedFamily, ) -> GuiResult<AdvancedHostCapabilities>
Hosts an advanced-control family inside host and reports the
runtime capability record for that family.
The default refuses with a typed error, so a lane never silently pretends to host a family; Mock and Win32 override this behind the family’s Cargo feature.
Sourcefn set_combo_box_items(
&mut self,
widget_id: WidgetId,
items: &[String],
) -> GuiResult<()>
fn set_combo_box_items( &mut self, widget_id: WidgetId, items: &[String], ) -> GuiResult<()>
Replaces a ComboBox’s options after creation (found while dogfooding).
Must not emit SelectionChanged. The default reports
UnsupportedCapability("combo_box_items"); options given at creation
(Ui::create_combo_box) work on every lane.
Sourcefn set_list_columns(
&mut self,
widget_id: WidgetId,
columns: &[ColumnSpec],
) -> GuiResult<()>
fn set_list_columns( &mut self, widget_id: WidgetId, columns: &[ColumnSpec], ) -> GuiResult<()>
Sets column headers for the columned list contract.
The default reports the typed GuiError::UnsupportedCapability
with the "list_view_columns" identifier, so a lane without a
columned mapping fails loudly instead of silently rendering a flat
list. Lanes override this when their mapping lands and must keep the
documented cell rule (list_rows[r][c] under column c).
Sourcefn set_list_rows(
&mut self,
widget_id: WidgetId,
rows: &[Vec<String>],
) -> GuiResult<()>
fn set_list_rows( &mut self, widget_id: WidgetId, rows: &[Vec<String>], ) -> GuiResult<()>
Sets row cells for the columned list contract.
Same capability contract as Self::set_list_columns.
Sourcefn clear_selection(&mut self, widget_id: WidgetId) -> GuiResult<()>
fn clear_selection(&mut self, widget_id: WidgetId) -> GuiResult<()>
Clears the native selection of a row widget.
The default reports the typed GuiError::UnsupportedCapability
with the "clear_selection" identifier, so Ui::clear_selection and
a keyed apply that must drop a removed selection fail loudly instead
of leaving the native selection out of sync with the model.
Sourcefn visible_anchor_index(&self, widget_id: WidgetId) -> GuiResult<Option<usize>>
fn visible_anchor_index(&self, widget_id: WidgetId) -> GuiResult<Option<usize>>
Reports the index of the topmost visible row of a row widget, when the
lane can observe its scroll position (capability
"scroll_anchor").
Sourcefn scroll_to_row(&mut self, widget_id: WidgetId, index: usize) -> GuiResult<()>
fn scroll_to_row(&mut self, widget_id: WidgetId, index: usize) -> GuiResult<()>
Scrolls a row widget so index is its topmost visible row.
Same capability contract as Self::visible_anchor_index: a lane
that cannot restore the anchor reports the typed "scroll_anchor"
refusal and the shared model skips re-anchoring instead of guessing.
Sourcefn rows_end_visible(&self, widget_id: WidgetId) -> GuiResult<bool>
fn rows_end_visible(&self, widget_id: WidgetId) -> GuiResult<bool>
Reports whether the last row of a row widget is currently visible
(follow-tail detection): true when the lane can observe the
scroll position and the bottom-most row lies inside the viewport.
Same capability contract as Self::visible_anchor_index: a lane
without the "scroll_anchor" capability reports the typed refusal,
and a widget with no rows answers false (nothing is at the end).
Sourcefn apply_row_delta(
&mut self,
widget_id: WidgetId,
ops: &[RowOp],
) -> GuiResult<()>
fn apply_row_delta( &mut self, widget_id: WidgetId, ops: &[RowOp], ) -> GuiResult<()>
Applies incremental row operations to a row widget.
Backends implement this to avoid full table reconstruction on single-cell
edits, inserts, removes, or moves. The default implementation returns
Err(GuiError::UnsupportedCapability("row_delta".to_owned())).
Sourcefn set_layout_position(
&mut self,
widget_id: WidgetId,
x: i32,
y: i32,
) -> GuiResult<()>
fn set_layout_position( &mut self, widget_id: WidgetId, x: i32, y: i32, ) -> GuiResult<()>
Applies a computed layout position.
Backends with native flow containers may let those containers place children instead of translating the position into manual offsets. The default preserves existing backend behavior.
Sourcefn image_resource_capabilities(&self) -> ImageResourceCapabilities
fn image_resource_capabilities(&self) -> ImageResourceCapabilities
Reports support for bounded in-memory RGBA image resources.
Sourcefn load_image_resource(
&mut self,
_resource: ImageResourceId,
_data: &ImageData,
) -> GuiResult<()>
fn load_image_resource( &mut self, _resource: ImageResourceId, _data: &ImageData, ) -> GuiResult<()>
Loads a UI-allocated image resource into this backend.
The default refuses explicitly so a backend without a pixel provider never reports a success-shaped no-op.
Sourcefn release_image_resource(
&mut self,
_resource: ImageResourceId,
) -> GuiResult<()>
fn release_image_resource( &mut self, _resource: ImageResourceId, ) -> GuiResult<()>
Releases an image resource previously loaded into this backend.
Sourcefn set_image_fit(
&mut self,
_widget_id: WidgetId,
_fit: ImageFit,
) -> GuiResult<()>
fn set_image_fit( &mut self, _widget_id: WidgetId, _fit: ImageFit, ) -> GuiResult<()>
Sets how an image scales into its bounds.
The default returns a typed capability error so a backend without an image surface never silently ignores the request.
Sourcefn set_file_chooser_mode(
&mut self,
_widget_id: WidgetId,
_mode: FileChooserMode,
) -> GuiResult<()>
fn set_file_chooser_mode( &mut self, _widget_id: WidgetId, _mode: FileChooserMode, ) -> GuiResult<()>
Sets what a FileChooserDialog lets the user pick.
The default returns a typed capability error so a backend that cannot present a folder picker never silently shows the wrong dialog.
Sourcefn set_icon(
&mut self,
_widget_id: WidgetId,
_icon: Option<IconRole>,
) -> GuiResult<()>
fn set_icon( &mut self, _widget_id: WidgetId, _icon: Option<IconRole>, ) -> GuiResult<()>
Sets the stock-art icon rendered beside a button’s label.
None clears the icon. The default reports the typed unsupported
error: a lane without a button-art mapping must refuse instead of
silently leaving a text-only button behind.
Sourcefn set_color_dialog_data(
&mut self,
_widget_id: WidgetId,
_data: &ColorDialogData,
) -> GuiResult<()>
fn set_color_dialog_data( &mut self, _widget_id: WidgetId, _data: &ColorDialogData, ) -> GuiResult<()>
Applies colour-dialog preferences to a live ColorDialog.
The default reports the typed unsupported error: a lane that cannot present the native chooser must refuse instead of pretending the preferences took effect.
Sourcefn set_font_dialog_data(
&mut self,
_widget_id: WidgetId,
_data: &FontDialogData,
) -> GuiResult<()>
fn set_font_dialog_data( &mut self, _widget_id: WidgetId, _data: &FontDialogData, ) -> GuiResult<()>
Applies font-dialog preferences to a live FontDialog.
The default reports the typed unsupported error: a lane that cannot present the native chooser must refuse instead of pretending the preferences took effect.
Sourcefn set_toolbar_items(
&mut self,
_widget_id: WidgetId,
_items: &[ToolbarItem],
) -> GuiResult<()>
fn set_toolbar_items( &mut self, _widget_id: WidgetId, _items: &[ToolbarItem], ) -> GuiResult<()>
Replaces the tools of a Toolbar widget.
The default reports the typed unsupported error: a lane that has not composed the native toolbar refuses instead of pretending the items took effect. GTK/Win32/Cocoa compositions land later.
Sourcefn set_toolbar_orientation(
&mut self,
_widget_id: WidgetId,
_orientation: ToolbarOrientation,
) -> GuiResult<()>
fn set_toolbar_orientation( &mut self, _widget_id: WidgetId, _orientation: ToolbarOrientation, ) -> GuiResult<()>
Sets the orientation of a Toolbar widget.
The default reports the typed unsupported error for the same reason as
Backend::set_toolbar_items; a lane whose native control is
horizontal-only reports UnsupportedCapability("toolbar_vertical")
for a vertical request once its composition lands.
Sourcefn set_calendar_selected_dates(
&mut self,
_widget_id: WidgetId,
_dates: &[CalendarDate],
) -> GuiResult<()>
fn set_calendar_selected_dates( &mut self, _widget_id: WidgetId, _dates: &[CalendarDate], ) -> GuiResult<()>
Sets selected dates for a calendar widget.
Sourcefn set_calendar_bounds(
&mut self,
_widget_id: WidgetId,
_min_date: Option<CalendarDate>,
_max_date: Option<CalendarDate>,
) -> GuiResult<()>
fn set_calendar_bounds( &mut self, _widget_id: WidgetId, _min_date: Option<CalendarDate>, _max_date: Option<CalendarDate>, ) -> GuiResult<()>
Sets selectable bounds for a calendar widget.
Sourcefn set_calendar_first_day_of_week(
&mut self,
_widget_id: WidgetId,
_first_day: CalendarFirstDayOfWeek,
) -> GuiResult<()>
fn set_calendar_first_day_of_week( &mut self, _widget_id: WidgetId, _first_day: CalendarFirstDayOfWeek, ) -> GuiResult<()>
Sets the first day of the week convention for a calendar widget.
Sourcefn set_calendar_selection_mode(
&mut self,
_widget_id: WidgetId,
_mode: CalendarSelectionMode,
) -> GuiResult<()>
fn set_calendar_selection_mode( &mut self, _widget_id: WidgetId, _mode: CalendarSelectionMode, ) -> GuiResult<()>
Sets the selection mode for a calendar widget.
Sourcefn set_container_wrap(
&mut self,
widget_id: WidgetId,
wrap: ContainerWrap,
) -> GuiResult<()>
fn set_container_wrap( &mut self, widget_id: WidgetId, wrap: ContainerWrap, ) -> GuiResult<()>
Sets wrap behavior for container widgets.
Sourcefn create_gpu_fallback(
&mut self,
_spec: &WidgetSpec,
_policy: GpuDegradationPolicy,
) -> GuiResult<()>
fn create_gpu_fallback( &mut self, _spec: &WidgetSpec, _policy: GpuDegradationPolicy, ) -> GuiResult<()>
Creates a backend-native degraded replacement for an unavailable Vulkan canvas. Backends must refuse rather than fabricate a fallback.
Sourcefn set_canvas_surface(
&mut self,
_widget_id: WidgetId,
_surface: &CanvasSurface,
) -> GuiResult<()>
fn set_canvas_surface( &mut self, _widget_id: WidgetId, _surface: &CanvasSurface, ) -> GuiResult<()>
Sets the raster surface painted beneath a WidgetKind::Canvas scene.
Backends without an implementation return a typed error.
Sourcefn metal_canvas_handle(
&self,
_widget_id: WidgetId,
) -> GuiResult<MetalCanvasHandle>
fn metal_canvas_handle( &self, _widget_id: WidgetId, ) -> GuiResult<MetalCanvasHandle>
Returns backend-native handle information for a Metal canvas widget.
Sourcefn reparent(&mut self, child: WidgetId, new_parent: WidgetId) -> GuiResult<()>
fn reparent(&mut self, child: WidgetId, new_parent: WidgetId) -> GuiResult<()>
Reparents an existing child to a new parent.
Sourcefn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Returns the backend’s short identifier (e.g. “mock”, “win32”, “gtk”, “cocoa”).
Sourcefn capture_window_rgba(
&self,
_widget_id: WidgetId,
_include_decorations: bool,
) -> GuiResult<(u32, u32, Vec<u8>)>
fn capture_window_rgba( &self, _widget_id: WidgetId, _include_decorations: bool, ) -> GuiResult<(u32, u32, Vec<u8>)>
Captures a screenshot of the specified window as RGBA pixels.
Sourcefn capture_widget_rgba(
&self,
_widget_id: WidgetId,
) -> GuiResult<(u32, u32, Vec<u8>)>
fn capture_widget_rgba( &self, _widget_id: WidgetId, ) -> GuiResult<(u32, u32, Vec<u8>)>
Captures a screenshot of the specified widget as RGBA pixels.
Sourcefn native_read_text(&self, _widget_id: WidgetId) -> GuiResult<Option<String>>
fn native_read_text(&self, _widget_id: WidgetId) -> GuiResult<Option<String>>
Reads live text for a widget (E2E readback).
Sourcefn native_read_checked(&self, _widget_id: WidgetId) -> GuiResult<Option<bool>>
fn native_read_checked(&self, _widget_id: WidgetId) -> GuiResult<Option<bool>>
Reads live checked state for a checkbox (E2E readback).
Sourcefn native_click(&self, _widget_id: WidgetId) -> GuiResult<bool>
fn native_click(&self, _widget_id: WidgetId) -> GuiResult<bool>
Native click simulation (E2E).
Sourcefn native_type_text(&self, _widget_id: WidgetId, _text: &str) -> GuiResult<bool>
fn native_type_text(&self, _widget_id: WidgetId, _text: &str) -> GuiResult<bool>
Native type text simulation (E2E).
Sourcefn native_close(&self, _widget_id: WidgetId) -> GuiResult<bool>
fn native_close(&self, _widget_id: WidgetId) -> GuiResult<bool>
Native close simulation (E2E).
Sourcefn e2e_capability(
&self,
_widget_id: WidgetId,
_operation: Operation,
) -> GuiResult<Capability>
fn e2e_capability( &self, _widget_id: WidgetId, _operation: Operation, ) -> GuiResult<Capability>
Services a bounded native-work slice; unverified adapters refuse it.
fn e2e_click(&mut self, _widget_id: WidgetId) -> GuiResult<()>
fn e2e_type_text(&mut self, _widget_id: WidgetId, _text: &str) -> GuiResult<()>
fn e2e_check(&mut self, _widget_id: WidgetId, _checked: bool) -> GuiResult<()>
fn e2e_text(&self, _widget_id: WidgetId) -> GuiResult<String>
fn e2e_checked(&self, _widget_id: WidgetId) -> GuiResult<bool>
fn e2e_poll_event(&mut self) -> GuiResult<Option<UiEvent>>
Sourcefn set_clipboard_text(&mut self, _text: &str) -> GuiResult<()>
fn set_clipboard_text(&mut self, _text: &str) -> GuiResult<()>
Writes text to the platform clipboard.
Default: no-op — the Ui layer keeps an in-memory mirror so paste
still works. Native backends override this with real OS clipboard
writes (GTK today; Win32 tracked).
Sourcefn clipboard_text(&mut self) -> GuiResult<Option<String>>
fn clipboard_text(&mut self) -> GuiResult<Option<String>>
Reads text from the platform clipboard, when the backend can provide
it synchronously. Ok(None) means “unavailable” — callers fall back
to the Ui-level in-memory mirror.
Sourcefn paste_image_from_clipboard(&mut self) -> GuiResult<Option<ClipboardImage>>
fn paste_image_from_clipboard(&mut self) -> GuiResult<Option<ClipboardImage>>
Reads an image from the platform clipboard, returning RGBA pixels and PNG bytes.
Sourcefn set_accessible_name(
&mut self,
_widget_id: WidgetId,
_name: &str,
) -> GuiResult<()>
fn set_accessible_name( &mut self, _widget_id: WidgetId, _name: &str, ) -> GuiResult<()>
Applies an accessible name to a widget.
Default: returns GuiError::UnsupportedCapability; a backend
without a native accessibility bridge must not silently ignore the
request. GTK, Win32 and Cocoa apply the model in their own bridges.
Sourcefn set_accessible_description(
&mut self,
_widget_id: WidgetId,
_description: &str,
) -> GuiResult<()>
fn set_accessible_description( &mut self, _widget_id: WidgetId, _description: &str, ) -> GuiResult<()>
Applies an accessible description to a widget.
Default: returns GuiError::UnsupportedCapability (see
Backend::set_accessible_name).
Sourcefn post_accessible_notification(
&mut self,
widget_id: WidgetId,
notification: AccessibleNotification,
) -> GuiResult<()>
fn post_accessible_notification( &mut self, widget_id: WidgetId, notification: AccessibleNotification, ) -> GuiResult<()>
Posts a dynamic accessibility update for a widget.
The default is deliberately best-effort: some native controls announce programmatic updates themselves, and notification delivery is not a portable capability result. Backends may override this to post native assistive-technology notifications.
Sourcefn set_focus(&mut self, _widget_id: WidgetId) -> GuiResult<()>
fn set_focus(&mut self, _widget_id: WidgetId) -> GuiResult<()>
Moves keyboard focus to a widget.
Default: returns GuiError::UnsupportedCapability; a backend
without a native focus mapping must not silently ignore the request.
GTK/Win32/Cocoa application lands.
Sourcefn set_focusable(
&mut self,
_widget_id: WidgetId,
_focusable: bool,
) -> GuiResult<()>
fn set_focusable( &mut self, _widget_id: WidgetId, _focusable: bool, ) -> GuiResult<()>
Applies the focusable flag so native traversal can honor the override.
Default: returns GuiError::UnsupportedCapability (see
Backend::set_focus).
Sourcefn set_theme(&mut self, _theme: &Theme) -> GuiResult<()>
fn set_theme(&mut self, _theme: &Theme) -> GuiResult<()>
Applies a resolved theme so native controls can restyle.
Default: returns GuiError::UnsupportedCapability; a backend
without a native theming mapping must not silently ignore the request.
GTK/Win32/Cocoa application lands.
Sourcefn set_theme_override(
&mut self,
_widget_id: WidgetId,
_theme_override: ThemeOverride,
) -> GuiResult<()>
fn set_theme_override( &mut self, _widget_id: WidgetId, _theme_override: ThemeOverride, ) -> GuiResult<()>
Applies a per-widget theme override.
Default: returns GuiError::UnsupportedCapability (see
Backend::set_theme).
Sourcefn clear_theme_overrides(&mut self, _widget_id: WidgetId) -> GuiResult<()>
fn clear_theme_overrides(&mut self, _widget_id: WidgetId) -> GuiResult<()>
Clears the per-widget theme overrides.
Default: returns GuiError::UnsupportedCapability (see
Backend::set_theme).
Sourcefn theme_capabilities(&self) -> ThemeCapabilities
fn theme_capabilities(&self) -> ThemeCapabilities
Reports the backend’s system light/dark detection support.
Default: ThemeCapabilities::none — a capability query, so an
safe default instead of the typed error used by setters.
Sourcefn system_theme_mode(&self) -> Option<ThemeMode>
fn system_theme_mode(&self) -> Option<ThemeMode>
Returns the OS light/dark preference when the backend can detect it;
None means unknown or unsupported.
Change notifications arrive as UiEvent::ThemeChanged.
Sourcefn system_high_contrast(&self) -> bool
fn system_high_contrast(&self) -> bool
Returns whether the OS high-contrast accessibility mode is active.
Sourcefn art_capabilities(&self) -> ArtCapabilities
fn art_capabilities(&self) -> ArtCapabilities
Reports the lane’s native stock-art support.
The portable renderer (Ui::stock_icon) is library-owned art and is
available on every backend; this describes the optional OS-native
lookup served by Backend::native_stock_icon. Default: no native
art, so the capability query stays accurate without a typed error.
Sourcefn native_stock_icon(
&self,
role: IconRole,
size: IconSize,
) -> GuiResult<StockIcon>
fn native_stock_icon( &self, role: IconRole, size: IconSize, ) -> GuiResult<StockIcon>
Resolves an OS-native stock icon for a role and DPI variant.
Default: returns GuiError::UnsupportedCapability — a lane without
a native mapping must not fabricate art or return a placeholder.
Apps that want platform-independent art use Ui::stock_icon instead.
Sourcefn display_capabilities(&self) -> DisplayCapabilities
fn display_capabilities(&self) -> DisplayCapabilities
Reports the lane’s display-metric support.
Capability query: DisplayCapabilities::none is a safe default
(no detection) instead of the typed error used by setters.
Sourcefn gpu_surface_capabilities(&self) -> GpuSurfaceCapabilities
fn gpu_surface_capabilities(&self) -> GpuSurfaceCapabilities
Reports host GPU surface and degradation support.
The default advertises no GPU integration. A capability means the backend can provide its documented host contract, not that a third-party renderer or device driver is installed.
Sourcefn displays(&self) -> GuiResult<Vec<DisplayInfo>>
fn displays(&self) -> GuiResult<Vec<DisplayInfo>>
Enumerates connected displays.
Default: returns GuiError::UnsupportedCapability — a lane that
cannot enumerate must not fabricate monitor geometry. DPI/monitor
transitions arrive as UiEvent::DisplayChanged when
Backend::display_capabilities advertises dpi_change_events.
Sourcefn primary_display(&self) -> GuiResult<Option<DisplayInfo>>
fn primary_display(&self) -> GuiResult<Option<DisplayInfo>>
Returns the primary display; derived from Backend::displays.
Sourcefn widget_scale_factor(&self, _widget_id: WidgetId) -> f64
fn widget_scale_factor(&self, _widget_id: WidgetId) -> f64
Reports the display scale factor (relative to 96 DPI) of the display
hosting widget_id.
Ui uses the value to project incoming pointer input: a lane that
receives physical pixels from the OS (Win32 under Per-Monitor v2)
reports the window’s effective DPI divided by 96, and every
UiEvent::PointerDown, UiEvent::PointerMove, and
UiEvent::PointerUp the app observes has been divided by it, so a
physical (125, 250) on a 125 % display arrives as the logical
(100, 200) the layout engine lays the widget out against. Lanes that already
receive logical coordinates (GTK4 gestures, Cocoa points) report 1.0,
making the projection the identity.
Default: 1.0 — a neutral identity for a lane that does not report
scaling, so the projection is a no-op rather than a guess. A lane must
report 1.0 unless its pointer events really are in physical pixels.
Sourcefn wake_handle(&self) -> Option<Arc<dyn Fn() + Send + Sync>>
fn wake_handle(&self) -> Option<Arc<dyn Fn() + Send + Sync>>
Returns a thread-safe callback that wakes this backend’s event loop.
Ui::task_proxy embeds it into every UiProxy so a command posted
from a worker thread promptly interrupts a blocked wait_event; the
transport marker itself is an internal UiEvent::TasksPending that
Ui consumes while draining. Backends without a wake hook return
None (the default); queued commands then apply at the next organic
event.
Sourcefn show_file_dialog(
&mut self,
token: u64,
request: &FileDialog,
) -> GuiResult<()>
fn show_file_dialog( &mut self, token: u64, request: &FileDialog, ) -> GuiResult<()>
Shows a native file dialog described by request (dogfood report
#5). The answer must arrive later as
UiEvent::FileDialogResponse { token, paths } (empty paths when
cancelled). The default reports
UnsupportedCapability("file_dialog"), so existing backends keep
compiling; use the FileChooserDialog widget there.
Sourcefn native_window_handle(
&self,
window_id: WidgetId,
) -> GuiResult<NativeWindowHandle>
fn native_window_handle( &self, window_id: WidgetId, ) -> GuiResult<NativeWindowHandle>
Returns the platform handles of a realized top-level window (found while dogfooding).
The default reports UnsupportedCapability("native_window_handle"),
so existing backends keep compiling. Backends return an error rather
than a placeholder when the window is not realized yet.
Sourcefn set_close_guard(
&mut self,
_widget_id: WidgetId,
_guarded: bool,
) -> GuiResult<()>
fn set_close_guard( &mut self, _widget_id: WidgetId, _guarded: bool, ) -> GuiResult<()>
Enables or disables close-request interception for a window.
While guarded, an OS close request (the X button, Alt+F4, the system
menu) emits UiEvent::CloseRequested and the window stays open; the
app approves a close by lifting the guard and removing the window.
Default: GuiError::UnsupportedCapability — a lane without close
interception must not silently close.
Sourcefn window_capabilities(&self) -> WindowCapabilities
fn window_capabilities(&self) -> WindowCapabilities
Reports the window features this backend can apply exactly.
Native backends default to no extended-window support until their implementation has runtime evidence.
Sourcefn set_window_options(
&mut self,
widget_id: WidgetId,
options: &WindowOptions,
) -> GuiResult<()>
fn set_window_options( &mut self, widget_id: WidgetId, options: &WindowOptions, ) -> GuiResult<()>
Applies options to an existing top-level window.
The default permits the portable default options and refuses every extended behavior that a backend has not implemented.
Sourcefn dismiss_popup(&mut self, widget_id: WidgetId) -> GuiResult<()>
fn dismiss_popup(&mut self, widget_id: WidgetId) -> GuiResult<()>
Hides a popup without synthesizing a user-dismissal event.
Sourcefn timer_capabilities(&self) -> TimerCapabilities
fn timer_capabilities(&self) -> TimerCapabilities
Reports timer operations implemented by this backend.
Sourcefn motion_capabilities(&self) -> MotionCapabilities
fn motion_capabilities(&self) -> MotionCapabilities
Reports support for timer-driven motions.
Native backends without a motion implementation inherit an explicit
false capability; Ui::start_motion then refuses with ui_motion.
Sourcefn start_timer(&mut self, timer: TimerId, spec: TimerSpec) -> GuiResult<()>
fn start_timer(&mut self, timer: TimerId, spec: TimerSpec) -> GuiResult<()>
Starts a one-shot or repeating timer with a Ui-allocated id.
Sourcefn start_widget_timer(
&mut self,
timer: TimerId,
widget_id: WidgetId,
spec: TimerSpec,
stop_policy: TimerStopPolicy,
) -> GuiResult<()>
fn start_widget_timer( &mut self, timer: TimerId, widget_id: WidgetId, spec: TimerSpec, stop_policy: TimerStopPolicy, ) -> GuiResult<()>
Starts a timer whose lifecycle is tied to one widget.
Sourcefn cancel_timer(&mut self, timer: TimerId) -> GuiResult<()>
fn cancel_timer(&mut self, timer: TimerId) -> GuiResult<()>
Cancels a live timer id.
Enables or disables a menu item.
State-dependent commands (Undo, Redo, Clear) grey out instead of
looking actionable. Default: GuiError::UnsupportedCapability —
a lane without a mapping must not claim the item changed.
Relabels an existing menu item.
State-driven menus (recent-file lists, session lists, plugin menus)
relabel rows in place instead of rebuilding the whole bar. Default:
GuiError::UnsupportedCapability — a lane without a mapping must
not pretend the label changed.
Inserts a menu item at index inside an existing menu; an index past the end
appends.
Removes a menu item from its menu.
Detaches a submenu from its parent and drops it.
Sourcefn set_window_min_size(
&mut self,
_widget_id: WidgetId,
_w: u32,
_h: u32,
) -> GuiResult<()>
fn set_window_min_size( &mut self, _widget_id: WidgetId, _w: u32, _h: u32, ) -> GuiResult<()>
Sets the minimum dimensions for a top-level window.
Backends without window minimum size support report
GuiError::UnsupportedCapability.
Sourcefn set_resizable(
&mut self,
_widget_id: WidgetId,
_resizable: bool,
) -> GuiResult<()>
fn set_resizable( &mut self, _widget_id: WidgetId, _resizable: bool, ) -> GuiResult<()>
Sets whether a top-level window can be resized by the user.
Backends without resizable control report
GuiError::UnsupportedCapability.
Sourcefn set_placeholder_text(
&mut self,
_widget_id: WidgetId,
_text: &str,
) -> GuiResult<()>
fn set_placeholder_text( &mut self, _widget_id: WidgetId, _text: &str, ) -> GuiResult<()>
Sets placeholder/hint text on a text input widget.
Sourcefn set_rich_text_runs(
&mut self,
_widget_id: WidgetId,
_runs: &[TextRun],
) -> GuiResult<()>
fn set_rich_text_runs( &mut self, _widget_id: WidgetId, _runs: &[TextRun], ) -> GuiResult<()>
Sets styled text runs for a rich text widget.
Sourcefn set_rich_text_images(
&mut self,
_widget_id: WidgetId,
_images: &[RichTextImage],
) -> GuiResult<()>
fn set_rich_text_images( &mut self, _widget_id: WidgetId, _images: &[RichTextImage], ) -> GuiResult<()>
Sets inline images for a rich text widget.
Sourcefn set_spell_check(
&mut self,
_widget_id: WidgetId,
_enabled: bool,
) -> GuiResult<()>
fn set_spell_check( &mut self, _widget_id: WidgetId, _enabled: bool, ) -> GuiResult<()>
Turns the text control’s built-in spell checking on or off (MD-PERF follow-up). Only flags the native control already provides are flipped; lanes without one report the typed unsupported error.
Sourcefn set_monospace(
&mut self,
_widget_id: WidgetId,
_monospace: bool,
) -> GuiResult<()>
fn set_monospace( &mut self, _widget_id: WidgetId, _monospace: bool, ) -> GuiResult<()>
Sets monospace font rendering for text-bearing widgets.
Sourcefn set_font(
&mut self,
_widget_id: WidgetId,
_font: Option<&FontDescriptor>,
) -> GuiResult<()>
fn set_font( &mut self, _widget_id: WidgetId, _font: Option<&FontDescriptor>, ) -> GuiResult<()>
Sets an explicit widget font descriptor (None clears back to the active theme font).
Sourcefn set_row_icons(
&mut self,
_widget_id: WidgetId,
_icons: &[Option<IconRole>],
) -> GuiResult<()>
fn set_row_icons( &mut self, _widget_id: WidgetId, _icons: &[Option<IconRole>], ) -> GuiResult<()>
Sets per-row stock-art icons for list controls (DataList, ListView).
Sourcefn create_tray_icon(&mut self, _spec: &TrayIconSpec) -> GuiResult<TrayIconId>
fn create_tray_icon(&mut self, _spec: &TrayIconSpec) -> GuiResult<TrayIconId>
Creates a native system tray icon from a specification.
Backends without system tray support return GuiError::UnsupportedCapability.
Sourcefn destroy_tray_icon(&mut self, _id: TrayIconId) -> GuiResult<()>
fn destroy_tray_icon(&mut self, _id: TrayIconId) -> GuiResult<()>
Destroys a native system tray icon by id.
Sourcefn set_tray_icon_tooltip(
&mut self,
_id: TrayIconId,
_tooltip: &str,
) -> GuiResult<()>
fn set_tray_icon_tooltip( &mut self, _id: TrayIconId, _tooltip: &str, ) -> GuiResult<()>
Sets or updates the tooltip text for a system tray icon.
Attaches or detaches a context menu for a system tray icon.
Sourcefn set_tray_icon_visible(
&mut self,
_id: TrayIconId,
_visible: bool,
) -> GuiResult<()>
fn set_tray_icon_visible( &mut self, _id: TrayIconId, _visible: bool, ) -> GuiResult<()>
Shows or hides a system tray icon.
Sourcefn set_tray_icon_icon(
&mut self,
_id: TrayIconId,
_icon_bytes: Option<Vec<u8>>,
) -> GuiResult<()>
fn set_tray_icon_icon( &mut self, _id: TrayIconId, _icon_bytes: Option<Vec<u8>>, ) -> GuiResult<()>
Replaces the icon pixels of a system tray icon.
None restores the platform default image. The payload uses the same
portable encoding as TrayIconSpec::icon_bytes; a backend that can
create icons but cannot swap their pixels keeps this default and
returns GuiError::UnsupportedCapability instead of reporting
success for an icon it did not change.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".