summaryrefslogtreecommitdiffstats
path: root/src/app/widgets/bottom_widgets/empty.rs
blob: 4c33523b1a2445ac558ecb4e1899ec7101cd55f6 (plain)
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
use tui::layout::Rect;

use crate::{
    app::{Component, Widget},
    options::layout_options::LayoutRule,
};

pub struct Empty {
    width: LayoutRule,
    height: LayoutRule,
}

impl Default for Empty {
    fn default() -> Self {
        Self {
            width: LayoutRule::default(),
            height: LayoutRule::default(),
        }
    }
}

impl Empty {
    /// Sets the width.
    pub fn width(mut self, width: LayoutRule) -> Self {
        self.width = width;
        self
    }

    /// Sets the height.
    pub fn height(mut self, height: LayoutRule) -> Self {
        self.height = height;
        self
    }
}

impl Component for Empty {
    fn bounds(&self) -> Rect {
        // TODO: Maybe think of how to store this without making it available for clicking. Separate bounds out to the layout? Might
        // need to keep the bounds calculations for some components, so maybe implement it specifically for them.
        Rect::default()
    }

    fn set_bounds(&mut self, _new_bounds: Rect) {}
}

impl Widget for Empty {
    fn get_pretty_name(&self) -> &'static str {
        ""
    }

    fn width(&self) -> LayoutRule {
        self.width
    }

    fn height(&self) -> LayoutRule {
        self.height
    }
}