-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui_layout.v
34 lines (31 loc) · 813 Bytes
/
ui_layout.v
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
module ui
fn (l &Layout) update_children_z_index(z_inc int) {
for mut child in l.get_children() {
if child is Layout {
l2 := child as Layout
l2.update_children_z_index(z_inc)
}
// println("child $child.id z_index +($z_inc)")
child.z_index += z_inc
}
}
pub fn (l &Layout) has_child_id(widget_id string) bool {
// println("has_child_id children: ${l.get_children().len} => ${l.get_children().map(it.id)}")
for child in l.get_children() {
// println("has_child: <$child.id> == <$widget_id>")
if child.id == widget_id {
return true
}
if child is Layout {
// println("$child.id is layout")
l2 := child as Layout
if l2.has_child_id(widget_id) {
return true
}
}
}
return false
}
pub fn (l &Layout) has_child(widget &Widget) bool {
return l.has_child_id(widget.id)
}