2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #if defined(SWIGCSHARP)
21 %typemap(cscode) Dali::Property::Value %{
23 // Extension to property value class that allows us to create a
24 // PropertyValue from a C# object, e.g. int, float, string
25 static public Property.Value CreateFromObject( System.Object obj)
27 System.Type type = obj.GetType ();
31 if ( type.Equals (typeof(int)) )
33 System.Console.WriteLine (" got an int property value ");
34 value = new Property.Value ((int) obj );
36 if ( type.Equals (typeof(System.Int32)) )
38 System.Console.WriteLine (" got an int property value ");
39 value = new Property.Value ((int) obj );
41 else if ( type.Equals (typeof(bool)) )
43 System.Console.WriteLine (" got an bool property value ");
44 value = new Property.Value ((bool) obj );
46 else if ( type.Equals (typeof(float)) )
48 System.Console.WriteLine (" got an float property value ");
49 value = new Property.Value ((float) obj );
51 else if ( type.Equals (typeof(string)) )
53 System.Console.WriteLine (" got a string property value ");
54 value = new Property.Value ((string) obj );
56 else if ( type.Equals (typeof(Vector2)) )
58 System.Console.WriteLine (" got an Vector2 property value ");
59 value = new Property.Value ((Vector2) obj );
61 else if ( type.Equals (typeof(Vector3)) )
63 System.Console.WriteLine (" got an Vector3 property value ");
64 value = new Property.Value ((Vector3) obj );
66 else if ( type.Equals (typeof(Vector4)) )
68 System.Console.WriteLine (" got an Vector4 property value ");
70 value = new Property.Value ((Vector4) obj );
72 else if ( type.Equals (typeof(Position)) )
74 System.Console.WriteLine (" got an Position property value ");
75 value = new Property.Value ((Position) obj );
77 else if ( type.Equals (typeof(Size)) )
79 System.Console.WriteLine (" got an Size property value ");
80 value = new Property.Value ((Size) obj );
82 else if ( type.Equals (typeof(Color)) )
84 System.Console.WriteLine (" got an Color property value ");
85 value = new Property.Value ((Color) obj );
89 throw new global::System.InvalidOperationException("Unimplemented type for Property Value");
95 public Value(Size2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Size2D.getCPtr(vectorValue)), true) {
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 public Value(Size vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Size.getCPtr(vectorValue)), true) {
100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 public Value(Position2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Position2D.getCPtr(vectorValue)), true) {
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 public Value(Position vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Position.getCPtr(vectorValue)), true) {
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 public Value(Color vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_6(Color.getCPtr(vectorValue)), true) {
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 public bool Get(Size2D vectorValue) {
117 bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Size2D.getCPtr(vectorValue));
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 public bool Get(Size vectorValue) {
123 bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Size.getCPtr(vectorValue));
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 public bool Get(Position2D vectorValue) {
129 bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Position2D.getCPtr(vectorValue));
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 public bool Get(Position vectorValue) {
135 bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Position.getCPtr(vectorValue));
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 public bool Get(Color vectorValue) {
141 bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_7(swigCPtr, Color.getCPtr(vectorValue));
142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();