1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use std::{
collections::BTreeMap,
};
use azul_css::{Css, CssDeclaration, CssProperty, CssPropertyType};
use crate::{
FastHashMap,
id_tree::{NodeId, NodeDataContainer},
dom::{DomId, DomString},
ui_state::{UiState, HoverGroup},
callbacks::HitTestItem,
style::HtmlCascadeInfo,
};
#[derive(Debug)]
pub struct UiDescription {
pub dom_id: DomId,
pub html_tree: NodeDataContainer<HtmlCascadeInfo>,
pub ui_descr_root: NodeId,
pub styled_nodes: NodeDataContainer<StyledNode>,
pub dynamic_css_overrides: BTreeMap<NodeId, FastHashMap<DomString, CssProperty>>,
pub selected_hover_nodes: BTreeMap<NodeId, HoverGroup>,
}
impl UiDescription {
pub fn new(
ui_state: &mut UiState,
style: &Css,
focused_node: &Option<(DomId, NodeId)>,
hovered_nodes: &BTreeMap<NodeId, HitTestItem>,
is_mouse_down: bool,
) -> Self {
let ui_description = crate::style::match_dom_selectors(
ui_state,
&style,
focused_node,
hovered_nodes,
is_mouse_down,
);
ui_state.create_tags_for_hover_nodes(&ui_description.selected_hover_nodes);
ui_description
}
}
#[derive(Debug, Default, Clone, PartialEq, Hash, PartialOrd, Eq, Ord)]
pub struct StyledNode {
pub css_constraints: BTreeMap<CssPropertyType, CssDeclaration>,
}