[dali_1.2.40] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / events / padding.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<float>::x "private";
18 %csmethodmodifiers Dali::Rect<float>::y "private";
19 %csmethodmodifiers Dali::Rect<float>::left "private";
20 %csmethodmodifiers Dali::Rect<float>::right "private";
21 %csmethodmodifiers Dali::Rect<float>::width "private";
22 %csmethodmodifiers Dali::Rect<float>::bottom "private";
23 %csmethodmodifiers Dali::Rect<float>::height "private";
24 %csmethodmodifiers Dali::Rect<float>::top "private";
25 %ignore Dali::Rect<float>::IsEmpty;
26 %ignore Dali::Rect<float>::Left;
27 %ignore Dali::Rect<float>::Right;
28 %ignore Dali::Rect<float>::Top;
29 %ignore Dali::Rect<float>::Bottom;
30 %ignore Dali::Rect<float>::Area;
31 %ignore Dali::Rect<float>::Intersects;
32 %ignore Dali::Rect<float>::Contains;
33
34 %define DALI_PADDINGTYPE_PROPERTY_PARAM(NameSpace,ClassName)
35   %typemap(cscode) NameSpace::ClassName %{
36     public static bool operator ==(PaddingType a, PaddingType b)
37     {
38         // If both are null, or both are same instance, return true.
39         if (System.Object.ReferenceEquals(a, b))
40         {
41             return true;
42         }
43
44         // If one is null, but not both, return false.
45         if (((object)a == null) || ((object)b == null))
46         {
47             return false;
48         }
49
50         // Return true if the fields match:
51         return ( System.Math.Abs( a.Left - b.Left ) < NDalic.GetRangedEpsilon(a.Left, b.Left) )&&
52                ( System.Math.Abs( a.Right - b.Right ) < NDalic.GetRangedEpsilon(a.Right, b.Right) )&&
53                ( System.Math.Abs( a.Bottom - b.Bottom ) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom) )&&
54                ( System.Math.Abs( a.Top - b.Top ) < NDalic.GetRangedEpsilon(a.Top, b.Top) );
55     }
56
57     public static bool operator !=(PaddingType a, PaddingType b)
58     {
59         return !(a == b);
60     }
61
62     ///< The Left value
63     public float Left
64     {
65         set
66         {
67             left = value;
68         }
69         get
70         {
71             return left;
72         }
73     }
74
75     ///< The Right value
76     public float Right
77     {
78         set
79         {
80             right = value;
81         }
82         get
83         {
84             return right;
85         }
86     }
87
88     ///< The Bottom value
89     public float Bottom
90     {
91         set
92         {
93             bottom = value;
94         }
95         get
96         {
97             return bottom;
98         }
99     }
100
101     ///< The Top value
102     public float Top
103     {
104         set
105         {
106             top = value;
107         }
108         get
109         {
110             return top;
111         }
112     }
113
114 %}
115
116 %enddef
117
118 namespace Dali
119 {
120   DALI_PADDINGTYPE_PROPERTY_PARAM( Dali, Rect<float>);
121 }