ADTF Display Toolbox
Loading...
Searching...
No Matches
rect.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <adtf_base.h>
12
13namespace adtf
14{
15
16namespace disptb
17{
18
19namespace graphicslib
20{
21
22namespace dengar
23{
29class cRect : public IRect
30{
31private:
33 cPoint m_oTopLeft;
34 cPoint m_oBottomRight;
36
37public:
38 tInt m_nLeft;
39 tInt m_nTop;
40 tInt m_nRight;
41 tInt m_nBottom;
42
43public:
48 {
49 m_nLeft = 0;
50 m_nTop = 0;
51 m_nRight = 0;
52 m_nBottom = 0;
53
54 m_oTopLeft.Set(m_nLeft, m_nTop);
55 m_oBottomRight.Set(m_nRight, m_nBottom);
56 }
57
63 cRect(const IRect* pRect)
64 {
65 Set(pRect->GetLeft(), pRect->GetTop(), pRect->GetRight(), pRect->GetBottom());
66 }
67
76 cRect(tInt l, tInt t, tInt r, tInt b)
77 {
78 m_nLeft = l;
79 m_nTop = t;
80 m_nRight = r;
81 m_nBottom = b;
82
83 m_oTopLeft.Set(m_nLeft, m_nTop);
84 m_oBottomRight.Set(m_nRight, m_nBottom);
85 }
86
91 tVoid Release()
92 {
93 delete this;
94 }
95
105 tVoid Set(tInt l, tInt t, tInt r, tInt b)
106 {
107 m_nLeft = l;
108 m_nTop = t;
109 m_nRight = r;
110 m_nBottom = b;
111
112 m_oTopLeft.Set(m_nLeft, m_nTop);
113 m_oBottomRight.Set(m_nRight, m_nBottom);
114 }
115
121 tInt GetWidth() const
122 {
123 return m_nRight - m_nLeft + 1;
124 }
125
131 tInt GetHeight() const
132 {
133 return m_nBottom - m_nTop + 1;
134 }
135
141 const cPoint* GetTopLeft() const
142 {
143 return &m_oTopLeft;
144 }
145
151 const cPoint* GetBottomRight() const
152 {
153 return &m_oBottomRight;
154 }
155
161 tInt GetLeft() const
162 {
163 return m_nLeft;
164 }
165
172 tVoid SetLeft(tInt nLeft)
173 {
174 m_nLeft = nLeft;
175 m_oTopLeft.SetX(m_nLeft);
176 }
177
183 tInt GetTop() const
184 {
185 return m_nTop;
186 }
187
194 tVoid SetTop(tInt nTop)
195 {
196 m_nTop = nTop;
197 m_oTopLeft.SetY(m_nTop);
198 }
199
205 tInt GetRight() const
206 {
207 return m_nRight;
208 }
209
216 tVoid SetRight(tInt nRight)
217 {
218 m_nRight = nRight;
219 m_oBottomRight.SetY(m_nRight);
220 }
221
227 tInt GetBottom() const
228 {
229 return m_nBottom;
230 }
231
238 tVoid SetBottom(tInt nBottom)
239 {
240 m_nBottom = nBottom;
241 m_oBottomRight.SetX(m_nBottom);
242 }
243
249 explicit operator IRect*()
250 {
251 return static_cast<IRect*>(this);
252 }
253};
254
255} // namespace dengar
256
257using dengar::cRect;
258} // namespace graphicslib
259
260} // namespace disptb
261
262} // namespace adtf
cRect()
default constructor
Definition rect.h:47
tVoid SetY(tInt yValue)
Sets the y value.
Definition point.h:141
tVoid SetX(tInt xValue)
Sets the x value.
Definition point.h:120
tVoid Set(tInt arg_x, tInt arg_y)
Sets the coordinates to the given values.
Definition point.h:85
tInt m_nRight
right border of the rect
Definition rect.h:40
cRect(tInt l, tInt t, tInt r, tInt b)
constructor with parameter
Definition rect.h:76
const cPoint * GetTopLeft() const
returns the top left point of the rectangle
Definition rect.h:141
tInt m_nTop
top border of the rect
Definition rect.h:39
tInt m_nLeft
left border of the rect
Definition rect.h:38
tInt GetWidth() const
returns the width of the rectangle
Definition rect.h:121
tInt m_nBottom
bottom border of the rect
Definition rect.h:41
const cPoint * GetBottomRight() const
returns the bottom right point of the rectangle
Definition rect.h:151
cRect(const IRect *pRect)
constructor from IRect
Definition rect.h:63
tInt GetHeight() const
returns the height of the rectangle
Definition rect.h:131
tVoid Set(tInt l, tInt t, tInt r, tInt b)
sets the rect
Definition rect.h:105
Namespace for functionality provided by the Display Toolbox.
Main namespace.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.