1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Grandstream-XMLApp |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2017 pudelek.org.pl |
6
|
|
|
* |
7
|
|
|
* @license MIT License (MIT) |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view source file |
10
|
|
|
* that is bundled with this package in the file LICENSE |
11
|
|
|
* |
12
|
|
|
* @author Marcin Pudełek <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
namespace mrcnpdlk\Grandstream\XMLApp\Application\Model\Display; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Helper\Color; |
20
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Helper\Point; |
21
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Helper\Rectangle; |
22
|
|
|
|
23
|
|
|
class DisplayAbstract |
24
|
|
|
{ |
25
|
|
|
const FONT_BOLD = 'bold'; |
26
|
|
|
const FONT_UNIFONT = 'unifont'; |
27
|
|
|
|
28
|
|
|
const HOR_ALIGN_CENTER = 'center'; |
29
|
|
|
const HOR_ALIGN_LEFT = 'left'; |
30
|
|
|
const HOR_ALIGN_RIGHT = 'right'; |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var \mrcnpdlk\Grandstream\XMLApp\Helper\Point |
35
|
|
|
*/ |
36
|
|
|
protected $oPoint; |
37
|
|
|
/** |
38
|
|
|
* @var \mrcnpdlk\Grandstream\XMLApp\Helper\Rectangle |
39
|
|
|
*/ |
40
|
|
|
protected $oRectangle; |
41
|
|
|
/** |
42
|
|
|
* @var Color |
43
|
|
|
*/ |
44
|
|
|
protected $oColorBg; |
45
|
|
|
/** |
46
|
|
|
* @var Color |
47
|
|
|
*/ |
48
|
|
|
protected $oColorBorder; |
49
|
|
|
/** |
50
|
|
|
* @var Color |
51
|
|
|
*/ |
52
|
|
|
protected $oColorFont; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* DisplayAbstract constructor. |
56
|
|
|
* |
57
|
|
|
* @param Point|null $oPoint |
58
|
|
|
* @param Rectangle|null $oRectangle |
59
|
|
|
*/ |
60
|
|
|
public function __construct(Point $oPoint = null, Rectangle $oRectangle = null) |
61
|
|
|
{ |
62
|
|
|
$this->oPoint = $oPoint ?? new Point(0, 0); |
63
|
|
|
$this->oRectangle = $oRectangle ?? new Rectangle(0, 0); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return Point |
68
|
|
|
*/ |
69
|
|
|
public function getPoint() |
70
|
|
|
{ |
71
|
|
|
return $this->oPoint; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return Rectangle |
76
|
|
|
*/ |
77
|
|
|
public function getRectangle() |
78
|
|
|
{ |
79
|
|
|
return $this->oRectangle; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param Color $oColor |
84
|
|
|
* |
85
|
|
|
* @return $this |
86
|
|
|
*/ |
87
|
|
|
public function setColorBg(Color $oColor) |
88
|
|
|
{ |
89
|
|
|
$this->oColorBg = $oColor; |
90
|
|
|
|
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return \mrcnpdlk\Grandstream\XMLApp\Helper\Color |
96
|
|
|
*/ |
97
|
|
|
public function getColorBg() |
98
|
|
|
{ |
99
|
|
|
return $this->oColorBg ?? new Color(); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param Color $oColor |
104
|
|
|
* |
105
|
|
|
* @return $this |
106
|
|
|
*/ |
107
|
|
|
public function setColorBorder(Color $oColor) |
108
|
|
|
{ |
109
|
|
|
$this->oColorBorder = $oColor; |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return \mrcnpdlk\Grandstream\XMLApp\Helper\Color |
116
|
|
|
*/ |
117
|
|
|
public function getColorBorder() |
118
|
|
|
{ |
119
|
|
|
return $this->oColorBorder ?? new Color(100); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @param Color $oColor |
124
|
|
|
* |
125
|
|
|
* @return $this |
126
|
|
|
*/ |
127
|
|
|
public function setColorFont(Color $oColor) |
128
|
|
|
{ |
129
|
|
|
$this->oColorFont = $oColor; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return Color |
136
|
|
|
*/ |
137
|
|
|
public function getColorFont() |
138
|
|
|
{ |
139
|
|
|
return $this->oColorFont ?? new Color(100); |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|