Struct tuix::State[]

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: Treestyle: Styledata: CachedDatamouse: MouseStatemodifiers: ModifiersStatehovered: Entityactive: Entitycaptured: Entityfocused: Entityevent_handlers: HashMap<Entity, Box<dyn EventHandler + 'static, Global>, BuildHasherDefault<FnvHasher>>event_queue: VecDeque<Event, Global>fonts: Fontsneeds_restyle: boolneeds_relayout: boolneeds_redraw: boollisteners: 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));

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.