Struct tuix_internal::state::State [−][src]
pub struct State {Show 16 fields
pub tree: Tree,
pub style: Style,
pub data: CachedData,
pub mouse: MouseState,
pub modifiers: ModifiersState,
pub hovered: Entity,
pub active: Entity,
pub captured: Entity,
pub focused: Entity,
pub event_handlers: HashMap<Entity, Box<dyn EventHandler + 'static, Global>, BuildHasherDefault<FnvHasher>>,
pub event_queue: VecDeque<Event, Global>,
pub fonts: Fonts,
pub needs_restyle: bool,
pub needs_relayout: bool,
pub needs_redraw: bool,
pub listeners: HashMap<Entity, Box<dyn Fn(&mut (dyn EventHandler + 'static), &mut State, Entity, &mut Event) + 'static, Global>, BuildHasherDefault<FnvHasher>>,
// some fields omitted
}
Fields
tree: Tree
style: Style
data: CachedData
mouse: MouseState
modifiers: ModifiersState
hovered: Entity
active: Entity
captured: Entity
focused: Entity
event_handlers: HashMap<Entity, Box<dyn EventHandler + 'static, Global>, BuildHasherDefault<FnvHasher>>
event_queue: VecDeque<Event, Global>
fonts: Fonts
needs_restyle: bool
needs_relayout: bool
needs_redraw: bool
listeners: HashMap<Entity, Box<dyn Fn(&mut (dyn EventHandler + 'static), &mut State, Entity, &mut Event) + 'static, Global>, BuildHasherDefault<FnvHasher>>
Implementations
Adds a stylesheet to the application
This function adds the stylesheet path to the application allowing for hot reloading of syles while the application is running.
Examples
state.add_stylesheet("path_to_stylesheet.css");
Adds a style rule to the application
This function adds a style rule to the application allowing for multiple entites to share the same style properties based on the rule selector.
Examples
Adds a style rule which sets the flex-grow properties of all ‘button’ elements to 1.0:
state.add_style_rule(StyleRule::new(Selector::element("button")).property(Property::FlexGrow(1.0)))
Insert a new event into the application event queue
Inserts a new event into the application event queue that will be processed on the next event loop. If the event unique flag is set to true, only the most recent event of the same type will exist in the queue.
Examples
state.insert_event(Event::new(WindowEvent::WindowClose));