pub struct PlatformWindow {
pub id: u64,
pub focused_accessibility_id: State<AccessibilityId>,
pub focused_accessibility_node: State<Node>,
pub root_size: State<Size2D>,
pub scale_factor: State<f64>,
pub custom_scale_factor: State<f64>,
pub navigation_mode: State<NavigationMode>,
pub preferred_theme: State<PreferredTheme>,
pub is_app_focused: State<bool>,
pub accent_color: State<AccentColor>,
pub sender: Rc<dyn Fn(UserEvent)>,
}Expand description
State and APIs for a given window.
§Example
use freya_core::prelude::*;
fn app() -> impl IntoElement {
let window = Platform::get().current_window();
let root_size = *window.root_size.read();
let preferred_theme = *window.preferred_theme.read();
format!(
"Window: {:.0} × {:.0}, preferred theme: {preferred_theme:?}",
root_size.width, root_size.height,
)
}Fields§
§id: u64§focused_accessibility_id: State<AccessibilityId>The AccessibilityId of the currently focused node in this window.
focused_accessibility_node: State<Node>Accessibility data for this window’s currently focused node.
root_size: State<Size2D>This window’s size in logical pixels.
scale_factor: State<f64>This window’s effective rendering scale factor.
custom_scale_factor: State<f64>The custom scale factor, changed through Self::set_custom_scale_factor.
The current NavigationMode in this window.
preferred_theme: State<PreferredTheme>The color theme preferred by the operating system for this window.
is_app_focused: State<bool>Whether this window has operating-system focus.
accent_color: State<AccentColor>The operating system’s accent color, when available.
sender: Rc<dyn Fn(UserEvent)>Dispatches UserEvents to this window’s renderer.
Implementations§
Source§impl PlatformWindow
impl PlatformWindow
pub fn send(&self, event: UserEvent)
Sourcepub fn request_redraw(&self)
pub fn request_redraw(&self)
Request a render of this window.
Sourcepub fn set_custom_scale_factor(&self, custom_scale_factor: f64)
pub fn set_custom_scale_factor(&self, custom_scale_factor: f64)
Request a custom rendering scale factor for this window.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PlatformWindow
impl !Send for PlatformWindow
impl !Sync for PlatformWindow
impl !UnwindSafe for PlatformWindow
impl Forget for PlatformWindow
impl Freeze for PlatformWindow
impl Unpin for PlatformWindow
impl UnsafeUnpin for PlatformWindow
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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