DALi C# binding - Change methods into Properties 23/90723/5
authorRavi Nanjundappa <nravi.n@samsung.com>
Thu, 6 Oct 2016 06:39:43 +0000 (12:09 +0530)
committerRavi Nanjundappa <nravi@review.tizen.org>
Fri, 7 Oct 2016 05:17:01 +0000 (22:17 -0700)
Inserted the property related code changes through swig .i files.
Modified the examples accordingly.

Change-Id: I659c3e8e3bef5a455b60405459b2744d77cc4fa4
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
plugins/dali-swig/SWIG/events/actor-event.i
plugins/dali-swig/SWIG/events/animation-event.i
plugins/dali-swig/SWIG/events/stage-event.i
plugins/dali-swig/examples/dali-test.cs
plugins/dali-swig/examples/hello-world.cs
plugins/dali-swig/examples/scroll-view.cs

index e325613..634a753 100644 (file)
     {
        return (IntPtr)swigCPtr;
     }
-    %}
 
-    %enddef
+    public Actor Parent
+    {
+      get
+      {
+        Actor parent = GetParent();
+        return parent;
+      }
+    }
+
+   public bool Vibility
+   {
+      get
+      {
+        bool visibility = IsVisible();
+        return visibility;
+      }
+    }
+
+   public float Opacity
+   {
+      set
+      {
+        SetOpacity(value);
+      }
+    }
+
+   public float CurrentOpacity
+   {
+      get
+      {
+        float ret = GetCurrentOpacity();
+        return ret;
+      }
+    }
+
+    public bool StateFocusEnable
+    {
+      set
+      {
+        SetKeyboardFocusable(value);
+      }
+      get
+      {
+        bool focusable = IsKeyboardFocusable();
+        return focusable;
+      }
+    }
+
+%}
+
+%enddef
 
 %define DALI_ACTOR_EVENTHANDLER_PARAM( NameSpace, ClassName)
 
-  ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
-  ACTOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ACTOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
 
-  %enddef
+%enddef
 
-  namespace Dali
+namespace Dali
 {
   DALI_ACTOR_EVENTHANDLER_PARAM( Dali, Actor);
 }
index 8639532..4415479 100644 (file)
  */
 
 %define Animation_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
-  %typemap(csimports) NameSpace::ClassName %{
-    using System;
-    using System.Runtime.InteropServices;
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+%}
 
-    %}
-    %enddef
+%enddef
 
 %define Animation_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
   %typemap(cscode) NameSpace::ClassName %{
 
-
     /**
       * @brief Event arguments that passed via Finished signal
       *
     }
 
 
-    public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
-      ClassName ret = new ClassName(cPtr, false);
-      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
+  public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+    ClassName ret = new ClassName(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  public float Duration
+  {
+    set
+    {
+       SetDuration(value);
+    }
+    get
+    {
+       float ret = GetDuration();
+       return ret;
+    }
+  }
+
+  public AlphaFunction DefaultAlphaFunction
+  {
+    set
+    {
+       SetDefaultAlphaFunction(value);
+    }
+    get
+    {
+       AlphaFunction ret = GetDefaultAlphaFunction();
+       return ret;
+    }
+  }
+
+  public Animation.State Status
+  {
+    get
+    {
+       Animation.State ret = GetState();
+       return ret;
     }
+  }
 
-    %}
+%}
 
-    %enddef
+%enddef
 
 
 %define DALI_animation_EVENTHANDLER_PARAM( NameSpace, ClassName)
index 5cdecaf..62f372a 100644 (file)
@@ -544,6 +544,28 @@ public class SceneCreatedEventArgs : EventArgs
      }
   }
 
+  public Vector2 Size
+  {
+     get
+     {
+        Vector2 ret = GetSize();
+        return ret;
+     }
+  }
+
+  public Vector4 BackgroundColor
+  {
+     set
+     {
+        SetBackgroundColor(value);
+     }
+     get
+     {
+        Vector4 ret = GetBackgroundColor();
+        return ret;
+     }
+   }
+
 %}
 
 %enddef
index 2e01c02..98eaab5 100644 (file)
@@ -59,9 +59,9 @@ namespace MyCSharpExample
       Console.WriteLine("Actor name: " + actor.Name);
 
       Stage stage = Stage.GetCurrent();
-      stage.SetBackgroundColor( NDalic.WHITE );
+      stage.BackgroundColor =  NDalic.WHITE ;
 
-      Vector2 stageSize = stage.GetSize();
+      Vector2 stageSize = stage.Size;
       Console.WriteLine("Stage size: " + stageSize.x + ", " + stageSize.y);
       stage.Add(actor);
 
index 0a5a841..c2caeb5 100755 (executable)
@@ -47,7 +47,7 @@ namespace MyCSharpExample
         {
             Console.WriteLine("Customized Application Initialize event handler");
             Stage stage = Stage.GetCurrent();
-            stage.SetBackgroundColor( NDalic.WHITE );
+            stage.BackgroundColor = NDalic.WHITE;
 
             stage.Touched += new Dali.Stage.TouchEventHandler(OnStageTouched);
 
@@ -65,7 +65,7 @@ namespace MyCSharpExample
         public void AnimationFinished(object source, Animation.FinishedEventArgs e)
         {
             Console.WriteLine("Customized Animation Finished Event handler");
-            Console.WriteLine("Animation finished: duration = " + e.Animation.GetDuration());
+            Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
         }
 
         // Callback for stage touched signal handling
index f8ea8c8..09b6d4d 100644 (file)
@@ -48,11 +48,11 @@ namespace MyCSharpExample
         private void CreateScrollView()
         {
             Stage stage = Stage.GetCurrent();
-            stage.SetBackgroundColor(NDalic.WHITE);
+            stage.BackgroundColor = NDalic.WHITE;
 
             // Create a scroll view
             _scrollView = new ScrollView();
-            Vector2 stageSize = stage.GetSize();
+            Vector2 stageSize = stage.Size;
             _scrollView.Size = new Vector3(stageSize.x, stageSize.y, 0.0f);
             _scrollView.ParentOrigin = NDalic.ParentOriginCenter;
             _scrollView.AnchorPoint = NDalic.AnchorPointCenter;