Skip to main content

Windows

Struct Windows 

Source
pub struct Windows<'a> { /* private fields */ }
Expand description

Open, close, focus and inspect native windows by WindowKey.

Reached through Frame::windows and the other callbacks of App. Requests take effect after the callback returns, in order. Every request is addressed to a key, so none of them can reach the wrong window.

Implementations§

Source§

impl Windows<'_>

Source

pub fn open( &mut self, key: impl Into<WindowKey>, options: WindowOptions, ) -> OpenOutcome

Ask for a window. A key that is already open or already requested is left alone: no duplicate window, no new surface. A key whose last attempt failed is retried; the outcome of a failed creation arrives in App::window_failed and in status.

Source

pub fn close(&mut self, key: impl Into<WindowKey>)

Close one window and its children now, without asking the application. Closing the main window follows the ExitPolicy. A window that is not open is ignored, so closing twice is harmless. Its retained UI state is discarded.

Source

pub fn request_close(&mut self, key: impl Into<WindowKey>)

Behave as if the user asked to close the window: the application receives App::close_requested and may veto it.

Source

pub fn focus(&mut self, key: impl Into<WindowKey>)

Bring the window forward and give it keyboard focus, restoring it if minimized. Systems may refuse to steal focus from another application.

Source

pub fn set_title(&mut self, key: impl Into<WindowKey>, title: impl Into<String>)

Source

pub fn set_inner_size( &mut self, key: impl Into<WindowKey>, width: f64, height: f64, )

Request a new inner size in logical pixels; the system may adjust it.

Source

pub fn set_visible(&mut self, key: impl Into<WindowKey>, visible: bool)

Show or hide a window. A hidden window is not rendered and requests no frames.

Source

pub fn request_repaint(&mut self, key: impl Into<WindowKey>)

Draw key again soon. A window repaints on its own input and animations; call this when application data changed in another window and this one shows it. Hidden or minimized windows catch up when they are shown again.

Source

pub fn request_repaint_all(&mut self)

request_repaint for every window.

Source

pub fn exit(&mut self)

End the application, closing every window, without asking.

Source

pub fn is_open(&self, key: &WindowKey) -> bool

Whether key is open or has been requested.

Source

pub fn status(&self, key: &WindowKey) -> Option<&WindowStatus>

Source

pub fn info(&self, key: &WindowKey) -> Option<&WindowInfo>

State of an open window as of the start of this callback.

Source

pub fn keys(&self) -> impl Iterator<Item = &WindowKey>

Keys of open and requested windows, in no particular order.

Source

pub fn main_key(&self) -> &WindowKey

Source

pub fn stats(&self) -> AppStats

Source

pub fn resources(&self) -> &SharedResources

The resources every window shares: glyph atlas, image cache, appearance.

Source

pub fn set_theme(&mut self, theme: Theme)

Re-theme every window with one call; each applies it in its next frame.

Source

pub fn set_style(&mut self, style: Style)

Install a resolved style in every window; see set_theme.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Windows<'a>

§

impl<'a> !UnwindSafe for Windows<'a>

§

impl<'a> Freeze for Windows<'a>

§

impl<'a> Send for Windows<'a>

§

impl<'a> Sync for Windows<'a>

§

impl<'a> Unpin for Windows<'a>

§

impl<'a> UnsafeUnpin for Windows<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more