pub struct FullWindowState {Show 20 fields
pub theme: WindowTheme,
pub title: AzString,
pub size: WindowSize,
pub position: WindowPosition,
pub flags: WindowFlags,
pub debug_state: DebugState,
pub keyboard_state: KeyboardState,
pub mouse_state: MouseState,
pub touch_state: TouchState,
pub ime_position: ImePosition,
pub platform_specific_options: PlatformSpecificOptions,
pub renderer_options: RendererOptions,
pub background_color: ColorU,
pub layout_callback: LayoutCallback,
pub close_callback: OptionCallback,
pub monitor: Monitor,
pub hovered_file: Option<AzString>,
pub dropped_file: Option<AzString>,
pub focused_node: Option<DomNodeId>,
pub last_hit_test: FullHitTest,
}Fields§
§theme: WindowThemeTheme of this window (dark or light) - can be set / overridden by the user
Usually the operating system will set this field. On change, it will
emit a WindowEventFilter::ThemeChanged event
title: AzStringCurrent title of the window
size: WindowSizeSize of the window + max width / max height: 800 x 600 by default
position: WindowPositionThe x and y position, or None to let the WM decide where to put the window (default)
flags: WindowFlagsFlags such as whether the window is minimized / maximized, fullscreen, etc.
debug_state: DebugStateMostly used for debugging, shows WebRender-builtin graphs on the screen. Used for performance monitoring and displaying frame times (rendering-only).
keyboard_state: KeyboardStateCurrent keyboard state - NOTE: mutating this field (currently) does nothing (doesn’t get synchronized with OS-level window)!
mouse_state: MouseStateCurrent mouse state
touch_state: TouchStateStores all states of currently connected touch input devices, pencils, tablets, etc.
ime_position: ImePositionSets location of IME candidate box in client area coordinates relative to the top left of the window.
platform_specific_options: PlatformSpecificOptionsWindow options that can only be set on a certain platform
(WindowsWindowOptions / LinuxWindowOptions / MacWindowOptions).
renderer_options: RendererOptionsInformation about vsync and hardware acceleration
background_color: ColorUBackground color of the window
layout_callback: LayoutCallbackThe layout() function for this window, stored as a callback function pointer,
There are multiple reasons for doing this (instead of requiring T: Layout everywhere):
- It seperates the
Domfrom theLayouttrait, making it possible to split the UI solving and styling into reusable crates - It’s less typing work (prevents having to type
<T: Layout>everywhere) - It’s potentially more efficient to compile (less type-checking required)
- It’s a preparation for the C ABI, in which traits don’t exist (for language bindings). In the C ABI “traits” are simply structs with function pointers (and void* instead of T)
close_callback: OptionCallbackCallback to run before the window closes. If this callback returns DoNothing,
the window won’t close, otherwise it’ll close regardless
monitor: MonitorCurrent monitor
hovered_file: Option<AzString>Whether there is a file currently hovering over the window
dropped_file: Option<AzString>Whether there was a file currently dropped on the window
focused_node: Option<DomNodeId>What node is currently hovered over, default to None. Only necessary internal
to the crate, for emitting On::FocusReceived and On::FocusLost events,
as well as styling :focus elements
last_hit_test: FullHitTestLast hit-test that was performed: necessary because the events are stored in a queue and only storing the hovered nodes is not sufficient to correctly determine events
Implementations§
Source§impl FullWindowState
impl FullWindowState
pub fn get_mouse_state(&self) -> &MouseState
pub fn get_keyboard_state(&self) -> &KeyboardState
pub fn get_hovered_file(&self) -> Option<&AzString>
pub fn get_dropped_file(&self) -> Option<&AzString>
pub fn get_scroll_amount(&self) -> Option<(f32, f32)>
pub fn layout_callback_changed(&self, other: &Option<Self>) -> bool
Sourcepub fn from_window_state(
window_state: &WindowState,
dropped_file: Option<AzString>,
hovered_file: Option<AzString>,
focused_node: Option<DomNodeId>,
last_hit_test: FullHitTest,
) -> Self
pub fn from_window_state( window_state: &WindowState, dropped_file: Option<AzString>, hovered_file: Option<AzString>, focused_node: Option<DomNodeId>, last_hit_test: FullHitTest, ) -> Self
Creates a FullWindowState from a regular WindowState, fills non-available fields with the given values
You need to pass the extra fields explicitly in order to prevent state management bugs
pub fn process_system_scroll( &mut self, scroll_states: &ScrollStates, ) -> Option<ScrollResult>
Trait Implementations§
Source§impl Clone for FullWindowState
impl Clone for FullWindowState
Source§fn clone(&self) -> FullWindowState
fn clone(&self) -> FullWindowState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FullWindowState
impl Debug for FullWindowState
Source§impl Default for FullWindowState
impl Default for FullWindowState
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 PartialEq for FullWindowState
impl PartialEq for FullWindowState
impl StructuralPartialEq for FullWindowState
Auto Trait Implementations§
impl Freeze for FullWindowState
impl RefUnwindSafe for FullWindowState
impl Send for FullWindowState
impl Sync for FullWindowState
impl Unpin for FullWindowState
impl UnwindSafe for FullWindowState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more