Manual binding to add getter/setter APIs for Hover 57/112157/4
authorUmar <m.umar@partner.samsung.com>
Thu, 26 Jan 2017 14:54:19 +0000 (14:54 +0000)
committerUmar <m.umar@partner.samsung.com>
Thu, 26 Jan 2017 17:42:01 +0000 (17:42 +0000)
Change-Id: I0bd5c96cae5f10078b580bcac1095899e1606f51

plugins/dali-swig/SWIG/dali-core.i
plugins/dali-swig/SWIG/dali-gc.i
plugins/dali-swig/SWIG/dali.i
plugins/dali-swig/SWIG/events/control-event.i
plugins/dali-swig/SWIG/gestures/hover.i [new file with mode: 0644]
plugins/dali-swig/SWIG/signal-parameters.i
plugins/dali-swig/manual/csharp/CustomView.cs
plugins/dali-swig/manual/csharp/ViewWrapperImpl.cs

index 73ce8cc..48d8ff6 100755 (executable)
@@ -303,7 +303,7 @@ typedef std::pair< Dali::Radian, Dali::Radian > AngleThresholdPair;
 %template(LongPressGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::LongPressGesture&)>;
 //%template(ActorTouchEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchEvent&)>;
 %template(ActorTouchDataSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchData&)>;
 %template(LongPressGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::LongPressGesture&)>;
 //%template(ActorTouchEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchEvent&)>;
 %template(ActorTouchDataSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchData&)>;
-%template(ActorHoverEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::HoverEvent&)>;
+%template(ActorHoverSignal) Dali::Signal<bool (Dali::Actor, const Dali::HoverEvent&)>;
 %template(ActorWheelEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::WheelEvent&)>;
 %template(ActorSignal) Dali::Signal<void (Dali::Actor)>;
 %template(KeyEventSignal) Dali::Signal<void (const Dali::KeyEvent&)>;
 %template(ActorWheelEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::WheelEvent&)>;
 %template(ActorSignal) Dali::Signal<void (Dali::Actor)>;
 %template(KeyEventSignal) Dali::Signal<void (const Dali::KeyEvent&)>;
index a9566c8..2e86045 100644 (file)
@@ -1207,8 +1207,6 @@ DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, LongPressGestureDetector );
 
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, KeyEvent );
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, KeyEvent );
 
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, KeyEvent );
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, KeyEvent );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, HoverEvent );
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, HoverEvent );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchEvent );
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, TouchEvent );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, WheelEvent );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchEvent );
 DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, TouchEvent );
 DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, WheelEvent );
index 17a25e0..824ed85 100755 (executable)
@@ -286,6 +286,9 @@ using namespace Dali::Toolkit;
 %include dali-operator.i
 %include devel-properties.i
 
 %include dali-operator.i
 %include devel-properties.i
 
+%include gestures/hover.i
+
+
 %include dali-core.i
 %include dali-adaptor.i
 %include dali-toolkit.i
 %include dali-core.i
 %include dali-adaptor.i
 %include dali-toolkit.i
index 150be84..36704ca 100755 (executable)
       * @brief Event arguments that passed via Hover signal
       *
       */
       * @brief Event arguments that passed via Hover signal
       *
       */
-    public class HoverEventArgs : EventArgs
+    public class HoverArgs : EventArgs
     {
     private View _view;
     {
     private View _view;
-    private HoverEvent _hoverEvent;
+    private Hover _hover;
 
       /**
         * @brief View - is the view that is being hovered
 
       /**
         * @brief View - is the view that is being hovered
       }
 
       /**
       }
 
       /**
-        * @brief HoverEvent - contains touch points that represent the points
+        * @brief Hover - contains touch points that represent the points
         * that are currently being hovered or the points where a hover has stopped
         *
         */
         * that are currently being hovered or the points where a hover has stopped
         *
         */
-      public HoverEvent HoverEvent
+      public Hover Hover
       {
         get
         {
       {
         get
         {
-          return _hoverEvent;
+          return _hover;
         }
         set
         {
         }
         set
         {
-          _hoverEvent = value;
+          _hover = value;
         }
       }
     }
         }
       }
     }
     private TouchCallbackDelegate _viewTouchDataCallbackDelegate;
 
     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
     private TouchCallbackDelegate _viewTouchDataCallbackDelegate;
 
     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-    private delegate bool HoverEventCallbackDelegate(IntPtr view, IntPtr hoverEvent);
