Skip to main content

fui/controls/
anti_selection_area.rs

1use super::*;
2
3#[derive(Clone)]
4pub struct AntiSelectionArea {
5    root: FlexBox,
6}
7
8impl AntiSelectionArea {
9    pub fn new() -> Self {
10        let root = flex_box();
11        root.selection_area_barrier(true);
12        Self { root }
13    }
14}
15
16impl Default for AntiSelectionArea {
17    fn default() -> Self {
18        Self::new()
19    }
20}
21
22impl Node for AntiSelectionArea {
23    fn retained_node_ref(&self) -> NodeRef {
24        self.root.retained_node_ref()
25    }
26
27    fn build_self(&self) {
28        self.root.build_self();
29    }
30}
31
32impl HasFlexBoxRoot for AntiSelectionArea {
33    fn flex_box_root(&self) -> &FlexBox {
34        &self.root
35    }
36}
37
38impl ThemeBindable for AntiSelectionArea {
39    fn theme_binding_node(&self) -> NodeRef {
40        self.root.retained_node_ref()
41    }
42
43    fn weak_theme_target(&self) -> Box<dyn Fn() -> Option<Self>> {
44        let weak_root = self.root.downgrade();
45        Box::new(move || {
46            Some(AntiSelectionArea {
47                root: weak_root.upgrade()?,
48            })
49        })
50    }
51}