Merge "DALi Version 1.2.40" into devel/master
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / events / rectangle.i
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 %csmethodmodifiers Dali::Rect<int>::x "private";
18 %csmethodmodifiers Dali::Rect<int>::y "private";
19 %csmethodmodifiers Dali::Rect<int>::left "private";
20 %csmethodmodifiers Dali::Rect<int>::right "private";
21 %csmethodmodifiers Dali::Rect<int>::width "private";
22 %csmethodmodifiers Dali::Rect<int>::bottom "private";
23 %csmethodmodifiers Dali::Rect<int>::height "private";
24 %csmethodmodifiers Dali::Rect<int>::top "private";
25
26 %define DALI_RECTANGLE_PROPERTY_PARAM(NameSpace,ClassName)
27   %typemap(cscode) NameSpace::ClassName %{
28     public Rectangle(float x, float y, float width, float height) : this( (int)x, (int)y, (int)width, (int)height )
29     {
30     }
31
32     public static bool operator ==(Rectangle a, Rectangle b)
33     {
34         // If both are null, or both are same instance, return true.
35         if (System.Object.ReferenceEquals(a, b))
36         {
37             return true;
38         }
39
40         // If one is null, but not both, return false.
41         if (((object)a == null) || ((object)b == null))
42         {
43             return false;
44         }
45
46         // Return true if the fields match:
47         return a.X == b.X && a.Y == b.Y && a.Width == b.Width && a.Height == b.Height;
48     }
49
50     public static bool operator !=(Rectangle a, Rectangle b)
51     {
52         return !(a == b);
53     }
54
55     ///< X position of the rectangle, values after the decimal point are ignored, float type provided for convenience.
56     public float X
57     {
58         set
59         {
60             x = (int)( value );
61         }
62         get
63         {
64             return x;
65         }
66     }
67
68     ///< Y position of the rectangle, values after the decimal point are ignored, float type provided for convenience.
69     public float Y
70     {
71         set
72         {
73             y = (int)( value );
74         }
75         get
76         {
77             return y;
78         }
79     }
80
81     ///< Width of the rectangle, values after the decimal point are ignored, float type provided for convenience.
82     public float Width
83     {
84         set
85         {
86             width = (int)( value );
87         }
88         get
89         {
90             return width;
91         }
92     }
93
94     ///< Height of the rectangle, values after the decimal point are ignored, float type provided for convenience.
95     public float Height
96     {
97         set
98         {
99             height = (int)( value );
100         }
101         get
102         {
103             return height;
104         }
105     }
106 %}
107
108 %enddef
109
110 namespace Dali
111 {
112   DALI_RECTANGLE_PROPERTY_PARAM( Dali, Rect<int>);
113 }