-    private DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> _viewHoverEventHandler;
-    private HoverEventCallbackDelegate _viewHoverEventCallbackDelegate;
+    private delegate bool HoverCallbackDelegate(IntPtr view, IntPtr hover);
+    private DaliEventHandlerWithReturnType<object,HoverArgs,bool> _viewHoverHandler;
+    private HoverCallbackDelegate _viewHoverCallbackDelegate;
 
     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
     private delegate bool WheelEventCallbackDelegate(IntPtr view, IntPtr wheelEvent);
 
     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
     private delegate bool WheelEventCallbackDelegate(IntPtr view, IntPtr wheelEvent);
 
     /**
      * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler
 
     /**
      * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler
-     * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler<object,KeyInputFocusGainedEventArgs>) 
+     * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler<object,KeyInputFocusGainedEventArgs>)
      * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
      */
     public event DaliEventHandler<object,KeyInputFocusGainedEventArgs> KeyInputFocusGained
      * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
      */
     public event DaliEventHandler<object,KeyInputFocusGainedEventArgs> KeyInputFocusGained
 
     /**
       * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
 
     /**
       * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
-      * (in the type of HoverEventHandler-DaliEventHandlerWithReturnType<object,HoverEventArgs,bool>)
+      * (in the type of HoverHandler-DaliEventHandlerWithReturnType<object,HoverArgs,bool>)
       * provided by the user. Hovered signal is emitted when hover input is received.
       */
       * provided by the user. Hovered signal is emitted when hover input is received.
       */
-    public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
+    public event DaliEventHandlerWithReturnType<object,HoverArgs,bool> Hovered
     {
       add
       {
         lock(this)
         {
           // Restricted to only one listener
     {
       add
       {
         lock(this)
         {
           // Restricted to only one listener
-          if (_viewHoverEventHandler == null)
+          if (_viewHoverHandler == null)
           {
           {
-            _viewHoverEventHandler += value;
+            _viewHoverHandler += value;
 
 
-            _viewHoverEventCallbackDelegate = new HoverEventCallbackDelegate(OnHoverEvent);
-            this.HoveredSignal().Connect(_viewHoverEventCallbackDelegate);
+            _viewHoverCallbackDelegate = new HoverCallbackDelegate(OnHover);
+            this.HoveredSignal().Connect(_viewHoverCallbackDelegate);
           }
         }
       }
           }
         }
       }
       {
         lock(this)
         {
       {
         lock(this)
         {
-          if (_viewHoverEventHandler != null)
+          if (_viewHoverHandler != null)
           {
           {
-            this.HoveredSignal().Disconnect(_viewHoverEventCallbackDelegate);
+            this.HoveredSignal().Disconnect(_viewHoverCallbackDelegate);
           }
 
           }
 
-          _viewHoverEventHandler -= value;
+          _viewHoverHandler -= value;
         }
       }
     }
 
     // Callback for View Hover signal
         }
       }
     }
 
     // Callback for View Hover signal
