summaryrefslogtreecommitdiffstats
path: root/src/app/widgets/bottom_widgets/empty.rs
blob: e444ac2bbcdf0a671d714f707188515e4c5a88c2 (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
59
60
use tui::layout::Rect;

use crate::{
    app::{Component, SelectableType, 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 {
        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
    }

    fn selectable_type(&self) -> SelectableType {
        SelectableType::Unselectable
    }
}