Context

Struct Context 

Source
pub struct Context {
    pub key_mods: KeyboardModifiers,
    pub window_title: String,
    pub fullscreen: bool,
    /* private fields */
}
Expand description

The Context stores all UI state. A user of the library shouldn’t have to interact with it directly.

Fields§

§key_mods: KeyboardModifiers

Keyboard modifiers state.

§window_title: String

The current title of the window

§fullscreen: bool

Are we fullscreen?

Implementations§

Source§

impl Context

Source

pub fn new() -> Self

Source

pub fn update( &mut self, view: &impl View, vger: &mut Vger, access_nodes: &mut Vec<(NodeId, Node)>, window_size: Size2D<f32, WorldSpace>, ) -> bool

Call this after the event queue is cleared.

Source

pub fn render( &mut self, render_info: RenderInfo<'_>, view: &impl View, vger: &mut Vger, window_size: Size2D<f32, WorldSpace>, scale: f32, )

Redraw the UI using wgpu.

Source

pub fn process(&mut self, view: &impl View, event: &Event)

Process a UI event.

Source

pub fn commands(&mut self, view: &impl View, cmds: &mut Vec<CommandInfo>)

Get menu commands.

Source

pub fn get<S>(&self, id: StateHandle<S>) -> &S
where S: 'static,

Source

pub fn get_mut<S>(&mut self, id: StateHandle<S>) -> &mut S
where S: 'static,

Trait Implementations§

Source§

impl Default for Context

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<S> Index<StateHandle<S>> for Context
where S: 'static,

Source§

type Output = S

The returned type after indexing.
Source§

fn index(&self, index: StateHandle<S>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<S> IndexMut<StateHandle<S>> for Context
where S: 'static,

Source§

fn index_mut(&mut self, index: StateHandle<S>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl Freeze for Context

§

impl !RefUnwindSafe for Context

§

impl !Send for Context

§

impl !Sync for Context

§

impl Unpin for Context

§

impl !UnwindSafe for Context

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

Source§

fn downcast(&self) -> &T

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

impl<T> Upcast<T> for T

Source§

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