gooey/interface/view/
border.rs1#[derive(Clone, Debug, Eq, PartialEq)]
2pub struct Border {
3 pub top : u32,
4 pub bottom : u32,
5 pub left : u32,
6 pub right : u32,
7 pub top_left : u32,
8 pub top_right : u32,
9 pub bottom_left : u32,
10 pub bottom_right : u32,
11 pub thickness_top : u16,
12 pub thickness_bottom : u16,
13 pub thickness_left : u16,
14 pub thickness_right : u16
15}
16
17impl Border {
18 #[inline]
19 pub fn total_width (&self) -> u16 {
20 self.thickness_left + self.thickness_right
21 }
22 #[inline]
23 pub fn total_height (&self) -> u16 {
24 self.thickness_top + self.thickness_bottom
25 }
26 #[inline]
27 pub fn total_wh (&self) -> (u16, u16) {
28 (self.total_width(), self.total_height())
29 }
30 pub const fn eascii_lines() -> Self {
31 Border {
32 top: 0xA6,
33 bottom: 0xA6,
34 left: 0xA9,
35 right: 0xA9,
36 top_left: 0xA3,
37 top_right: 0xA5,
38 bottom_left: 0xAA,
39 bottom_right: 0xAC,
40 thickness_top: 1,
41 thickness_bottom: 1,
42 thickness_left: 1,
43 thickness_right: 1
44 }
45 }
46}
47
48impl Default for Border {
49 fn default() -> Border {
50 Border {
51 top: b'-' as u32,
52 bottom: b'-' as u32,
53 left: b'|' as u32,
54 right: b'|' as u32,
55 top_left: b'+' as u32,
56 top_right: b'+' as u32,
57 bottom_left: b'+' as u32,
58 bottom_right: b'+' as u32,
59 thickness_top: 1,
60 thickness_bottom: 1,
61 thickness_left: 1,
62 thickness_right: 1
63 }
64 }
65}