Struct thyme::PersistentState
source · 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>,
pub timer: u32,
}
Expand description
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
.
timer: u32
A timer in milliseconds, allowing the widget to easily store a particular relevant time - for delayed actions, for example
Trait Implementations§
source§impl Clone for PersistentState
impl Clone for PersistentState
source§fn clone(&self) -> PersistentState
fn clone(&self) -> PersistentState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more