2 * Copyright(c) 2018 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.
17 using Tizen.NUI.BaseComponents;
18 using System.ComponentModel;
23 /// GestureDetectors analyses a stream of touch events and attempt to determine the intention of the user.<br />
24 /// An view is attached to a gesture detector and if the detector recognises a pattern in its analysis, it will
25 /// trigger a detected event to the application.<br />
26 /// This is the base class for different gesture detectors available and provides functionality that is common to all the gesture detectors.<br />
28 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class GestureDetector : BaseHandle
34 /// Constructor. Creates an uninitialized GestureDetector.
36 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
37 [EditorBrowsable(EditorBrowsableState.Never)]
38 public GestureDetector() : this(Interop.GestureDetector.NewGestureDetector(), true)
40 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46 /// <param name="handle">A reference to the copied handle</param>
47 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
48 [EditorBrowsable(EditorBrowsableState.Never)]
49 public GestureDetector(GestureDetector handle) : this(Interop.GestureDetector.NewGestureDetector(GestureDetector.getCPtr(handle)), true)
51 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 internal GestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
59 /// Attaches an view to the gesture. The detected event will be triggered when the gesture occurs on the attached view.
61 /// <param name="view">The view to attach to the gesture detector</param>
62 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
63 [EditorBrowsable(EditorBrowsableState.Never)]
64 public void Attach(View view)
66 Interop.GestureDetector.Attach(SwigCPtr, View.getCPtr(view));
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71 /// Detaches the attached view from the gesture detector.
73 /// <param name="view">The view to detach from the gesture detector</param>
74 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public void Detach(View view)
78 Interop.GestureDetector.Detach(SwigCPtr, View.getCPtr(view));
79 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83 /// Detaches all the views that have been attached to the gesture detector.
85 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
86 [EditorBrowsable(EditorBrowsableState.Never)]
87 public void DetachAll()
89 Interop.GestureDetector.DetachAll(SwigCPtr);
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// Returns the number of views attached to the gesture detector.
96 /// <returns>The count</returns>
97 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
98 [EditorBrowsable(EditorBrowsableState.Never)]
99 public uint GetAttachedViewCount()
101 uint ret = Interop.GestureDetector.GetAttachedActorCount(SwigCPtr);
102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 /// Returns an view by index. An empty handle if the index is not valid.
109 /// <param name="index">The attached view's index</param>
110 /// <returns>The attached view or an empty handle</returns>
111 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
112 [EditorBrowsable(EditorBrowsableState.Never)]
113 public View GetAttachedView(uint index)
115 View ret = new View(Interop.GestureDetector.GetAttachedActor(SwigCPtr, index), true);
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 internal GestureDetector Assign(GestureDetector rhs)
122 GestureDetector ret = new GestureDetector(Interop.GestureDetector.Assign(SwigCPtr, GestureDetector.getCPtr(rhs)), false);
123 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127 internal static GestureDetector DownCast(BaseHandle handle)
129 GestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as GestureDetector;
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GestureDetector obj)
136 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
139 /// This will not be public opened.
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
143 Interop.GestureDetector.DeleteGestureDetector(swigCPtr);