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<'_>
impl Windows<'_>
Sourcepub fn open(
&mut self,
key: impl Into<WindowKey>,
options: WindowOptions,
) -> OpenOutcome
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.
Sourcepub fn close(&mut self, key: impl Into<WindowKey>)
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.
Sourcepub fn request_close(&mut self, key: impl Into<WindowKey>)
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.
Sourcepub fn focus(&mut self, key: impl Into<WindowKey>)
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.
pub fn set_title(&mut self, key: impl Into<WindowKey>, title: impl Into<String>)
Sourcepub fn set_inner_size(
&mut self,
key: impl Into<WindowKey>,
width: f64,
height: f64,
)
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.
Sourcepub fn set_visible(&mut self, key: impl Into<WindowKey>, visible: bool)
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.
Sourcepub fn request_repaint(&mut self, key: impl Into<WindowKey>)
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.
Sourcepub fn request_repaint_all(&mut self)
pub fn request_repaint_all(&mut self)
request_repaint for every window.
pub fn status(&self, key: &WindowKey) -> Option<&WindowStatus>
Sourcepub fn info(&self, key: &WindowKey) -> Option<&WindowInfo>
pub fn info(&self, key: &WindowKey) -> Option<&WindowInfo>
State of an open window as of the start of this callback.
Sourcepub fn keys(&self) -> impl Iterator<Item = &WindowKey>
pub fn keys(&self) -> impl Iterator<Item = &WindowKey>
Keys of open and requested windows, in no particular order.
pub fn main_key(&self) -> &WindowKey
pub fn stats(&self) -> AppStats
Sourcepub fn resources(&self) -> &SharedResources
pub fn resources(&self) -> &SharedResources
The resources every window shares: glyph atlas, image cache, appearance.
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> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.