Struct frui::druid_shell::WindowHandle
[−]pub struct WindowHandle(_);Expand description
A handle to a platform window object.
Implementations
impl WindowHandle
impl WindowHandle
pub fn show(&self)
pub fn show(&self)
Make this window visible.
This is part of the initialization process; it should only be called once, when a window is first created.
pub fn close(&self)
pub fn close(&self)
Close the window.
pub fn set_window_state(&mut self, state: WindowState)
pub fn set_window_state(&mut self, state: WindowState)
Sets the state of the window.
pub fn get_window_state(&self) -> WindowState
pub fn get_window_state(&self) -> WindowState
Gets the state of the window.
pub fn handle_titlebar(&self, val: bool)
pub fn handle_titlebar(&self, val: bool)
Informs the system that the current location of the mouse should be treated as part of the
window’s titlebar. This can be used to implement a custom titlebar widget. Note that
because this refers to the current location of the mouse, you should probably call this
function in response to every relevant WinHandler::mouse_move.
This is currently only implemented on Windows.
pub fn show_titlebar(&self, show_titlebar: bool)
pub fn show_titlebar(&self, show_titlebar: bool)
Set whether the window should show titlebar.
pub fn set_position(&self, position: impl Into<Point>)
pub fn set_position(&self, position: impl Into<Point>)
Sets the position of the window in pixels, relative to the origin of the virtual screen.
pub fn get_position(&self) -> Point
pub fn get_position(&self) -> Point
Returns the position of the window in pixels, relative to the origin of the virtual screen.
pub fn set_size(&self, size: impl Into<Size>)
pub fn set_size(&self, size: impl Into<Size>)
Set the window’s size in display points.
The actual window size in pixels will depend on the platform DPI settings.
This should be considered a request to the platform to set the size of the window. The
platform might choose a different size depending on its DPI or other platform-dependent
configuration. To know the actual size of the window you should handle the
WinHandler::size method.
pub fn set_level(&self, level: WindowLevel)
pub fn set_level(&self, level: WindowLevel)
Sets the WindowLevel, the z-order in the Window system / compositor
We do not currently have a getter method, mostly because the system’s levels aren’t a
perfect one-to-one map to druid_shell’s levels. A getter method may be added in the
future.
pub fn bring_to_front_and_focus(&self)
pub fn bring_to_front_and_focus(&self)
Bring this window to the front of the window stack and give it focus.
pub fn request_anim_frame(&self)
pub fn request_anim_frame(&self)
Request that prepare_paint and paint be called next time there’s the opportunity to
render another frame. This differs from invalidate and invalidate_rect in that it
doesn’t invalidate any part of the window.
pub fn invalidate(&self)
pub fn invalidate(&self)
Request invalidation of the entire window contents.
pub fn invalidate_rect(&self, rect: Rect)
pub fn invalidate_rect(&self, rect: Rect)
Request invalidation of a region of the window.
Set the top-level menu for this window.
pub fn request_timer(&self, deadline: Duration) -> TimerToken
pub fn request_timer(&self, deadline: Duration) -> TimerToken
Schedule a timer.
This causes a WinHandler::timer call at the deadline. The
return value is a token that can be used to associate the request
with the handler call.
Note that this is not a precise timer. On Windows, the typical resolution is around 10ms. Therefore, it’s best used for things like blinking a cursor or triggering tooltips, not for anything requiring precision.
pub fn set_cursor(&mut self, cursor: &Cursor)
pub fn set_cursor(&mut self, cursor: &Cursor)
Set the cursor icon.
pub fn make_cursor(&self, desc: &CursorDesc) -> Option<Cursor>
pub fn open_file(
&mut self,
options: FileDialogOptions
) -> Option<FileDialogToken>
pub fn open_file(
&mut self,
options: FileDialogOptions
) -> Option<FileDialogToken>
Prompt the user to choose a file to open.
This won’t block immediately; the file dialog will be shown whenever control returns to
druid-shell, and the WinHandler::open_file method will be called when the dialog is
closed.
pub fn save_as(&mut self, options: FileDialogOptions) -> Option<FileDialogToken>
pub fn save_as(&mut self, options: FileDialogOptions) -> Option<FileDialogToken>
Prompt the user to choose a path for saving.
This won’t block immediately; the file dialog will be shown whenever control returns to
druid-shell, and the WinHandler::save_as method will be called when the dialog is
closed.
Display a pop-up menu at the given position.
pos is in the coordinate space of the window.
pub fn get_idle_handle(&self) -> Option<IdleHandle>
pub fn get_idle_handle(&self) -> Option<IdleHandle>
Get a handle that can be used to schedule an idle task.
pub fn get_scale(&self) -> Result<Scale, Error>
pub fn get_scale(&self) -> Result<Scale, Error>
Get the DPI scale of the window.
The returned Scale is a copy and thus its information will be stale after
the platform DPI changes. This means you should not stash it and rely on it later; it is
only guaranteed to be valid for the current pass of the runloop.
Trait Implementations
impl Clone for WindowHandle
impl Clone for WindowHandle
fn clone(&self) -> WindowHandle
fn clone(&self) -> WindowHandle
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more