pub struct PlatformWindow {
pub id: u64,
pub focused_accessibility_id: State<NodeId>,
pub focused_accessibility_node: State<Node>,
pub root_size: State<Size2D<f32, ()>>,
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<NodeId>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<f32, ()>>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§
Source§impl Clone for PlatformWindow
impl Clone for PlatformWindow
Source§fn clone(&self) -> PlatformWindow
fn clone(&self) -> PlatformWindow
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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 Move 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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