pub struct WindowState {
pub title: String,
pub size: WindowSize,
pub position: Option<PhysicalPosition<u32>>,
pub flags: WindowFlags,
pub debug_state: DebugState,
pub keyboard_state: KeyboardState,
pub mouse_state: MouseState,
pub ime_position: Option<LogicalPosition>,
pub platform_specific_options: PlatformSpecificOptions,
pub css: Css,
}
Expand description
State, size, etc of the window, for comparing to the last frame
Fields§
§title: String
Current title of the window
size: WindowSize
Size of the window + max width / max height: 800 x 600 by default
position: Option<PhysicalPosition<u32>>
The x and y position, or None to let the WM decide where to put the window (default)
flags: WindowFlags
Flags such as whether the window is minimized / maximized, fullscreen, etc.
debug_state: DebugState
Mostly used for debugging, shows WebRender-builtin graphs on the screen. Used for performance monitoring and displaying frame times (rendering-only).
keyboard_state: KeyboardState
Current keyboard state - NOTE: mutating this field (currently) does nothing (doesn’t get synchronized with OS-level window)!
mouse_state: MouseState
Current mouse state
ime_position: Option<LogicalPosition>
Sets location of IME candidate box in client area coordinates relative to the top left of the window.
platform_specific_options: PlatformSpecificOptions
Window options that can only be set on a certain platform
(WindowsWindowOptions
/ LinuxWindowOptions
/ MacWindowOptions
).
css: Css
The style of this window
Implementations§
Source§impl WindowState
impl WindowState
Sourcepub fn with_css(self, css: Css) -> Self
pub fn with_css(self, css: Css) -> Self
Same as WindowState::new
but to be used as a builder method
Sourcepub fn get_mouse_state(&self) -> &MouseState
pub fn get_mouse_state(&self) -> &MouseState
Returns the current keyboard keyboard state. We don’t want the library user to be able to modify this state, only to read it.
Sourcepub fn get_keyboard_state(&self) -> &KeyboardState
pub fn get_keyboard_state(&self) -> &KeyboardState
Returns the current windows mouse state. We don’t want the library user to be able to modify this state, only to read it.
Sourcepub fn get_physical_size(&self) -> (usize, usize)
pub fn get_physical_size(&self) -> (usize, usize)
Returns the physical (width, height) in pixel of this window
Sourcepub fn get_hidpi_factor(&self) -> f32
pub fn get_hidpi_factor(&self) -> f32
Returns the current HiDPI factor for this window.
Trait Implementations§
Source§impl Clone for WindowState
impl Clone for WindowState
Source§fn clone(&self) -> WindowState
fn clone(&self) -> WindowState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WindowState
impl Debug for WindowState
Source§impl Default for WindowState
impl Default for WindowState
Source§impl From<FullWindowState> for WindowState
impl From<FullWindowState> for WindowState
Source§fn from(full_window_state: FullWindowState) -> WindowState
fn from(full_window_state: FullWindowState) -> WindowState
Source§impl From<WindowState> for FullWindowState
impl From<WindowState> for FullWindowState
Source§fn from(window_state: WindowState) -> FullWindowState
fn from(window_state: WindowState) -> FullWindowState
Creates a FullWindowState from a regular WindowState, fills non-available fields with their default values