Skip to main content

NativeViewBackend

Trait NativeViewBackend 

pub trait NativeViewBackend {
    // Required methods
    fn mount(&mut self, host: &NativeViewHost<'_>) -> Result<(), String>;
    fn unmount(&mut self);
    fn set_geometry(&mut self, geometry: NativeViewGeometry);
    fn set_visible(&mut self, visible: bool);
    fn set_focus(&mut self, focused: bool);
    fn set_enabled(&mut self, enabled: bool);

    // Provided methods
    fn host_changed(&mut self, _host: &NativeViewHost<'_>) { ... }
    fn set_platform_conventions(&mut self, _conventions: PlatformConventions) { ... }
    fn handle_event(
        &mut self,
        _event: &WindowEvent,
        _input: NativeViewInput,
    ) -> bool { ... }
    fn wants_pointer_capture(&self) -> bool { ... }
    fn needs_animation_frame(&self) -> bool { ... }
}
Expand description

App/platform implementation of one native child view.

mount is called once per successful attachment. host_changed follows scale-factor or host convention changes. unmount is guaranteed before the parent window is destroyed and is also called from NativeView::drop.

Required Methods§

fn mount(&mut self, host: &NativeViewHost<'_>) -> Result<(), String>

Attach the child to the supplied parent-window context.

§Errors

Returns a backend-specific explanation when the native child cannot be created or attached.

fn unmount(&mut self)

fn set_geometry(&mut self, geometry: NativeViewGeometry)

fn set_visible(&mut self, visible: bool)

fn set_focus(&mut self, focused: bool)

fn set_enabled(&mut self, enabled: bool)

Provided Methods§

fn host_changed(&mut self, _host: &NativeViewHost<'_>)

fn set_platform_conventions(&mut self, _conventions: PlatformConventions)

fn handle_event( &mut self, _event: &WindowEvent, _input: NativeViewInput, ) -> bool

Optional forwarding path for native APIs that do not own a child window/event queue. A real child window can keep the default false.

fn wants_pointer_capture(&self) -> bool

fn needs_animation_frame(&self) -> bool

Implementors§