From: dongsug-song <35130733+dongsug-song@users.noreply.github.com> Date: Mon, 14 May 2018 02:12:17 +0000 (+0900) Subject: [NUI] Enable Window's mouse wheel event (#247) X-Git-Tag: submit/tizen/20180514.044219~1^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69b81f53222477fd268dbe5505e2a595a5350ee5;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Enable Window's mouse wheel event (#247) Signed-off-by: dongsug.song --- diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 2b4e8d0e2..74dd35583 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -735,6 +735,16 @@ namespace Tizen.NUI return ret; } + + private WheelSignal StageWheelEventSignal() + { + WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal ContextLostSignal() { VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false); @@ -1040,7 +1050,10 @@ namespace Tizen.NUI } private event EventHandler _stageWheelHandler; - private EventCallbackDelegateType1 _stageWheelCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent); + private WheelEventCallbackType _wheelEventCallback; /// /// This event is emitted when the wheel event is received. @@ -1052,34 +1065,38 @@ namespace Tizen.NUI { if (_stageWheelHandler == null) { - _stageWheelCallbackDelegate = OnStageWheel; - WheelEventSignal().Connect(_stageWheelCallbackDelegate); + _wheelEventCallback = OnStageWheel; + this.StageWheelEventSignal().Connect(_wheelEventCallback); } _stageWheelHandler += value; } remove { _stageWheelHandler -= value; - if (_stageWheelHandler == null && WheelEventSignal().Empty() == false) + if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false) { - WheelEventSignal().Disconnect(_stageWheelCallbackDelegate); + this.StageWheelEventSignal().Disconnect(_wheelEventCallback); } } } - private void OnStageWheel(IntPtr data) + private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent) { + if (wheelEvent == global::System.IntPtr.Zero) + { + NUILog.Error("wheelEvent should not be null!"); + return true; + } + WheelEventArgs e = new WheelEventArgs(); - if (data != null) - { - e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data); - } + e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent); if (_stageWheelHandler != null) { _stageWheelHandler(this, e); } + return true; } ///