%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&)>;
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 );
%include dali-operator.i
%include devel-properties.i
+%include gestures/hover.i
+
+
%include dali-core.i
%include dali-adaptor.i
%include dali-toolkit.i
* @brief Event arguments that passed via Hover signal
*
*/
- public class HoverEventArgs : EventArgs
+ public class HoverArgs : EventArgs
{
private View _view;
- private HoverEvent _hoverEvent;
+ private Hover _hover;
/**
* @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
*
*/
- public HoverEvent HoverEvent
+ public Hover Hover
{
get
{
- return _hoverEvent;
+ return _hover;
}
set
{
- _hoverEvent = value;
+ _hover = value;
}
}
}
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);
/**
* @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
/**
* @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.
*/
- public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
+ public event DaliEventHandlerWithReturnType<object,HoverArgs,bool> Hovered
{
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)
{
- if (_viewHoverEventHandler != null)
+ if (_viewHoverHandler != null)
{
- this.HoveredSignal().Disconnect(_viewHoverEventCallbackDelegate);
+ this.HoveredSignal().Disconnect(_viewHoverCallbackDelegate);
}
- _viewHoverEventHandler -= value;
+ _viewHoverHandler -= value;
}
}
}
// 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.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
- return _viewHoverEventHandler(this, e);
+ return _viewHoverHandler(this, e);
}
return false;
--- /dev/null
+%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
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 );
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);
/**
* @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).
*/
- public virtual bool OnHoverEvent(HoverEvent hoverEvent)
+ public virtual bool OnHover(Hover hover)
{
return false; // Do not consume
}
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 OnSizeSetDelegate OnSizeSet;
public OnSizeAnimationDelegate OnSizeAnimation;
public OnTouchEventDelegate OnTouchEvent;
- public OnHoverEventDelegate OnHoverEvent;
+ public OnHoverDelegate OnHover;
public OnKeyEventDelegate OnKeyEvent;
public OnWheelEventDelegate OnWheelEvent;
public OnRelayoutDelegate OnRelayout;
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);
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)