arc_util::ui::window

Struct Window

Source
pub struct Window<T> {
    pub name: String,
    pub inner: T,
    pub options: WindowOptions,
}
Expand description

Window component.

Fields§

§name: String

The name (title) of the window.

§inner: T

Inner Component responsible for rendering content.

§options: WindowOptions

Current window options state.

Implementations§

Source§

impl<T> Window<T>

Source

pub fn new<P>(name: impl Into<String>, inner: T, options: WindowOptions) -> Self
where T: Windowable<P>,

Creates a new window with WindowOptions and the passed Windowable component.

Source

pub fn with_default<P>(name: impl Into<String>, options: WindowOptions) -> Self
where T: Default + Windowable<P>,

Creates a new window with WindowOptions and a default Windowable component.

Source

pub fn key_press(&mut self, key: usize) -> bool

Handles a key press event.

Toggles visibility and returns true if the key matches the hotkey.

Trait Implementations§

Source§

impl<T: Clone> Clone for Window<T>

Source§

fn clone(&self) -> Window<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, P> Component<P> for Window<T>
where T: Windowable<P>,

Source§

fn render(&mut self, ui: &Ui<'_>, props: P)

Renders the component.
Source§

impl<T: Debug> Debug for Window<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for Window<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> DerefMut for Window<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> HasSettings for Window<T>
where T: HasSettings,

Source§

const SETTINGS_ID: &'static str = T::SETTINGS_ID

The component’s settings id.
Source§

type Settings = WindowSettings<T>

Source§

fn current_settings(&self) -> Self::Settings

Returns the component’s current settings state.
Source§

fn load_settings(&mut self, loaded: Self::Settings)

Loads the component’s settings from a loaded state.
Source§

fn reset_settings(&mut self)
where Self::Settings: Default,

Resets the component’s settings to the defaults.
Source§

impl<T> Hideable for Window<T>

Source§

fn is_visible(&self) -> bool

Returns whether the component is currently visible.
Source§

fn visible_mut(&mut self) -> &mut bool

Returns a mutable reference to the component’s visibility state.
Source§

fn hide(&mut self)

Hides the component.
Source§

fn show(&mut self)

Shows the component.
Source§

fn toggle_visibility(&mut self)

Toggles the component’s visibility.
Source§

fn set_visibility(&mut self, visible: bool)

Sets the component’s visibility state.

Auto Trait Implementations§

§

impl<T> Freeze for Window<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Window<T>
where T: RefUnwindSafe,

§

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

§

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

§

impl<T> Unpin for Window<T>
where T: Unpin,

§

impl<T> UnwindSafe for Window<T>
where T: UnwindSafe,

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.