-    private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
+    private bool OnHover(IntPtr view, IntPtr hover)
     {
     {
-      HoverEventArgs e = new HoverEventArgs();
+      HoverArgs e = new HoverArgs();
 
 
-      // Populate all members of "e" (HoverEventArgs) with real data
+      // Populate all members of "e" (HoverArgs) with real data
       e.View = View.GetViewFromPtr(view);
       e.View = View.GetViewFromPtr(view);
-      e.HoverEvent = Dali.HoverEvent.GetHoverEventFromPtr(hoverEvent);
+      e.Hover = Dali.Hover.GetHoverFromPtr(hover);
 
 
-      if (_viewHoverEventHandler != null)
+      if (_viewHoverHandler != null)
       {
         //here we send all data to user event handlers
       {
         //here we send all data to user event handlers
-        return _viewHoverEventHandler(this, e);
+        return _viewHoverHandler(this, e);
       }
 
       return false;
       }
 
       return false;
diff --git a/plugins/dali-swig/SWIG/gestures/hover.i b/plugins/dali-swig/SWIG/gestures/hover.i
new file mode 100644 (file)
index 0000000..6116efc
--- /dev/null
@@ -0,0 +1,62 @@
+%rename(Hover) Dali::HoverEvent;
+
+%csmethodmodifiers Dali::HoverEvent::points "private";
+%csmethodmodifiers Dali::HoverEvent::time "private";
+
+%typemap(cscode) Dali::HoverEvent %{
+  public static Hover GetHoverFromPtr(global::System.IntPtr cPtr) {
+    Hover ret = new Hover(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public uint GetTime() {
+    return time;
+  }
+
+  public int GetDeviceId(uint point) {
+    if( point < points.Count )
+    {
+      return points[(int)point].deviceId;
+    }
+    return -1;
+  }
+
+  public PointStateType GetState(uint point) {
+    if( point < points.Count )
+    {
+      return (Dali.PointStateType)(points[(int)point].state);
+    }
+    return PointStateType.FINISHED;
+  }
+
+  public Actor GetHitActor(uint point) {
+    if( point < points.Count )
+    {
+      return points[(int)point].hitActor;
+    }
+    else
+    {
+      // Return a native empty handle
+      Actor actor = new Actor();
+      actor.Reset();
+      return actor;
+    }
+  }
+
+  public Vector2 GetLocalPosition(uint point) {
+    if( point < points.Count )
+    {
+      return points[(int)point].local;
+    }
+    return new Vector2(0.0f, 0.0f);
+  }
+
+  public Vector2 GetScreenPosition(uint point) {
+    if( point < points.Count )
+    {
+      return points[(int)point].screen;
+    }
+    return new Vector2(0.0f, 0.0f);
+  }
+%}
\ No newline at end of file
index 214abe4..ffb8ec7 100644 (file)
@@ -56,7 +56,6 @@ DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, ResourceImage );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Animation );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchEvent );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchData );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Animation );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchEvent );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchData );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, HoverEvent );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, WheelEvent );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, KeyEvent );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, LongPressGesture );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, WheelEvent );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, KeyEvent );
 DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, LongPressGesture );
index f704885..020fad0 100644 (file)
@@ -30,7 +30,7 @@ namespace Dali
             viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet);
             viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation);
             viewWrapperImpl.OnTouchEvent = new ViewWrapperImpl.OnTouchEventDelegate(OnTouchEvent);
             viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet);
             viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation);
             viewWrapperImpl.OnTouchEvent = new ViewWrapperImpl.OnTouchEventDelegate(OnTouchEvent);
-            viewWrapperImpl.OnHoverEvent = new ViewWrapperImpl.OnHoverEventDelegate(OnHoverEvent);
+            viewWrapperImpl.OnHover = new ViewWrapperImpl.OnHoverDelegate(OnHover);
             viewWrapperImpl.OnKeyEvent = new ViewWrapperImpl.OnKeyEventDelegate(OnKeyEvent);
             viewWrapperImpl.OnWheelEvent = new ViewWrapperImpl.OnWheelEventDelegate(OnWheelEvent);
             viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout);
             viewWrapperImpl.OnKeyEvent = new ViewWrapperImpl.OnKeyEventDelegate(OnKeyEvent);
             viewWrapperImpl.OnWheelEvent = new ViewWrapperImpl.OnWheelEventDelegate(OnWheelEvent);
             viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout);
@@ -469,11 +469,11 @@ namespace Dali
         /**
          * @brief Called after a hover-event is received by the owning actor.
          *
         /**
          * @brief Called after a hover-event is received by the owning actor.
          *
-         * @param[in] event The hover event
-         * @return True if the event should be consumed.
+         * @param[in] hover The hover event
+         * @return True if the hover event should be consumed.
          * @note CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
          */
          * @note CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
          */
-        public virtual bool OnHoverEvent(HoverEvent hoverEvent)
+        public virtual bool OnHover(Hover hover)
         {
             return false; // Do not consume
         }
         {
             return false; // Do not consume
         }
