pub struct Window { /* private fields */ }Implementations§
Source§impl Window
impl Window
pub fn new(width: i32, height: i32) -> Self
Sourcepub fn new_with_options(width: i32, height: i32, options: WindowOptions) -> Self
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.
Sourcepub fn from_id(id: u32) -> Self
pub fn from_id(id: u32) -> Self
Wrap an existing window by its ID (does not create a new OS window).
pub fn id(&self) -> u32
pub fn title(self, title: &str) -> Self
pub fn set_title(&self, title: &str)
pub fn load(self, path: &str) -> Self
pub fn size(self, width: i32, height: i32) -> Self
pub fn set_size(&self, width: i32, height: i32)
pub fn get_size(&self) -> (i32, i32)
pub fn position(self, x: i32, y: i32) -> Self
pub fn set_position(&self, x: i32, y: i32)
pub fn get_position(&self) -> (i32, i32)
pub fn resizable(self, resizable: bool) -> Self
pub fn set_resizable(&self, resizable: bool)
pub fn get_resizable(&self) -> bool
pub fn always_on_top(self, always_on_top: bool) -> Self
pub fn set_always_on_top(&self, always_on_top: bool)
pub fn get_always_on_top(&self) -> bool
pub fn get_visible(&self) -> bool
pub fn show(&self)
pub fn hide(&self)
pub fn focus(&self)
pub fn close(&self)
pub fn execute_js<F>(&self, script: &str, callback: Option<F>)
pub fn get_window_handle(&self) -> *mut c_void
pub fn get_display_handle(&self) -> *mut c_void
pub fn get_window_handle_type(&self) -> i32
pub fn on_keyboard_event<F>(self, handler: F) -> Self
pub fn on_mouse_click<F>(self, handler: F) -> Self
pub fn on_mouse_move<F>(self, handler: F) -> Self
pub fn on_wheel<F>(self, handler: F) -> Self
pub fn on_cursor_enter_leave<F>(self, handler: F) -> Self
pub fn on_focused<F>(self, handler: F) -> Self
pub fn on_resize<F>(self, handler: F) -> Self
pub fn on_move<F>(self, handler: F) -> Self
pub fn on_close_requested<F>(self, handler: F) -> Self
pub fn add_binding<F>(&self, name: &str, handler: F)
pub fn add_binding_async<F, Fut>(&self, name: &str, handler: F)
pub fn bind<F>(self, name: &str, handler: F) -> Self
pub fn bind_async<F, Fut>(self, name: &str, handler: F) -> Self
pub fn unbind(&self, name: &str)
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.
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.
Sourcepub fn open_devtools(&self)
pub fn open_devtools(&self)
Open the DevTools inspector for this window.
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnsafeUnpin for Window
impl UnwindSafe for Window
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more