1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
\r
2 // PROPRIETARY/CONFIDENTIAL
\r
3 // This software is the confidential and proprietary
\r
4 // information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
\r
5 // not disclose such Confidential Information and shall use it only in
\r
6 // accordance with the terms of the license agreement you entered into with
\r
7 // SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
\r
8 // suitability of the software, either express or implied, including but not
\r
9 // limited to the implied warranties of merchantability, fitness for a
\r
10 // particular purpose, or non-infringement. SAMSUNG shall not be liable for any
\r
11 // damages suffered by licensee as a result of using, modifying or distributing
\r
12 // this software or its derivatives.
\r
14 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
\r
16 // Licensed under the Apache License, Version 2.0 (the "License");
\r
17 // you may not use this file except in compliance with the License.
\r
18 // You may obtain a copy of the License at
\r
20 // http://www.apache.org/licenses/LICENSE-2.0
\r
22 // Unless required by applicable law or agreed to in writing, software
\r
23 // distributed under the License is distributed on an "AS IS" BASIS,
\r
24 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
25 // See the License for the specific language governing permissions and
\r
26 // limitations under the License.
\r
29 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
\r
30 // Some have been manually changed
\r
37 using System.Runtime.InteropServices;
\r
40 public class Stage : BaseHandle
\r
42 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
\r
44 internal Stage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Stage_SWIGUpcast(cPtr), cMemoryOwn)
\r
46 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
\r
49 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Stage obj)
\r
51 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
\r
56 DisposeQueue.Instance.Add(this);
\r
59 public override void Dispose()
\r
61 if (!Stage.IsInstalled())
\r
63 DisposeQueue.Instance.Add(this);
\r
69 if (swigCPtr.Handle != global::System.IntPtr.Zero)
\r
73 swigCMemOwn = false;
\r
74 NDalicPINVOKE.delete_Stage(swigCPtr);
\r
76 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
\r
78 global::System.GC.SuppressFinalize(this);
\r
85 * @brief Event arguments that passed via Touch signal
\r
88 public class TouchEventArgs : EventArgs
\r
90 private Touch _touch;
\r
93 * @brief Touch - contains the information of touch points
\r
109 private event EventHandler<TouchEventArgs> _stageTouchEventHandler;
\r
110 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
111 private delegate void StageTouchCallbackType(IntPtr data);
\r
112 private StageTouchCallbackType _stageTouchCallback;
\r
115 * @brief Event for TouchEvent signal which can be used to subscribe/unsubscribe the event handler
\r
116 * TouchEvent signal is emitted when the screen is touched and when the touch ends
\r
117 * (i.e. the down & up touch events only).
\r
120 public event EventHandler<TouchEventArgs> Touch
\r
124 if (_stageTouchEventHandler == null)
\r
126 _stageTouchCallback = OnStageTouch;
\r
127 TouchSignal().Connect(_stageTouchCallback);
\r
130 _stageTouchEventHandler += value;
\r
134 _stageTouchEventHandler -= value;
\r
136 if (_stageTouchEventHandler == null && _stageTouchCallback != null)
\r
138 TouchSignal().Disconnect(_stageTouchCallback);
\r
143 private void OnStageTouch(IntPtr data)
\r
145 TouchEventArgs e = new TouchEventArgs();
\r
149 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
\r
152 if (_stageTouchEventHandler != null)
\r
154 _stageTouchEventHandler(this, e);
\r
159 * @brief Wheel arguments that passed via Wheel signal
\r
162 public class WheelEventArgs : EventArgs
\r
164 private Wheel _wheel;
\r
179 private event EventHandler<WheelEventArgs> _stageWheelEventHandler;
\r
180 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
181 private delegate void StageWheelCallbackType(IntPtr data);
\r
182 private StageWheelCallbackType _stageWheelCallback;
\r
185 * @brief Event for Wheel signal which can be used to subscribe/unsubscribe the event handler
\r
186 * Wheel signal is emitted is emitted when wheel event is received.
\r
189 public event EventHandler<WheelEventArgs> Wheel
\r
193 if (_stageWheelEventHandler == null)
\r
195 _stageWheelCallback = OnStageWheel;
\r
196 WheelEventSignal().Connect(_stageWheelCallback);
\r
199 _stageWheelEventHandler += value;
\r
203 _stageWheelEventHandler -= value;
\r
205 if (_stageWheelEventHandler == null && _stageWheelCallback != null)
\r
207 WheelEventSignal().Disconnect(_stageWheelCallback);
\r
213 private void OnStageWheel(IntPtr data)
\r
215 WheelEventArgs e = new WheelEventArgs();
\r
219 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
\r
222 if (_stageWheelEventHandler != null)
\r
224 _stageWheelEventHandler(this, e);
\r
229 * @brief Event arguments that passed via Key signal
\r
232 public class KeyEventArgs : EventArgs
\r
249 private event EventHandler<KeyEventArgs> _stageKeyEventHandler;
\r
250 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
251 private delegate void StageKeyCallbackType(IntPtr data);
\r
252 private StageKeyCallbackType _stageKeyCallback;
\r
255 * @brief Event for Key signal which can be used to subscribe/unsubscribe the event handler
\r
256 * Key signal is emitted is emitted when key event is received.
\r
259 public event EventHandler<KeyEventArgs> Key
\r
263 if (_stageKeyEventHandler == null)
\r
265 _stageKeyCallback = OnStageKey;
\r
266 KeyEventSignal().Connect(_stageKeyCallback);
\r
269 _stageKeyEventHandler += value;
\r
273 _stageKeyEventHandler -= value;
\r
275 if (_stageKeyEventHandler == null && _stageKeyCallback != null)
\r
277 KeyEventSignal().Disconnect(_stageKeyCallback);
\r
282 // Callback for Stage KeyEventsignal
\r
283 private void OnStageKey(IntPtr data)
\r
285 KeyEventArgs e = new KeyEventArgs();
\r
289 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
\r
292 if (_stageKeyEventHandler != null)
\r
294 _stageKeyEventHandler(this, e);
\r
298 private event EventHandler _stageEventProcessingFinishedEventHandler;
\r
299 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
300 private delegate void StageEventProcessingFinishedEventCallbackType();
\r
301 private StageEventProcessingFinishedEventCallbackType _stageEventProcessingFinishedEventCallback;
\r
304 * @brief Event for EventProcessingFinished signal which can be used to subscribe/unsubscribe the event handler
\r
305 * provided by the user. EventProcessingFinished signal is emitted just after the event processing is finished.
\r
308 internal event EventHandler EventProcessingFinished
\r
312 if (_stageEventProcessingFinishedEventHandler == null)
\r
314 _stageEventProcessingFinishedEventCallback = OnEventProcessingFinished;
\r
315 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallback);
\r
318 _stageEventProcessingFinishedEventHandler += value;
\r
322 _stageEventProcessingFinishedEventHandler -= value;
\r
324 if (_stageEventProcessingFinishedEventHandler == null && _stageEventProcessingFinishedEventCallback != null)
\r
326 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallback);
\r
331 private void OnEventProcessingFinished()
\r
333 if (_stageEventProcessingFinishedEventHandler != null)
\r
335 _stageEventProcessingFinishedEventHandler(this, null);
\r
339 private event EventHandler _stageContextLostEventHandler;
\r
340 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
341 private delegate void StageContextLostEventCallbackType();
\r
342 private StageContextLostEventCallbackType _stageContextLostEventCallback;
\r
345 * @brief Event for ContextLost signal which can be used to subscribe/unsubscribe the event handler
\r
346 * ContextLost signal is emitted when the GL context is lost (Platform specific behaviour).
\r
349 internal event EventHandler ContextLost
\r
353 if (_stageContextLostEventHandler == null)
\r
355 _stageContextLostEventCallback = OnContextLost;
\r
356 ContextLostSignal().Connect(_stageContextLostEventCallback);
\r
359 _stageContextLostEventHandler += value;
\r
363 _stageContextLostEventHandler -= value;
\r
365 if (_stageContextLostEventHandler == null && _stageContextLostEventCallback != null)
\r
367 ContextLostSignal().Disconnect(_stageContextLostEventCallback);
\r
372 private void OnContextLost()
\r
374 if (_stageContextLostEventHandler != null)
\r
376 _stageContextLostEventHandler(this, null);
\r
380 private event EventHandler _stageContextRegainedEventHandler;
\r
381 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
382 private delegate void StageContextRegainedEventCallbackType();
\r
383 private StageContextRegainedEventCallbackType _stageContextRegainedEventCallback;
\r
386 * @brief Event for ContextRegained signal which can be used to subscribe/unsubscribe the event handler
\r
387 * provided by the user. ContextRegained signal is emitted when the GL context is regained (Platform specific
\r
391 internal event EventHandler ContextRegained
\r
395 if (_stageContextRegainedEventHandler == null)
\r
397 _stageContextRegainedEventCallback = OnContextRegained;
\r
398 ContextRegainedSignal().Connect(_stageContextRegainedEventCallback);
\r
401 _stageContextRegainedEventHandler += value;
\r
405 _stageContextRegainedEventHandler -= value;
\r
407 if (_stageContextRegainedEventHandler == null && _stageContextRegainedEventCallback != null)
\r
409 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallback);
\r
414 private void OnContextRegained()
\r
416 if (_stageContextRegainedEventHandler != null)
\r
418 _stageContextRegainedEventHandler(this, null);
\r
422 private event EventHandler _stageSceneCreatedEventHandler;
\r
423 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
424 private delegate void StageSceneCreatedEventCallbackType();
\r
425 private StageSceneCreatedEventCallbackType _stageSceneCreatedEventCallback;
\r
428 * @brief Event for SceneCreated signal which can be used to subscribe/unsubscribe the event handler
\r
429 * SceneCreated signal is emitted after the initial scene is created.
\r
432 internal event EventHandler SceneCreated
\r
436 if (_stageSceneCreatedEventHandler == null)
\r
438 _stageSceneCreatedEventCallback = OnSceneCreated;
\r
439 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallback);
\r
442 _stageSceneCreatedEventHandler += value;
\r
446 _stageSceneCreatedEventHandler -= value;
\r
448 if (_stageSceneCreatedEventHandler == null && _stageSceneCreatedEventCallback != null)
\r
450 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallback);
\r
456 private void OnSceneCreated()
\r
458 if (_stageSceneCreatedEventHandler != null)
\r
460 _stageSceneCreatedEventHandler(this, null);
\r
469 Size2D ret = GetSize();
\r
474 public Color BackgroundColor
\r
478 SetBackgroundColor(value);
\r
482 Color ret = GetBackgroundColor();
\r
495 public uint LayerCount
\r
499 return GetLayerCount();
\r
503 private static readonly Stage instance = Stage.GetCurrent();
\r
505 public static Stage Instance
\r
513 public Layer GetDefaultLayer()
\r
515 return this.GetRootLayer();
\r
518 public void AddLayer(Layer layer)
\r
520 this.Add((Actor)layer);
\r
523 public void RemoveLayer(Layer layer)
\r
525 this.Remove((Actor)layer);
\r
528 internal static Vector4 DEFAULT_BACKGROUND_COLOR
\r
532 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
\r
533 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
\r
534 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
539 internal static Vector4 DEBUG_BACKGROUND_COLOR
\r
543 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
\r
544 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
\r
545 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
550 internal Stage() : this(NDalicPINVOKE.new_Stage__SWIG_0(), true)
\r
552 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
555 internal static Stage GetCurrent()
\r
557 Stage ret = new Stage(NDalicPINVOKE.Stage_GetCurrent(), true);
\r
558 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
562 internal static bool IsInstalled()
\r
564 bool ret = NDalicPINVOKE.Stage_IsInstalled();
\r
565 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
569 internal Stage(Stage handle) : this(NDalicPINVOKE.new_Stage__SWIG_1(Stage.getCPtr(handle)), true)
\r
571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
574 internal Stage Assign(Stage rhs)
\r
576 Stage ret = new Stage(NDalicPINVOKE.Stage_Assign(swigCPtr, Stage.getCPtr(rhs)), false);
\r
577 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
581 internal void Add(Actor actor)
\r
583 NDalicPINVOKE.Stage_Add(swigCPtr, Actor.getCPtr(actor));
\r
584 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
587 internal void Remove(Actor actor)
\r
589 NDalicPINVOKE.Stage_Remove(swigCPtr, Actor.getCPtr(actor));
\r
590 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
593 internal Size2D GetSize()
\r
595 Size2D ret = new Size2D(NDalicPINVOKE.Stage_GetSize(swigCPtr), true);
\r
596 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
600 internal RenderTaskList GetRenderTaskList()
\r
602 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(swigCPtr), true);
\r
603 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
607 internal uint GetLayerCount()
\r
609 uint ret = NDalicPINVOKE.Stage_GetLayerCount(swigCPtr);
\r
610 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
614 public Layer GetLayer(uint depth)
\r
616 Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(swigCPtr, depth), true);
\r
617 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
621 internal Layer GetRootLayer()
\r
623 Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(swigCPtr), true);
\r
624 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
629 internal void SetBackgroundColor(Color color)
\r
631 NDalicPINVOKE.Stage_SetBackgroundColor(swigCPtr, Color.getCPtr(color));
\r
632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
635 internal Color GetBackgroundColor()
\r
637 Color ret = new Color(NDalicPINVOKE.Stage_GetBackgroundColor(swigCPtr), true);
\r
638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
641 internal Vector2 GetDpi()
\r
643 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(swigCPtr), true);
\r
644 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
648 internal ObjectRegistry GetObjectRegistry()
\r
650 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(swigCPtr), true);
\r
651 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
655 public void KeepRendering(float durationSeconds)
\r
657 NDalicPINVOKE.Stage_KeepRendering(swigCPtr, durationSeconds);
\r
658 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
661 internal KeyEventSignal KeyEventSignal()
\r
663 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(swigCPtr), false);
\r
664 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
668 internal VoidSignal EventProcessingFinishedSignal()
\r
670 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(swigCPtr), false);
\r
671 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
675 internal TouchSignal TouchSignal()
\r
677 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(swigCPtr), false);
\r
678 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
682 internal StageWheelSignal WheelEventSignal()
\r
684 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(swigCPtr), false);
\r
685 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
689 internal VoidSignal ContextLostSignal()
\r
691 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(swigCPtr), false);
\r
692 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
696 internal VoidSignal ContextRegainedSignal()
\r
698 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(swigCPtr), false);
\r
699 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
703 internal VoidSignal SceneCreatedSignal()
\r
705 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(swigCPtr), false);
\r
706 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r