[][src]Struct thyme::PersistentState

pub struct PersistentState {
    pub is_open: bool,
    pub expanded: bool,
    pub resize: Point,
    pub moved: Point,
    pub scroll: Point,
    pub base_time_millis: u32,
    pub characters: Vec<char>,
    pub text: Option<String>,
}

The internal state stored by Thyme for a given Widget that persists between frames.

Note that Thyme will generally be able to automatically generate unique IDs for many widgets such as buttons. But, if you want to access this data for a particular widget you will need to specify a known ID for that widget.

Example

fn reset_window_state(ui: &mut Frame, window_id: &str) {
    ui.modify(window_id, |state| {
        state.resize = Point::default();
        state.moved = Point::default();
        state.is_open = true;
    });
}

Fields

is_open: bool

Whether the widget will be shown. Defaults to true.

expanded: bool

Whether a tree or similar widget is expanded, showing all children, or not

resize: Point

An amount, in logical pixels that the widget has been resized by. Default to zero.

moved: Point

An amount, in logical pizels that the widget has been moved by. Defaults to zero.

scroll: Point

An amount, in logical pixels that the internal content has been scrolled by. Defaults to zero.

base_time_millis: u32

The "zero" time for timed images associated with this widget. Defaults to zero, which is the internal Context init time.

characters: Vec<char>

Any characters that have been sent to this widget from the keyboard. Defaults to empty. Widgets should typically drain this list as they work with input.

text: Option<String>

The text for this widget, overriding default text. Defaults to None.

Trait Implementations

impl Debug for PersistentState[src]

impl Default for PersistentState[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.