Adjust the position of the partial Frame
[platform/framework/native/uifw.git] / inc / FGrpFloatRectangle.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //      http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FGrpFloatRectangle.h
20  * @brief       This is the header file for the %FloatRectangle class.
21  *
22  * This header file contains the declarations of the %FloatRectangle class.
23  */
24
25 #ifndef _FGRP_FLOAT_RECTANGLE_H_
26 #define _FGRP_FLOAT_RECTANGLE_H_
27
28 #include <FBaseObject.h>
29
30 namespace Tizen { namespace Graphics
31 {
32 class FloatPoint;
33 class FloatDimension;
34
35 /**
36  * @class       FloatRectangle
37  * @brief       This class abstracts a rectangular region.
38  *
39  * @since 2.0
40  *
41  * The %FloatRectangle class represents a rectangular region in a coordinate space, which is specified by the rectangle
42  * object's top-left point (x, y) in the coordinate space, along with its width and height.
43  *
44  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/graphics/shapes.htm">Shapes</a>.
45  */
46 class _OSP_EXPORT_ FloatRectangle
47         : public Tizen::Base::Object
48 {
49 public:
50         /**
51          * This is the default constructor for this class. @n
52          * It initializes an instance of %FloatRectangle with all its attributes set to @c 0.f.
53          *
54          * @since 2.0
55          *
56          * @remarks             The attribute value is @c 0 when initialized.
57          */
58         FloatRectangle(void);
59
60         /**
61          * This is the copy constructor for the %FloatRectangle class.
62          *
63          * @since 2.0
64          *
65          * @param[in]     rhs                     An instance of %FloatRectangle
66          */
67         FloatRectangle(const FloatRectangle& rhs);
68
69         /**
70          * Initializes an instance of %FloatRectangle with the specified location and dimension.
71          *
72          * @since 2.0
73          *
74          * @param[in]   x               The x-coordinate of the top-left corner of the rectangle
75          * @param[in]   y               The y-coordinate of the top-left corner of the rectangle
76          * @param[in]   width   The width of the rectangle
77          * @param[in]   height  The height of the rectangle
78          *
79          */
80         FloatRectangle(float x, float y, float width, float height);
81
82         /**
83          * Initializes an instance of %FloatRectangle at the location specified by @c point and
84          * with dimension specified by @c dim.
85          *
86          * @since 2.0
87          *
88          * @param[in]   point           The location of the top-left corner of the rectangle
89          * @param[in]   dim                     The width and height of the rectangle
90          */
91         FloatRectangle(const FloatPoint& point, const FloatDimension& dim);
92
93         /**
94          * This is the destructor for this class.
95          *
96          * @since 2.0
97          */
98         virtual ~FloatRectangle(void);
99
100         /**
101          * This is the default assignment operator for this class.
102          *
103          * @since 2.0
104          *
105          * @param[in]     rhs                     An instance of %FloatRectangle
106          */
107         FloatRectangle& operator=(const FloatRectangle& rhs);
108
109         /**
110          * Checks whether the location and dimension of the current instance of %FloatRectangle match those of the
111          * specified instance of %FloatRectangle.
112          *
113          * @since 2.0
114          *
115          * @return              @c true if the location and dimension of the current instance match those of the specified instance, @n
116          *                              else @c false
117          * @param[in]   rhs             An instance of %FloatRectangle
118          */
119         bool operator==(const FloatRectangle& rhs) const;
120
121         /**
122          * Checks whether the location and dimension of the current instance of %FloatRectangle do not match those of the
123          * specified instance of %FloatRectangle.
124          *
125          * @since 2.0
126          *
127          * @return              @c true if the location and dimension of the current instance do not match those of the specified instance, @n
128          *                              else @c false
129          * @param[in]   rhs             An instance of %FloatRectangle
130          */
131         bool operator!=(const FloatRectangle& rhs) const;
132
133         /**
134          * Checks whether the specified point lies inside the current instance of %FloatRectangle.
135          *
136          * @since 2.0
137          *
138          * @return              @c true if the location represented by @c point lies inside the current instance of %FloatRectangle, @n
139          *                              else @c false
140          * @param[in]   point   An instance of FloatPoint
141          */
142         bool Contains(const FloatPoint& point) const;
143
144         /**
145          * Checks whether the value of the current instance of %FloatRectangle equals the value of the specified instance of
146          * %FloatRectangle.
147          *
148          * @since 2.0
149          *
150          * @return              @c true if the value of the current instance of %FloatRectangle equals the value of the specified instance of %FloatRectangle, @n
151          *                              else @c false
152          * @param[in]   rhs             An instance of %FloatRectangle
153          * @remarks             The %FloatRectangle class has a semantic value, which means that the Equals() method checks whether the
154          *                              two instances have the same location and size.
155          */
156         virtual bool Equals(const Tizen::Base::Object& rhs) const;
157
158         /**
159          * Gets the hash value of the current instance.
160          *
161          * @since 2.0
162          *
163          * @return              The hash value of the current instance
164          * @remarks             Two equal instances must return the same hash value. For better performance,
165          *                              the used hash function must generate a random distribution for all inputs.
166          */
167         virtual int GetHashCode(void) const;
168
169         /**
170          * Gets the intersection of the current instance and the specified instance of %FloatRectangle. @n
171          * If the two instances of %FloatRectangle do not intersect, empty instance is returned.
172          *
173          * @since 2.0
174          *
175          * @param[in]   rect    An instance of %FloatRectangle
176          */
177         FloatRectangle GetIntersection(const FloatRectangle& rect) const;
178
179         /**
180          * Checks whether the current instance of %FloatRectangle intersects with the specified instance of %FloatRectangle.
181          *
182          * @since 2.0
183          *
184          * @return              @c true if the current instance of %FloatRectangle intersects with the specified instance of %FloatRectangle, @n
185          *                              else @c false
186          * @param[in]   rect    An instance of %FloatRectangle
187          *
188          */
189         bool IsIntersected(const FloatRectangle& rect) const;
190
191         /**
192          * Gets the union of the current instance and the specified instance of %FloatRectangle.
193          *
194          * @since 2.0
195          *
196          * @return              An instance of %FloatRectangle containing the union of the two rectangles
197          * @param[in]   rect    An instance of %FloatRectangle
198          */
199         FloatRectangle GetUnion(const FloatRectangle& rect) const;
200
201         /**
202          * Gets the coordinates of the point at the bottom-right corner of the rectangle.
203          *
204          * @since 2.0
205          *
206          * @return              The coordinates of the point at the bottom-right corner of the rectangle
207          */
208         FloatPoint GetBottomRight(void) const;
209
210         /**
211          * Gets the coordinates of the point at the top-left corner of the rectangle.
212          *
213          * @since 2.0
214          *
215          * @return              The coordinates of the point at the top-left corner of the rectangle
216          */
217         FloatPoint GetTopLeft(void) const;
218
219         /**
220          * Checks whether this %FloatRectangle is empty. @n
221          * A %FloatRectangle is empty if its width or its height is less than or equal to @c 0.
222          *
223          * @since 2.0
224          *
225          * @return              @c true if this rectangle is empty,     @n
226          *                              else @c false
227          */
228         bool IsEmpty(void) const;
229
230         /**
231          * Sets the size of this %FloatRectangle to match the specified FloatDimension.
232          *
233          * @since 2.0
234          *
235          * @param[in]   dim             The new size for FloatDimension
236          */
237         void SetSize(const FloatDimension& dim);
238
239         /**
240          * Sets the size of this %FloatRectangle to match the specified dimension.
241          *
242          * @since 2.0
243          *
244          * @param[in]   width   The new width
245          * @param[in]   height  The new height
246          */
247         void SetSize(float width, float height);
248
249         /**
250          * Sets the position of this %FloatRectangle to the specified point.
251          *
252          * @since 2.0
253          *
254          * @param[in]   point   The new position
255          */
256         void SetPosition(const FloatPoint& point);
257
258         /**
259          * Sets the location of the current instance of %FloatRectangle with the specified values of the
260          * x and y coordinates of the top-left corner point.
261          *
262          * @since 2.0
263          *
264          * @param[in]   x               The new x-coordinate
265          * @param[in]   y               The new y-coordinate
266          */
267         void SetPosition(float x, float y);
268
269         /**
270          * Sets the location and the dimensions of the current instance of %FloatRectangle with the specified x and y
271          * coordinates of the top-left corner point and the specified dimensions.
272          *
273          * @since 2.0
274          *
275          * @param[in]   x               The new x-coordinate
276          * @param[in]   y               The new y-coordinate
277          * @param[in]   width   The new width
278          * @param[in]   height  The new height
279          */
280         void SetBounds(float x, float y, float width, float height);
281
282         /**
283          * Sets the location and the dimensions of the current instance of %FloatRectangle with the specified location and
284          * dimension.
285          *
286          * @since 2.0
287          *
288          * @param[in]   point   An instance of FloatPoint
289          * @param[in]   dim             An instance of FloatDimension
290          */
291         void SetBounds(const FloatPoint& point, const FloatDimension& dim);
292
293         /**
294          * Translates this %FloatRectangle to the new point by the specified distance along the x-axis and y-axis.
295          *
296          * @since 2.0
297          *
298          * @param[in]   deltaX  The distance to move this %FloatRectangle along the x-axis
299          * @param[in]   deltaY  The distance to move this %FloatRectangle along the y-axis
300          */
301         void Translate(float deltaX, float deltaY);
302
303 public:
304         /**
305          * The x-coordinate of the top-left corner of the rectangle.
306          *
307          * @since 2.0
308          */
309         float x;
310
311         /**
312          * The y-coordinate of the top-left corner of the rectangle.
313          *
314          * @since 2.0
315          */
316         float y;
317
318         /**
319          * The width of this rectangle.
320          *
321          * @since 2.0
322          */
323         float width;
324
325         /**
326          * The height of this rectangle.
327          *
328          * @since 2.0
329          */
330         float height;
331
332 private:
333         friend class _FloatRectangleImpl;
334
335         //
336         // This variable is for internal use only.
337         // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
338         //
339         // @since 2.0
340         //
341         class _FloatRectangleImpl* __pImpl;
342
343 }; // FloatRectangle
344
345 }} // Tizen::Graphics
346
347 #endif // _FGRP_FLOAT_RECTANGLE_H_
348