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");