pub trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
Show 88 methods
// Required methods
fn bounds(&self) -> Bounds<Pixels>;
fn is_maximized(&self) -> bool;
fn window_bounds(&self) -> WindowBounds;
fn content_size(&self) -> Size<Pixels>;
fn resize(&mut self, size: Size<Pixels>);
fn scale_factor(&self) -> f32;
fn appearance(&self) -> WindowAppearance;
fn display(&self) -> Option<Rc<dyn PlatformDisplay>>;
fn mouse_position(&self) -> Point<Pixels>;
fn modifiers(&self) -> Modifiers;
fn capslock(&self) -> Capslock;
fn set_input_handler(&mut self, input_handler: PlatformInputHandler);
fn take_input_handler(&mut self) -> Option<PlatformInputHandler>;
fn prompt(
&self,
level: PromptLevel,
msg: &str,
detail: Option<&str>,
answers: &[PromptButton],
) -> Option<Receiver<usize>>;
fn activate(&self);
fn is_active(&self) -> bool;
fn is_hovered(&self) -> bool;
fn background_appearance(&self) -> WindowBackgroundAppearance;
fn set_title(&mut self, title: &str);
fn set_background_appearance(
&self,
background_appearance: WindowBackgroundAppearance,
);
fn minimize(&self);
fn zoom(&self);
fn toggle_fullscreen(&self);
fn is_fullscreen(&self) -> bool;
fn on_request_frame(&self, callback: Box<dyn FnMut(RequestFrameOptions)>);
fn on_input(
&self,
callback: Box<dyn FnMut(PlatformInput) -> DispatchEventResult>,
);
fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>);
fn on_hover_status_change(&self, callback: Box<dyn FnMut(bool)>);
fn on_resize(&self, callback: Box<dyn FnMut(Size<Pixels>, f32)>);
fn on_moved(&self, callback: Box<dyn FnMut()>);
fn on_should_close(&self, callback: Box<dyn FnMut() -> bool>);
fn on_hit_test_window_control(
&self,
callback: Box<dyn FnMut() -> Option<WindowControlArea>>,
);
fn on_close(&self, callback: Box<dyn FnOnce()>);
fn on_appearance_changed(&self, callback: Box<dyn FnMut()>);
fn draw(&self, scene: &Scene);
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ;
fn is_subpixel_rendering_supported(&self) -> bool;
fn gpu_specs(&self) -> Option<GpuSpecs>;
fn update_ime_position(&self, _bounds: Bounds<Pixels>);
// Provided methods
fn request_attention(&self) { ... }
fn on_button_layout_changed(&self, _callback: Box<dyn FnMut()>) { ... }
fn draw_layered(&self, scene: &Scene, _overlay_start: usize) { ... }
fn enable_scene_overlay(&self) -> Result<()> { ... }
fn create_native_surface(&self) -> Result<Rc<dyn PlatformNativeSurface>> { ... }
fn update_platform_views(&self, _update: &PlatformViewUpdate) { ... }
fn completed_frame(&self) { ... }
fn get_title(&self) -> String { ... }
fn tabbed_windows(&self) -> Option<Vec<SystemWindowTab>> { ... }
fn tab_bar_visible(&self) -> bool { ... }
fn set_edited(&mut self, _edited: bool) { ... }
fn set_document_path(&self, _path: Option<&Path>) { ... }
fn show_character_palette(&self) { ... }
fn titlebar_double_click(&self, _is_resizable: bool, _is_minimizable: bool) { ... }
fn on_move_tab_to_new_window(&self, _callback: Box<dyn FnMut()>) { ... }
fn on_merge_all_windows(&self, _callback: Box<dyn FnMut()>) { ... }
fn on_select_previous_tab(&self, _callback: Box<dyn FnMut()>) { ... }
fn on_select_next_tab(&self, _callback: Box<dyn FnMut()>) { ... }
fn on_toggle_tab_bar(&self, _callback: Box<dyn FnMut()>) { ... }
fn merge_all_windows(&self) { ... }
fn move_tab_to_new_window(&self) { ... }
fn toggle_window_tab_overview(&self) { ... }
fn set_tabbing_identifier(&self, _identifier: Option<String>) { ... }
fn inner_window_bounds(&self) -> WindowBounds { ... }
fn request_decorations(&self, _decorations: WindowDecorations) { ... }
fn show_window_menu(&self, _position: Point<Pixels>) { ... }
fn start_window_move(&self) { ... }
fn can_start_external_drag(&self) -> bool { ... }
fn start_external_drag(&self, _payload: &ExternalDragPayload) -> bool { ... }
fn start_window_resize(&self, _edge: ResizeEdge) { ... }
fn set_exclusive_zone(&self, _zone: Pixels) { ... }
fn set_exclusive_edge(&self, _edge: Anchor) { ... }
fn set_input_region(&self, _region: Option<&[Bounds<Pixels>]>) { ... }
fn window_decorations(&self) -> Decorations { ... }
fn set_app_id(&mut self, _app_id: &str) { ... }
fn map_window(&mut self) -> Result<()> { ... }
fn window_controls(&self) -> WindowControls { ... }
fn set_client_inset(&self, _inset: Pixels) { ... }
fn insets(&self) -> WindowInsets { ... }
fn on_insets_changed(&self, _callback: Box<dyn FnMut(WindowInsets)>) { ... }
fn set_back_handler(&self, _callback: Box<dyn FnMut()>) { ... }
fn set_back_enabled(&self, _enabled: bool) { ... }
fn show_soft_keyboard(&self) { ... }
fn hide_soft_keyboard(&self) { ... }
fn text_input_state_changed(&self, _change: TextInputStateChange) { ... }
fn play_system_bell(&self) { ... }
fn a11y_init(&self, _callbacks: A11yCallbacks) { ... }
fn a11y_tree_update(&self, _tree_update: TreeUpdate) { ... }
fn a11y_update_window_bounds(&self) { ... }
}Required Methods§
fn bounds(&self) -> Bounds<Pixels>
fn is_maximized(&self) -> bool
fn window_bounds(&self) -> WindowBounds
fn content_size(&self) -> Size<Pixels>
fn resize(&mut self, size: Size<Pixels>)
fn scale_factor(&self) -> f32
fn appearance(&self) -> WindowAppearance
fn display(&self) -> Option<Rc<dyn PlatformDisplay>>
fn mouse_position(&self) -> Point<Pixels>
fn modifiers(&self) -> Modifiers
fn capslock(&self) -> Capslock
fn set_input_handler(&mut self, input_handler: PlatformInputHandler)
fn take_input_handler(&mut self) -> Option<PlatformInputHandler>
fn prompt( &self, level: PromptLevel, msg: &str, detail: Option<&str>, answers: &[PromptButton], ) -> Option<Receiver<usize>>
fn activate(&self)
fn is_active(&self) -> bool
fn is_hovered(&self) -> bool
fn background_appearance(&self) -> WindowBackgroundAppearance
fn set_title(&mut self, title: &str)
fn set_background_appearance( &self, background_appearance: WindowBackgroundAppearance, )
fn minimize(&self)
fn zoom(&self)
fn toggle_fullscreen(&self)
fn is_fullscreen(&self) -> bool
fn on_request_frame(&self, callback: Box<dyn FnMut(RequestFrameOptions)>)
fn on_input( &self, callback: Box<dyn FnMut(PlatformInput) -> DispatchEventResult>, )
fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>)
fn on_hover_status_change(&self, callback: Box<dyn FnMut(bool)>)
fn on_resize(&self, callback: Box<dyn FnMut(Size<Pixels>, f32)>)
fn on_moved(&self, callback: Box<dyn FnMut()>)
fn on_should_close(&self, callback: Box<dyn FnMut() -> bool>)
fn on_hit_test_window_control( &self, callback: Box<dyn FnMut() -> Option<WindowControlArea>>, )
fn on_close(&self, callback: Box<dyn FnOnce()>)
fn on_appearance_changed(&self, callback: Box<dyn FnMut()>)
fn draw(&self, scene: &Scene)
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ
fn is_subpixel_rendering_supported(&self) -> bool
fn gpu_specs(&self) -> Option<GpuSpecs>
fn update_ime_position(&self, _bounds: Bounds<Pixels>)
Provided Methods§
Sourcefn request_attention(&self)
fn request_attention(&self)
Requests that the operating system draw attention to this window.
Sourcefn draw_layered(&self, scene: &Scene, _overlay_start: usize)
fn draw_layered(&self, scene: &Scene, _overlay_start: usize)
Draws a scene with primitives at and after overlay_start on a platform
overlay surface when one has been enabled.
Platforms without layered scene support fall back to drawing the complete scene on their primary surface.
Sourcefn enable_scene_overlay(&self) -> Result<()>
fn enable_scene_overlay(&self) -> Result<()>
Enables a transparent GPUI surface above native child views.
This is currently an experimental capability for embedding native surfaces between GPUI’s base and deferred-overlay paint planes.
Sourcefn create_native_surface(&self) -> Result<Rc<dyn PlatformNativeSurface>>
fn create_native_surface(&self) -> Result<Rc<dyn PlatformNativeSurface>>
Creates a native surface slot between GPUI’s base and overlay planes.
Sourcefn update_platform_views(&self, _update: &PlatformViewUpdate)
fn update_platform_views(&self, _update: &PlatformViewUpdate)
Attaches, repositions and detaches natively hosted views to match the frame GPUI just drew.
Called from the window’s draw, which runs on the platform’s UI thread, so implementations may touch native view hierarchies directly. Platforms without native view hosting ignore the update.
fn completed_frame(&self)
fn get_title(&self) -> String
fn tabbed_windows(&self) -> Option<Vec<SystemWindowTab>>
fn tab_bar_visible(&self) -> bool
fn set_edited(&mut self, _edited: bool)
fn set_document_path(&self, _path: Option<&Path>)
fn show_character_palette(&self)
fn titlebar_double_click(&self, _is_resizable: bool, _is_minimizable: bool)
fn on_move_tab_to_new_window(&self, _callback: Box<dyn FnMut()>)
fn on_merge_all_windows(&self, _callback: Box<dyn FnMut()>)
fn on_select_previous_tab(&self, _callback: Box<dyn FnMut()>)
fn on_select_next_tab(&self, _callback: Box<dyn FnMut()>)
fn on_toggle_tab_bar(&self, _callback: Box<dyn FnMut()>)
fn merge_all_windows(&self)
fn move_tab_to_new_window(&self)
fn toggle_window_tab_overview(&self)
fn set_tabbing_identifier(&self, _identifier: Option<String>)
fn inner_window_bounds(&self) -> WindowBounds
fn request_decorations(&self, _decorations: WindowDecorations)
fn start_window_move(&self)
fn can_start_external_drag(&self) -> bool
fn start_external_drag(&self, _payload: &ExternalDragPayload) -> bool
fn start_window_resize(&self, _edge: ResizeEdge)
fn set_exclusive_zone(&self, _zone: Pixels)
fn set_exclusive_edge(&self, _edge: Anchor)
fn set_input_region(&self, _region: Option<&[Bounds<Pixels>]>)
fn window_decorations(&self) -> Decorations
fn set_app_id(&mut self, _app_id: &str)
fn map_window(&mut self) -> Result<()>
fn window_controls(&self) -> WindowControls
fn set_client_inset(&self, _inset: Pixels)
Sourcefn insets(&self) -> WindowInsets
fn insets(&self) -> WindowInsets
The regions of this window currently obscured or reserved by the system. Zero on platforms without such regions.
Sourcefn on_insets_changed(&self, _callback: Box<dyn FnMut(WindowInsets)>)
fn on_insets_changed(&self, _callback: Box<dyn FnMut(WindowInsets)>)
Registers a callback invoked whenever Self::insets change.
Contract: fires continuously during animated transitions (Android
WindowInsetsAnimation progress; on iOS the platform interpolates
the keyboard animation curve on frame ticks) and is exact at rest.
Sourcefn set_back_handler(&self, _callback: Box<dyn FnMut()>)
fn set_back_handler(&self, _callback: Box<dyn FnMut()>)
Sets the handler for the system back action (Android back button/gesture; no source on iOS or desktop).
Sourcefn set_back_enabled(&self, _enabled: bool)
fn set_back_enabled(&self, _enabled: bool)
Declares whether the application would currently handle the system back action (e.g. navigation depth > 0).
Sourcefn show_soft_keyboard(&self)
fn show_soft_keyboard(&self)
Requests that the soft keyboard be shown.
Sourcefn hide_soft_keyboard(&self)
fn hide_soft_keyboard(&self)
Requests that the soft keyboard be hidden.
Sourcefn text_input_state_changed(&self, _change: TextInputStateChange)
fn text_input_state_changed(&self, _change: TextInputStateChange)
Inform the operating system that the text input state has changed
fn play_system_bell(&self)
Sourcefn a11y_init(&self, _callbacks: A11yCallbacks)
fn a11y_init(&self, _callbacks: A11yCallbacks)
Initialize the accessibility adapter with callbacks.
Sourcefn a11y_tree_update(&self, _tree_update: TreeUpdate)
fn a11y_tree_update(&self, _tree_update: TreeUpdate)
Provide a TreeUpdate to the accessibility adapter.
Sourcefn a11y_update_window_bounds(&self)
fn a11y_update_window_bounds(&self)
Inform the adapter of updated window bounds.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".