Skip to main content

Window

Struct Window 

Source
pub struct Window { /* private fields */ }

Implementations§

Source§

impl Window

Source

pub fn new(width: i32, height: i32) -> Self

Source

pub fn new_with_options(width: i32, height: i32, options: WindowOptions) -> Self

Create a window with creation-time style options. Falls back to a plain window (ignoring the options) on backends older than API version 25.

Source

pub fn from_id(id: u32) -> Self

Wrap an existing window by its ID (does not create a new OS window).

Source

pub fn id(&self) -> u32

Source

pub fn title(self, title: &str) -> Self

Source

pub fn set_title(&self, title: &str)

Source

pub fn load(self, path: &str) -> Self

Source

pub fn navigate(&self, url: &str)

Source

pub fn size(self, width: i32, height: i32) -> Self

Source

pub fn set_size(&self, width: i32, height: i32)

Source

pub fn get_size(&self) -> (i32, i32)

Source

pub fn position(self, x: i32, y: i32) -> Self

Source

pub fn set_position(&self, x: i32, y: i32)

Source

pub fn get_position(&self) -> (i32, i32)

Source

pub fn resizable(self, resizable: bool) -> Self

Source

pub fn set_resizable(&self, resizable: bool)

Source

pub fn get_resizable(&self) -> bool

Source

pub fn always_on_top(self, always_on_top: bool) -> Self

Source

pub fn set_always_on_top(&self, always_on_top: bool)

Source

pub fn get_always_on_top(&self) -> bool

Source

pub fn get_visible(&self) -> bool

Source

pub fn show(&self)

Source

pub fn hide(&self)

Source

pub fn focus(&self)

Source

pub fn close(&self)

Source

pub fn execute_js<F>(&self, script: &str, callback: Option<F>)
where F: FnOnce(Result<Value, Value>) + Send + 'static,

Source

pub fn get_window_handle(&self) -> *mut c_void

Source

pub fn get_display_handle(&self) -> *mut c_void

Source

pub fn get_window_handle_type(&self) -> i32

Source

pub fn on_keyboard_event<F>(self, handler: F) -> Self
where F: Fn(KeyboardEvent) + Send + Sync + 'static,

Source

pub fn on_mouse_click<F>(self, handler: F) -> Self
where F: Fn(MouseClickEvent) + Send + Sync + 'static,

Source

pub fn on_mouse_move<F>(self, handler: F) -> Self
where F: Fn(MouseMoveEvent) + Send + Sync + 'static,

Source

pub fn on_wheel<F>(self, handler: F) -> Self
where F: Fn(WheelEvent) + Send + Sync + 'static,

Source

pub fn on_cursor_enter_leave<F>(self, handler: F) -> Self
where F: Fn(CursorEnterLeaveEvent) + Send + Sync + 'static,

Source

pub fn on_focused<F>(self, handler: F) -> Self
where F: Fn(FocusedEvent) + Send + Sync + 'static,

Source

pub fn on_resize<F>(self, handler: F) -> Self
where F: Fn(ResizeEvent) + Send + Sync + 'static,

Source

pub fn on_move<F>(self, handler: F) -> Self
where F: Fn(MoveEvent) + Send + Sync + 'static,

Source

pub fn on_close_requested<F>(self, handler: F) -> Self
where F: Fn(CloseRequestedEvent) + Send + Sync + 'static,

Source

pub fn add_binding<F>(&self, name: &str, handler: F)
where F: Fn(JsCall) + Send + Sync + 'static,

Source

pub fn add_binding_async<F, Fut>(&self, name: &str, handler: F)
where F: Fn(JsCall) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + 'static,

Source

pub fn bind<F>(self, name: &str, handler: F) -> Self
where F: Fn(JsCall) + Send + Sync + 'static,

Source

pub fn bind_async<F, Fut>(self, name: &str, handler: F) -> Self
where F: Fn(JsCall) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + 'static,

Source

pub fn unbind(&self, name: &str)

Source

pub fn set_menu<F>(&self, template: &[MenuItem], on_click: F)
where F: Fn(&str) + Send + Sync + 'static,

Set the application menu for this window. On macOS, the menu is applied to the global menu bar and swapped when this window gains focus. On Windows/Linux, the menu is attached directly to this window. on_click is called with the id of the clicked menu item.

Source

pub fn show_context_menu<F>( &self, x: i32, y: i32, template: &[MenuItem], on_click: F, )
where F: Fn(&str) + Send + Sync + 'static,

Show a context menu at the given position (in window coordinates). Uses the same MenuItem template as set_menu. on_click is called with the id of the clicked menu item.

Source

pub fn open_devtools(&self)

Open the DevTools inspector for this window.

Source

pub fn alert(&self, title: &str, message: &str)

Show an alert dialog. Blocks until dismissed.

Source

pub fn confirm(&self, title: &str, message: &str) -> bool

Show a confirm dialog. Returns true if OK was pressed. Blocks until dismissed; while the modal is up the platform’s event loop is pumped so other LAUFEY windows continue to render and respond.

Source

pub fn prompt( &self, title: &str, message: &str, default_value: &str, ) -> Option<String>

Show a prompt dialog with a text input. Returns Some(text) if OK was pressed, None if cancelled. Blocking semantics as confirm.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.