Skip to main content

NxWindow

Struct NxWindow 

Source
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: bool

Implementations§

Source§

impl<'open> NxWindow<'open>

Source

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.

Source

pub fn id(&self) -> Id

The window’s [Id]: its egui area id, and the id is_key takes.

Source

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.

Source

pub fn default_rect(self, rect: Rect) -> Self

Outer rect (border included) the first time the window is shown.

Source

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.

Source

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.

Source

pub fn bounds(self, bounds: Rect) -> Self

Rect the window is kept inside, both when moved and when resized. Defaults to [Context::screen_rect].

Source

pub fn resizable(self, resizable: bool) -> Self

Whether the bottom resize bar is shown and resizes the window.

Source

pub fn show<R>( self, ctx: &Context, add_contents: impl FnOnce(&mut Ui) -> R, ) -> Option<InnerResponse<R>>

Show the window, laying add_contents out in the body. Returns None when the window is closed.

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> 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
§

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

§

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

§

impl<T> Downcast for T
where T: 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.
§

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.
§

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.
§

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.
§

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

§

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

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.

§

impl<T> Instrument for T

§

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

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

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

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<'a, S, T> Semigroup<&'a S> for T
where T: Semigroup<S>,

§

fn plus_equals(&mut self, rhs: &&'a S)

The method of std::ops::AddAssign, for types that do not implement AddAssign.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

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

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