index 7605d4a..97e9cd3 100644 (file)
@@ -28,7 +28,7 @@ namespace Dali
         public delegate void OnSizeSetDelegate(Vector3 targetSize);
         public delegate void OnSizeAnimationDelegate(Animation animation, Vector3 targetSize);
         public delegate bool OnTouchEventDelegate(TouchEvent touchEvent);
         public delegate void OnSizeSetDelegate(Vector3 targetSize);
         public delegate void OnSizeAnimationDelegate(Animation animation, Vector3 targetSize);
         public delegate bool OnTouchEventDelegate(TouchEvent touchEvent);
-        public delegate bool OnHoverEventDelegate(HoverEvent hoverEvent);
+        public delegate bool OnHoverDelegate(Hover hover);
         public delegate bool OnKeyEventDelegate(KeyEvent keyEvent);
         public delegate bool OnWheelEventDelegate(WheelEvent wheelEvent);
         public delegate void OnRelayoutDelegate(Vector2 size, RelayoutContainer container);
         public delegate bool OnKeyEventDelegate(KeyEvent keyEvent);
         public delegate bool OnWheelEventDelegate(WheelEvent wheelEvent);
         public delegate void OnRelayoutDelegate(Vector2 size, RelayoutContainer container);
@@ -69,7 +69,7 @@ namespace Dali
         public OnSizeSetDelegate OnSizeSet;
         public OnSizeAnimationDelegate OnSizeAnimation;
         public OnTouchEventDelegate OnTouchEvent;
         public OnSizeSetDelegate OnSizeSet;
         public OnSizeAnimationDelegate OnSizeAnimation;
         public OnTouchEventDelegate OnTouchEvent;
-        public OnHoverEventDelegate OnHoverEvent;
+        public OnHoverDelegate OnHover;
         public OnKeyEventDelegate OnKeyEvent;
         public OnWheelEventDelegate OnWheelEvent;
         public OnRelayoutDelegate OnRelayout;
         public OnKeyEventDelegate OnKeyEvent;
         public OnWheelEventDelegate OnWheelEvent;
         public OnRelayoutDelegate OnRelayout;
@@ -256,7 +256,7 @@ namespace Dali
             Delegate5 = new DelegateViewWrapperImpl_5(DirectorOnSizeSet);
             Delegate6 = new DelegateViewWrapperImpl_6(DirectorOnSizeAnimation);
             Delegate7 = new DelegateViewWrapperImpl_7(DirectorOnTouchEvent);
             Delegate5 = new DelegateViewWrapperImpl_5(DirectorOnSizeSet);
             Delegate6 = new DelegateViewWrapperImpl_6(DirectorOnSizeAnimation);
             Delegate7 = new DelegateViewWrapperImpl_7(DirectorOnTouchEvent);
-            Delegate8 = new DelegateViewWrapperImpl_8(DirectorOnHoverEvent);
+            Delegate8 = new DelegateViewWrapperImpl_8(DirectorOnHover);
             Delegate9 = new DelegateViewWrapperImpl_9(DirectorOnKeyEvent);
             Delegate10 = new DelegateViewWrapperImpl_10(DirectorOnWheelEvent);
             Delegate11 = new DelegateViewWrapperImpl_11(DirectorOnRelayout);
             Delegate9 = new DelegateViewWrapperImpl_9(DirectorOnKeyEvent);
             Delegate10 = new DelegateViewWrapperImpl_10(DirectorOnWheelEvent);
             Delegate11 = new DelegateViewWrapperImpl_11(DirectorOnRelayout);
@@ -330,9 +330,9 @@ namespace Dali
             return OnTouchEvent(new TouchEvent(arg0, false));
         }
 
             return OnTouchEvent(new TouchEvent(arg0, false));
         }
 
-        private bool DirectorOnHoverEvent(global::System.IntPtr arg0)
+        private bool DirectorOnHover(global::System.IntPtr arg0)
         {
         {
-            return OnHoverEvent(new HoverEvent(arg0, false));
+            return OnHover(new Hover(arg0, false));
         }
 
         private bool DirectorOnKeyEvent(global::System.IntPtr arg0)
         }
 
         private bool DirectorOnKeyEvent(global::System.IntPtr arg0)