2 * Copyright(c) 2019 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.
19 using System.Runtime.InteropServices;
20 using Tizen.NUI.BaseComponents;
21 using System.ComponentModel;
26 /// Cube Transition Effect base class, used to apply custom effects to a
27 /// Cube Transition instance.
29 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public class CubeTransitionEffect : View
33 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34 private EventHandler<TransitionCompletedEventArgs> _transitionCompletedEventHandler;
35 private TransitionCompletedCallbackDelegate _transitionCompletedCallbackDelegate;
37 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
38 private delegate void TransitionCompletedCallbackDelegate(IntPtr cubeTransition, IntPtr cubeTexture);
43 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
44 [EditorBrowsable(EditorBrowsableState.Never)]
45 public CubeTransitionEffect() : this(Interop.CubeTransitionEffect.new_CubeTransitionEffect(), true)
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CubeTransitionEffect obj)
52 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
55 internal CubeTransitionEffect(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.CubeTransitionEffect.CubeTransitionEffect_SWIGUpcast(cPtr), cMemoryOwn)
57 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
60 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 public void SetTransitionDuration(float duration)
64 Interop.CubeTransitionEffect.CubeTransitionEffect_SetTransitionDuration(swigCPtr, duration);
65 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public float GetTransitionDuration()
72 float result = Interop.CubeTransitionEffect.CubeTransitionEffect_GetTransitionDuration(swigCPtr);
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public void SetCubeDisplacement(float displacement)
81 Interop.CubeTransitionEffect.CubeTransitionEffect_SetCubeDisplacement(swigCPtr, displacement);
82 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
86 [EditorBrowsable(EditorBrowsableState.Never)]
87 public float GetCubeDisplacement()
89 float result = Interop.CubeTransitionEffect.CubeTransitionEffect_GetCubeDisplacement(swigCPtr);
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 public bool IsTransitioning()
98 bool result = Interop.CubeTransitionEffect.CubeTransitionEffect_IsTransitioning(swigCPtr);
99 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public void SetCurrentTexture(Texture texture)
107 Interop.CubeTransitionEffect.CubeTransitionEffect_SetCurrentTexture(swigCPtr, Texture.getCPtr(texture));
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
112 [EditorBrowsable(EditorBrowsableState.Never)]
113 public void SetTargetTexture(Texture texture)
115 Interop.CubeTransitionEffect.CubeTransitionEffect_SetTargetTexture(swigCPtr, Texture.getCPtr(texture));
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
120 [EditorBrowsable(EditorBrowsableState.Never)]
121 public void StartTransition(bool toNextImage = true)
123 Interop.CubeTransitionEffect.CubeTransitionEffect_StartTransition__SWIG1(swigCPtr, toNextImage);
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
128 [EditorBrowsable(EditorBrowsableState.Never)]
129 public void StartTransition(Vector2 panPosition, Vector2 panDisplacement)
131 Interop.CubeTransitionEffect.CubeTransitionEffect_StartTransition__SWIG2(swigCPtr, Vector2.getCPtr(panPosition), Vector2.getCPtr(panDisplacement));
132 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
136 [EditorBrowsable(EditorBrowsableState.Never)]
137 public void PauseTransition()
139 Interop.CubeTransitionEffect.CubeTransitionEffect_PauseTransition(swigCPtr);
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public void ResumeTransition()
147 Interop.CubeTransitionEffect.CubeTransitionEffect_ResumeTransition(swigCPtr);
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
152 [EditorBrowsable(EditorBrowsableState.Never)]
153 public void StopTransition()
155 Interop.CubeTransitionEffect.CubeTransitionEffect_StopTransition(swigCPtr);
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 CubeTransitionEffectSignal TransitionCompletedSignal()
161 CubeTransitionEffectSignal ret = new CubeTransitionEffectSignal(Interop.CubeTransitionEffect.CubeTransitionEffect_TransitionCompletedSignal(swigCPtr), false);
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// The TransitionCompleted event.
169 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public event EventHandler<TransitionCompletedEventArgs> TransitionCompleted
175 if (_transitionCompletedEventHandler == null)
177 _transitionCompletedCallbackDelegate = (OnTransitionCompleted);
178 TransitionCompletedSignal().Connect(_transitionCompletedCallbackDelegate);
180 _transitionCompletedEventHandler += value;
184 _transitionCompletedEventHandler -= value;
185 if (_transitionCompletedEventHandler == null && TransitionCompletedSignal().Empty() == false)
187 TransitionCompletedSignal().Disconnect(_transitionCompletedCallbackDelegate);
192 private void OnTransitionCompleted(IntPtr cubeTransition, IntPtr cubeTexture)
194 TransitionCompletedEventArgs e = new TransitionCompletedEventArgs();
196 // Populate all members of "e" (TransitionCompletedEventArgs) with real data
197 //e.CubeTransitionEffect = Registry.GetManagedBaseHandleFromNativePtr(cubeTransition) as CubeTransitionEffect;
199 if (_transitionCompletedEventHandler != null)
201 //here we send all data to user event handlers
202 _transitionCompletedEventHandler(this, e);
209 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
210 [EditorBrowsable(EditorBrowsableState.Never)]
211 protected override void Dispose(DisposeTypes type)
218 //Release your own unmanaged resources here.
219 //You should not access any managed member here except static instance.
220 //because the execution order of Finalizes is non-deterministic.
222 if (swigCPtr.Handle != global::System.IntPtr.Zero)
227 Interop.CubeTransitionEffect.delete_CubeTransitionEffect(swigCPtr);
229 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
235 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
236 [EditorBrowsable(EditorBrowsableState.Never)]
237 public class TransitionCompletedEventArgs : EventArgs
239 private CubeTransitionEffect _cubeTransitionEffect;
240 private Texture _cubeTransitonTexture;
243 /// CubeTransitionEffect.
245 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
246 [EditorBrowsable(EditorBrowsableState.Never)]
247 public CubeTransitionEffect CubeTransitionEffect
251 return _cubeTransitionEffect;
255 _cubeTransitionEffect = value;
259 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
260 [EditorBrowsable(EditorBrowsableState.Never)]
261 public Texture CubeTransitonTexture
265 return _cubeTransitonTexture;
269 _cubeTransitonTexture = value;
275 internal class CubeTransitionEffectSignal : global::System.IDisposable
277 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
278 protected bool swigCMemOwn;
280 internal CubeTransitionEffectSignal(global::System.IntPtr cPtr, bool cMemoryOwn)
282 swigCMemOwn = cMemoryOwn;
283 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
286 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CubeTransitionEffectSignal obj)
288 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
291 //A Flag to check who called Dispose(). (By User or DisposeQueue)
292 private bool isDisposeQueued = false;
293 //A Flat to check if it is already disposed.
294 protected bool disposed = false;
297 ~CubeTransitionEffectSignal()
299 if (!isDisposeQueued)
301 isDisposeQueued = true;
302 DisposeQueue.Instance.Add(this);
306 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
307 [EditorBrowsable(EditorBrowsableState.Never)]
310 bool ret = Interop.CubeTransitionEffect.CubeTransitionEffectSignal_Empty(swigCPtr);
311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
316 [EditorBrowsable(EditorBrowsableState.Never)]
317 public uint GetConnectionCount()
319 uint ret = Interop.CubeTransitionEffect.CubeTransitionEffectSignal_GetConnectionCount(swigCPtr);
320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
324 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
325 [EditorBrowsable(EditorBrowsableState.Never)]
326 public void Connect(System.Delegate func)
328 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
330 Interop.CubeTransitionEffect.CubeTransitionEffectSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
336 [EditorBrowsable(EditorBrowsableState.Never)]
337 public void Disconnect(System.Delegate func)
339 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
341 Interop.CubeTransitionEffect.CubeTransitionEffectSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
342 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
347 [EditorBrowsable(EditorBrowsableState.Never)]
348 public void Emit(CubeTransitionEffect arg)
350 Interop.TextField.TextFieldSignal_Emit(swigCPtr, CubeTransitionEffect.getCPtr(arg));
351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
355 [EditorBrowsable(EditorBrowsableState.Never)]
356 public CubeTransitionEffectSignal() : this(Interop.CubeTransitionEffect.new_CubeTransitionEffectSignal(), true)
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
362 [EditorBrowsable(EditorBrowsableState.Never)]
363 public void Dispose()
365 //Throw excpetion if Dispose() is called in separate thread.
366 if (!Window.IsInstalled())
368 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
373 Dispose(DisposeTypes.Implicit);
377 Dispose(DisposeTypes.Explicit);
378 System.GC.SuppressFinalize(this);
382 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
383 [EditorBrowsable(EditorBrowsableState.Never)]
384 protected virtual void Dispose(DisposeTypes type)
391 if (type == DisposeTypes.Explicit)
394 //Release your own managed resources here.
395 //You should release all of your own disposable objects here.
399 //Release your own unmanaged resources here.
400 //You should not access any managed member here except static instance.
401 //because the execution order of Finalizes is non-deterministic.
403 if (swigCPtr.Handle != global::System.IntPtr.Zero)
408 Interop.CubeTransitionEffect.delete_CubeTransitionEffectSignal(swigCPtr);
410 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
419 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
420 [EditorBrowsable(EditorBrowsableState.Never)]
421 public class CubeTransitionWaveEffect : CubeTransitionEffect
423 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
428 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
429 [EditorBrowsable(EditorBrowsableState.Never)]
430 public CubeTransitionWaveEffect(uint numRows, uint numColumns) : this(Interop.CubeTransitionWaveEffect.CubeTransitionWaveEffect_New(numRows, numColumns), true)
432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
435 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CubeTransitionWaveEffect obj)
437 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
440 internal CubeTransitionWaveEffect(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.CubeTransitionWaveEffect.CubeTransitionWaveEffect_SWIGUpcast(cPtr), cMemoryOwn)
442 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
448 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
449 [EditorBrowsable(EditorBrowsableState.Never)]
450 protected override void Dispose(DisposeTypes type)
457 if (type == DisposeTypes.Explicit)
460 //Release your own managed resources here.
461 //You should release all of your own disposable objects here.
465 //Release your own unmanaged resources here.
466 //You should not access any managed member here except static instance.
467 //because the execution order of Finalizes is non-deterministic.
469 if (swigCPtr.Handle != global::System.IntPtr.Zero)
474 Interop.CubeTransitionWaveEffect.delete_CubeTransitionWaveEffect(swigCPtr);
476 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
483 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
484 [EditorBrowsable(EditorBrowsableState.Never)]
485 public class CubeTransitionCrossEffect : CubeTransitionEffect
487 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
492 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
493 [EditorBrowsable(EditorBrowsableState.Never)]
494 public CubeTransitionCrossEffect(uint numRows, uint numColumns) : this(Interop.CubeTransitionCrossEffect.CubeTransitionCrossEffect_New(numRows, numColumns), true)
496 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CubeTransitionCrossEffect obj)
501 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
504 internal CubeTransitionCrossEffect(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.CubeTransitionCrossEffect.CubeTransitionCrossEffect_SWIGUpcast(cPtr), cMemoryOwn)
506 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
512 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
513 [EditorBrowsable(EditorBrowsableState.Never)]
514 protected override void Dispose(DisposeTypes type)
521 if (type == DisposeTypes.Explicit)
524 //Release your own managed resources here.
525 //You should release all of your own disposable objects here.
529 //Release your own unmanaged resources here.
530 //You should not access any managed member here except static instance.
531 //because the execution order of Finalizes is non-deterministic.
533 if (swigCPtr.Handle != global::System.IntPtr.Zero)
538 Interop.CubeTransitionCrossEffect.delete_CubeTransitionCrossEffect(swigCPtr);
540 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
547 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
548 [EditorBrowsable(EditorBrowsableState.Never)]
549 public class CubeTransitionFoldEffect : CubeTransitionEffect
551 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
556 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
557 [EditorBrowsable(EditorBrowsableState.Never)]
558 public CubeTransitionFoldEffect(uint numRows, uint numColumns) : this(Interop.CubeTransitionFoldEffect.CubeTransitionFoldEffect_New(numRows, numColumns), true)
560 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
563 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CubeTransitionFoldEffect obj)
565 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
568 internal CubeTransitionFoldEffect(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.CubeTransitionWaveEffect.CubeTransitionWaveEffect_SWIGUpcast(cPtr), cMemoryOwn)
570 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
576 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
577 [EditorBrowsable(EditorBrowsableState.Never)]
578 protected override void Dispose(DisposeTypes type)
585 if (type == DisposeTypes.Explicit)
588 //Release your own managed resources here.
589 //You should release all of your own disposable objects here.
593 //Release your own unmanaged resources here.
594 //You should not access any managed member here except static instance.
595 //because the execution order of Finalizes is non-deterministic.
597 if (swigCPtr.Handle != global::System.IntPtr.Zero)
602 Interop.CubeTransitionFoldEffect.delete_CubeTransitionFoldEffect(swigCPtr);
604 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);