pub struct NxWindow<'open> {
id: Id,
title: String,
open: Option<&'open mut bool>,
default_rect: Rect,
rect: Option<Rect>,
min_size: Vec2,
bounds: Option<Rect>,
resizable: bool,
}Expand description
A floating window with NeXTSTEP chrome. Build with NxWindow::new,
configure, then call NxWindow::show every frame.
Fields§
§id: Id§title: String§open: Option<&'open mut bool>§default_rect: Rect§rect: Option<Rect>§min_size: Vec2§bounds: Option<Rect>§resizable: boolImplementations§
Source§impl<'open> NxWindow<'open>
impl<'open> NxWindow<'open>
Sourcepub fn new(id_source: impl Hash, title: impl Into<String>) -> Self
pub fn new(id_source: impl Hash, title: impl Into<String>) -> Self
A window identified by id_source (salted, see Self::id), showing
title centred in its title bar. Resizable by default, not closable.
Sourcepub fn closable(self, open: &'open mut bool) -> Self
pub fn closable(self, open: &'open mut bool) -> Self
Show a close box; clicking it sets open to false. While open is
false the window is not shown.
Sourcepub fn default_rect(self, rect: Rect) -> Self
pub fn default_rect(self, rect: Rect) -> Self
Outer rect (border included) the first time the window is shown.
Sourcepub fn rect(self, rect: Rect) -> Self
pub fn rect(self, rect: Rect) -> Self
Outer rect for this frame, overriding the one stored from the last
frame; this frame’s drags apply on top of it. For callers that own the
rect: feed back stored_rect after Self::show.
Sourcepub fn min_size(self, min_size: Vec2) -> Self
pub fn min_size(self, min_size: Vec2) -> Self
Smallest outer size: resizes stop here, and a smaller incoming rect is enlarged (keeping its top-left). Defaults to 100 x 60.
Sourcepub fn bounds(self, bounds: Rect) -> Self
pub fn bounds(self, bounds: Rect) -> Self
Rect the window is kept inside, both when moved and when resized.
Defaults to [Context::screen_rect].
Auto Trait Implementations§
impl<'open> !UnwindSafe for NxWindow<'open>
impl<'open> Freeze for NxWindow<'open>
impl<'open> RefUnwindSafe for NxWindow<'open>
impl<'open> Send for NxWindow<'open>
impl<'open> Sync for NxWindow<'open>
impl<'open> Unpin for NxWindow<'open>
impl<'open> UnsafeUnpin for NxWindow<'open>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign, for types that do not implement AddAssign.