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
#![allow(unused_variables)]

use crate::prelude::*;
use crate::{Actor, Stage, Widget};
use std::{cell::RefCell, fmt};

#[derive(Clone, Debug)]
pub struct FloatingWidgetProps {
    pub stage: Option<Stage>,
    pub paint_matrix: Option<dx::Matrix>,
    pub pick_matrix: Option<dx::Matrix>,
    pub pick_handler: u64,
    pub paint_handler: u64,
}

#[derive(Clone, Debug)]
pub struct FloatingWidget {
    props: RefCell<FloatingWidgetProps>,
    widget: Widget,
}

impl FloatingWidget {}

impl Object for FloatingWidget {}
impl Is<FloatingWidget> for FloatingWidget {}

impl AsRef<FloatingWidget> for FloatingWidget {
    fn as_ref(&self) -> &FloatingWidget {
        self
    }
}

impl Is<Widget> for FloatingWidget {}

impl AsRef<Widget> for FloatingWidget {
    fn as_ref(&self) -> &Widget {
        &self.widget
    }
}

impl Is<Actor> for FloatingWidget {}

impl AsRef<Actor> for FloatingWidget {
    fn as_ref(&self) -> &Actor {
        let actor: &Actor = self.widget.as_ref();
        actor
    }
}

impl fmt::Display for FloatingWidget {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "FloatingWidget")
    }
}