layer_shika_domain/value_objects/
output_info.rs1use crate::value_objects::output_handle::OutputHandle;
2
3#[derive(Debug, Clone, PartialEq)]
5pub struct OutputInfo {
6 handle: OutputHandle,
7 name: Option<String>,
8 description: Option<String>,
9 geometry: Option<OutputGeometry>,
10 scale: Option<i32>,
11 is_primary: bool,
12}
13
14#[derive(Debug, Clone, PartialEq, Eq)]
16pub struct OutputGeometry {
17 pub x: i32,
18 pub y: i32,
19 pub physical_width: i32,
20 pub physical_height: i32,
21 pub make: Option<String>,
22 pub model: Option<String>,
23}
24
25impl OutputInfo {
26 pub fn new(handle: OutputHandle) -> Self {
27 Self {
28 handle,
29 name: None,
30 description: None,
31 geometry: None,
32 scale: None,
33 is_primary: false,
34 }
35 }
36
37 pub const fn handle(&self) -> OutputHandle {
38 self.handle
39 }
40
41 pub fn name(&self) -> Option<&str> {
42 self.name.as_deref()
43 }
44
45 pub fn description(&self) -> Option<&str> {
46 self.description.as_deref()
47 }
48
49 pub const fn geometry(&self) -> Option<&OutputGeometry> {
50 self.geometry.as_ref()
51 }
52
53 pub const fn scale(&self) -> Option<i32> {
54 self.scale
55 }
56
57 pub const fn is_primary(&self) -> bool {
58 self.is_primary
59 }
60
61 pub fn set_name(&mut self, name: String) {
62 self.name = Some(name);
63 }
64
65 pub fn set_description(&mut self, description: String) {
66 self.description = Some(description);
67 }
68
69 pub fn set_geometry(&mut self, geometry: OutputGeometry) {
70 self.geometry = Some(geometry);
71 }
72
73 pub fn set_scale(&mut self, scale: i32) {
74 self.scale = Some(scale);
75 }
76
77 pub fn set_primary(&mut self, is_primary: bool) {
78 self.is_primary = is_primary;
79 }
80}
81
82impl OutputGeometry {
83 pub const fn new(x: i32, y: i32, physical_width: i32, physical_height: i32) -> Self {
84 Self {
85 x,
86 y,
87 physical_width,
88 physical_height,
89 make: None,
90 model: None,
91 }
92 }
93
94 #[must_use]
95 pub fn with_make(mut self, make: String) -> Self {
96 self.make = Some(make);
97 self
98 }
99
100 #[must_use]
101 pub fn with_model(mut self, model: String) -> Self {
102 self.model = Some(model);
103 self
104 }
105}