X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FLayer.cs;h=8c141423cf12a27e910f0a45ba7a66f476b1960d;hb=f355f837f7ccb76d3beaef220c841b114792faac;hp=78f719cb7176fbbc835c582f452fb844d7ac4901;hpb=7272ac84c7d497fc42f5fe7bc626752941a86666;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 78f719c..8c14142 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ using System; using Tizen.NUI.BaseComponents; using System.ComponentModel; +using System.Runtime.InteropServices; +using Tizen.NUI.Binding; namespace Tizen.NUI { @@ -24,172 +26,337 @@ namespace Tizen.NUI /// /// Layers provide a mechanism for overlaying groups of actors on top of each other. /// + /// 3 public class Layer : Container { private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private Window window; - internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Layer_SWIGUpcast(cPtr), cMemoryOwn) + /// + /// Creates a Layer object. + /// + /// 3 + public Layer() : this(Interop.Layer.Layer_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (Window.Instance != null) + { + this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft); + this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions); + } + } + + internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Layer.Layer_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Layer obj) + /// + /// Enumeration for the behavior of the layer. + /// + /// 3 + public enum LayerBehavior { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + /// + /// UI control rendering mode (default mode). + /// This mode is designed for UI controls that can overlap. In this + /// mode renderer order will be respective to the tree hierarchy of + /// Actors.
+ /// The rendering order is depth first, so for the following actor tree, + /// A will be drawn first, then B, D, E, then C, F. This ensures that + /// overlapping actors are drawn as expected (whereas, with breadth first + /// traversal, the actors would interleave).
+ ///
+ /// 3 + LayerUI, + + /// + /// UI control rendering mode. + /// + /// 3 + Layer2D = LayerUI, + + /// + /// Layer will use depth test. + /// This mode is designed for a 3 dimensional scene where actors in front + /// of other actors will obscure them, i.e. the actors are sorted by the + /// distance from the camera.
+ /// When using this mode, a depth test will be used. A depth clear will + /// happen for each layer, which means actors in a layer "above" other + /// layers will be rendered in front of actors in those layers regardless + /// of their Z positions (see Layer::Raise() and Layer::Lower()).
+ /// Opaque renderers are drawn first and write to the depth buffer. Then + /// transparent renderers are drawn with depth test enabled but depth + /// write switched off. Transparent renderers are drawn based on their + /// distance from the camera. A renderer's DEPTH_INDEX property is used to + /// offset the distance to the camera when ordering transparent renderers. + /// This is useful if you want to define the draw order of two or more + /// transparent renderers that are equal distance from the camera. Unlike + /// LAYER_UI, parent-child relationship does not affect rendering order at + /// all. + ///
+ /// 3 + Layer3D } - /// From the Container base class. + internal enum TreeDepthMultiplier + { + TREE_DEPTH_MULTIPLIER = 10000 + } /// - /// Adds a child view to this layer. + /// Layer behavior, type String (Layer.LayerBehavior). /// - /// - /// - /// 4 - public override void Add(View child) + /// 3 + public Layer.LayerBehavior Behavior { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - Children.Add(child); + get + { + return GetBehavior(); + } + set + { + SetBehavior(value); + } } /// - /// Removes a child view from this layer. If the view was not a child of this layer, this is a no-op. + /// Sets the viewport (in window coordinates), type rectangle. + /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true. /// - /// - /// /// 4 - public override void Remove(View child) + public Rectangle Viewport { - NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - Children.Remove(child); + get + { + if (ClippingEnabled) + { + Rectangle ret = new Rectangle(Interop.Layer.Layer_GetClippingBox(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + else + { + // Clipping not enabled so return the window size + Size2D windowSize = window?.Size; + Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height); + return ret; + } + } + set + { + Interop.Layer.Layer_SetClippingBox__SWIG_1(swigCPtr, Rectangle.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + ClippingEnabled = true; + } } /// - /// Retrieves a child view by the index. + /// Retrieves and sets the layer's opacity.
///
- ///
The view has been initialized.
- /// The index of the child to retrieve. - /// The view for the given index or empty handle if children not initialized. - /// 4 - public override View GetChildAt(uint index) + /// 3 + public float Opacity { - if (index < Children.Count) + get { - return Children[Convert.ToInt32(index)]; + float temp = 0.0f; + GetProperty(View.Property.OPACITY).Get(out temp); + return temp; } - else + set { - return null; + SetProperty(View.Property.OPACITY, new Tizen.NUI.PropertyValue(value)); } } + /// + /// Retrieves and sets the layer's visibility. + /// + /// 3 + public bool Visibility + { + get + { + bool temp = false; + GetProperty(View.Property.VISIBLE).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.VISIBLE, new Tizen.NUI.PropertyValue(value)); + } + } /// - /// Get parent of the layer. + /// Get the number of children held by the layer. /// - /// The view's container /// 3 - public override Container GetParent() + public new uint ChildCount { - return null; + get + { + return Convert.ToUInt32(Children.Count); + } } /// - /// Get the child count of the layer. + /// Gets or sets the layer's name. /// - /// The child count of the layer. /// 3 - public override uint GetChildCount() + public string Name { - return Convert.ToUInt32(Children.Count); + get + { + return GetName(); + } + set + { + SetName(value); + } } /// - /// Dispose. + /// Queries the depth of the layer.
+ /// 0 is the bottommost layer, higher number is on the top.
///
/// 3 - protected override void Dispose(DisposeTypes type) + public uint Depth { - if(disposed) + get { - return; + return GetDepth(); } + } - if(type == DisposeTypes.Explicit) + /// + /// Internal only property to enable or disable clipping, type boolean. + /// By default, this is false, i.e., the viewport of the layer is the entire window. + /// + internal bool ClippingEnabled + { + get { - //Called by User - //Release your own managed resources here. - //You should release all of your own disposable objects here. + bool ret = Interop.Layer.Layer_IsClipping(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + set + { + Interop.Layer.Layer_SetClipping(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } - //Release your own unmanaged resources here. - //You should not access any managed member here except static instance. - //because the execution order of Finalizes is non-deterministic. + /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public ResourceDictionary XamlResources + { + get + { + return Application.Current.XamlResources; + } + set + { + Application.Current.XamlResources = value; + } + } - if (swigCPtr.Handle != global::System.IntPtr.Zero) + /// From the Container base class. + + /// + /// Adds a child view to this layer. + /// + /// + /// + /// 4 + public override void Add(View child) + { + Container oldParent = child.GetParent(); + + if (oldParent != this) { - if (swigCMemOwn) + if (oldParent != null) { - swigCMemOwn = false; - NDalicPINVOKE.delete_Layer(swigCPtr); + oldParent.Remove(child); } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + else + { + child.InternalParent = this; + } + Interop.Actor.Actor_Add( swigCPtr , View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Children.Add(child); + BindableObject.SetInheritedBindingContext(child, this?.BindingContext); } - - base.Dispose(type); - } - - internal class Property + /// + /// Removes a child view from this layer. If the view was not a child of this layer, this is a no-op. + /// + /// + /// + /// 4 + public override void Remove(View child) { - internal static readonly int BEHAVIOR = NDalicPINVOKE.Layer_Property_BEHAVIOR_get(); + Interop.Actor.Actor_Remove( swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + Children.Remove(child); + child.InternalParent = null; } /// - /// Creates a Layer object. + /// Retrieves a child view by the index. /// - /// 3 - public Layer() : this(NDalicPINVOKE.Layer_New(), true) + ///
The view has been initialized.
+ /// The index of the child to retrieve. + /// The view for the given index or empty handle if children not initialized. + /// 4 + public override View GetChildAt(uint index) { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if(Window.Instance != null) + if (index < Children.Count) { - this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft); - this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions); + return Children[Convert.ToInt32(index)]; + } + else + { + return null; } } - internal void SetAnchorPoint(Vector3 anchorPoint) + + /// + /// Get parent of the layer. + /// + /// The view's container + /// 4 + public override Container GetParent() { - NDalicPINVOKE.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return null; } - internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension) + + /// + /// Get the child count of the layer. + /// + /// The child count of the layer. + /// 4 + public override uint GetChildCount() { - NDalicPINVOKE.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return Convert.ToUInt32(Children.Count); } - /// /// Downcasts a handle to layer handle. /// /// 3 /// Please do not use! this will be deprecated! /// Instead please use as keyword. - [Obsolete("Please DO NOT use! This will be deprecated, instead please USE as keyword.")] + [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead!")] [EditorBrowsable(EditorBrowsableState.Never)] public static Layer DownCast(BaseHandle handle) { - Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer; + Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -204,31 +371,36 @@ namespace Tizen.NUI /// 3 public View FindChildById(uint id) { - IntPtr cPtr = NDalicPINVOKE.Actor_FindChildById(swigCPtr, id); - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + //to fix memory leak issue, match the handle count with native side. + IntPtr cPtr = Interop.Actor.Actor_FindChildById(swigCPtr, id); + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + Interop.BaseHandle.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - /// - /// Queries the depth of the layer.
- /// 0 is the bottommost layer, higher number is on the top.
- ///
- /// 3 - public uint Depth + internal override View FindCurrentChildById(uint id) { - get - { - return GetDepth(); - } + return FindChildById(id); } - internal uint GetDepth() + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public View FindChildByName(string viewName) { - uint ret = NDalicPINVOKE.Layer_GetDepth(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + //to fix memory leak issue, match the handle count with native side. + IntPtr cPtr = Interop.Actor.Actor_FindChildByName(swigCPtr, viewName); + HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View; + Interop.BaseHandle.delete_BaseHandle(CPtr); + CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -238,30 +410,36 @@ namespace Tizen.NUI /// 3 public void Raise() { - NDalicPINVOKE.Layer_Raise(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + var parentChildren = window?.LayersChildren; + if (parentChildren != null) + { + int currentIdx = parentChildren.IndexOf(this); + + if (currentIdx >= 0 && currentIdx < parentChildren.Count - 1) + { + var upper = parentChildren[currentIdx + 1]; + RaiseAbove(upper); + } + } } /// /// Decrements the depth of the layer. /// /// 3 - public void Lower() - { - NDalicPINVOKE.Layer_Lower(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal void RaiseAbove(Layer target) - { - NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal void LowerBelow(Layer target) + public void Lower() { - NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + var parentChildren = window?.LayersChildren; + if (parentChildren != null) + { + int currentIdx = parentChildren.IndexOf(this); + + if (currentIdx > 0 && currentIdx < parentChildren.Count) + { + var low = parentChildren[currentIdx - 1]; + LowerBelow(low); + } + } } /// @@ -270,8 +448,16 @@ namespace Tizen.NUI /// 3 public void RaiseToTop() { - NDalicPINVOKE.Layer_RaiseToTop(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + var parentChildren = window?.LayersChildren; + + if (parentChildren != null) + { + parentChildren.Remove(this); + parentChildren.Add(this); + + Interop.Layer.Layer_RaiseToTop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } } /// @@ -280,8 +466,17 @@ namespace Tizen.NUI /// 3 public void LowerToBottom() { - NDalicPINVOKE.Layer_LowerToBottom(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + var parentChildren = window?.LayersChildren; + + if (parentChildren != null) + { + parentChildren.Remove(this); + parentChildren.Insert(0, this); + + Interop.Layer.Layer_LowerToBottom(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } /// @@ -292,7 +487,7 @@ namespace Tizen.NUI /// 3 public void MoveAbove(Layer target) { - NDalicPINVOKE.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target)); + Interop.Layer.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -304,250 +499,234 @@ namespace Tizen.NUI /// 3 public void MoveBelow(Layer target) { - NDalicPINVOKE.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target)); + Interop.Layer.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - private void SetBehavior(LayerBehavior behavior) + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Layer obj) { - NDalicPINVOKE.Layer_SetBehavior(swigCPtr, (int)behavior); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - private LayerBehavior GetBehavior() + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetAnchorPoint(Vector3 anchorPoint) { - Layer.LayerBehavior ret = (Layer.LayerBehavior)NDalicPINVOKE.Layer_GetBehavior(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + Interop.Actor.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetSize(float width, float height) + { + Interop.ActorInternal.Actor_SetSize__SWIG_0(swigCPtr, width, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetParentOrigin(Vector3 parentOrigin) + { + Interop.ActorInternal.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(parentOrigin)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetResizePolicy(ResizePolicyType policy, DimensionType dimension) + { + Interop.Actor.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal uint GetDepth() + { + var parentChildren = window?.LayersChildren; + if (parentChildren != null) + { + int idx = parentChildren.IndexOf(this); + if (idx >= 0) + { + return Convert.ToUInt32(idx); ; + } + } + return 0u; + } + internal void RaiseAbove(Layer target) + { + var parentChildren = window?.LayersChildren; + if (parentChildren != null) + { + int currentIndex = parentChildren.IndexOf(this); + int targetIndex = parentChildren.IndexOf(target); + + if (currentIndex < 0 || targetIndex < 0 || + currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count) + { + NUILog.Error("index should be bigger than 0 and less than children of layer count"); + return; + } + + // If the currentIndex is less than the target index and the target has the same parent. + if (currentIndex < targetIndex) + { + parentChildren.Remove(this); + parentChildren.Insert(targetIndex, this); + + Interop.Layer.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + } + + internal void LowerBelow(Layer target) + { + var parentChildren = window?.LayersChildren; + + if (parentChildren != null) + { + int currentIndex = parentChildren.IndexOf(this); + int targetIndex = parentChildren.IndexOf(target); + + if (currentIndex < 0 || targetIndex < 0 || + currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count) + { + NUILog.Error("index should be bigger than 0 and less than children of layer count"); + return; + } + + // If the currentIndex is not already the 0th index and the target has the same parent. + if ((currentIndex != 0) && (targetIndex != -1) && + (currentIndex > targetIndex)) + { + parentChildren.Remove(this); + parentChildren.Insert(targetIndex, this); + + Interop.Layer.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function) { - NDalicPINVOKE.Layer_SetSortFunction(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function)); + Interop.Layer.Layer_SetSortFunction(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal void SetTouchConsumed(bool consume) { - NDalicPINVOKE.Layer_SetTouchConsumed(swigCPtr, consume); + Interop.Layer.Layer_SetTouchConsumed(swigCPtr, consume); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal bool IsTouchConsumed() { - bool ret = NDalicPINVOKE.Layer_IsTouchConsumed(swigCPtr); + bool ret = Interop.Layer.Layer_IsTouchConsumed(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal void SetHoverConsumed(bool consume) { - NDalicPINVOKE.Layer_SetHoverConsumed(swigCPtr, consume); + Interop.Layer.Layer_SetHoverConsumed(swigCPtr, consume); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal bool IsHoverConsumed() { - bool ret = NDalicPINVOKE.Layer_IsHoverConsumed(swigCPtr); + bool ret = Interop.Layer.Layer_IsHoverConsumed(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - /// - /// Enumeration for the behavior of the layer. - /// - /// 3 - public enum LayerBehavior + internal void AddViewToLayerList(View view) { - /// - /// UI control rendering mode. - /// - /// 3 - Layer2D, - /// - /// UI control rendering mode (default mode). - /// This mode is designed for UI controls that can overlap. In this - /// mode renderer order will be respective to the tree hierarchy of - /// Actors.
- /// The rendering order is depth first, so for the following actor tree, - /// A will be drawn first, then B, D, E, then C, F. This ensures that - /// overlapping actors are drawn as expected (whereas, with breadth first - /// traversal, the actors would interleave).
- ///
- /// 3 - LayerUI = Layer2D, - /// - /// Layer will use depth test. - /// This mode is designed for a 3 dimensional scene where actors in front - /// of other actors will obscure them, i.e. the actors are sorted by the - /// distance from the camera.
- /// When using this mode, a depth test will be used. A depth clear will - /// happen for each layer, which means actors in a layer "above" other - /// layers will be rendered in front of actors in those layers regardless - /// of their Z positions (see Layer::Raise() and Layer::Lower()).
- /// Opaque renderers are drawn first and write to the depth buffer. Then - /// transparent renderers are drawn with depth test enabled but depth - /// write switched off. Transparent renderers are drawn based on their - /// distance from the camera. A renderer's DEPTH_INDEX property is used to - /// offset the distance to the camera when ordering transparent renderers. - /// This is useful if you want to define the draw order of two or more - /// transparent renderers that are equal distance from the camera. Unlike - /// LAYER_UI, parent-child relationship does not affect rendering order at - /// all. - ///
- /// 3 - Layer3D + Children.Add(view); } - internal enum TreeDepthMultiplier + internal void RemoveViewFromLayerList(View view) { - TREE_DEPTH_MULTIPLIER = 10000 + Children.Remove(view); } - /// - /// Layer behavior, type String (Layer.LayerBehavior). - /// - /// 3 - public Layer.LayerBehavior Behavior + internal string GetName() { - get - { - return GetBehavior(); - } - set - { - SetBehavior(value); - } + string ret = Interop.Actor.Actor_GetName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - /// - /// Internal only property to enable or disable clipping, type boolean. - /// By default, this is false, i.e., the viewport of the layer is the entire window. - /// - internal bool ClippingEnabled + internal void SetName(string name) { - get - { - bool ret = NDalicPINVOKE.Layer_IsClipping(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - set - { - NDalicPINVOKE.Layer_SetClipping(swigCPtr, value); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } + Interop.Actor.Actor_SetName(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Sets the viewport (in window coordinates), type rectangle. - /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true. - /// - /// 4 - public Rectangle Viewport + internal void SetWindow(Window win) { - get - { - if( ClippingEnabled ) - { - Rectangle ret = new Rectangle(NDalicPINVOKE.Layer_GetClippingBox(swigCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - else - { - // Clipping not enabled so return the window size - Size2D windowSize = Window.Instance.Size; - Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height); - return ret; - } - } - set - { - NDalicPINVOKE.Layer_SetClippingBox__SWIG_1(swigCPtr, Rectangle.getCPtr(value)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - ClippingEnabled = true; - } + window = win; } /// - /// Retrieves and sets the layer's opacity.
+ /// Dispose. ///
/// 3 - public float Opacity + protected override void Dispose(DisposeTypes type) { - get - { - float temp = 0.0f; - GetProperty(View.Property.OPACITY).Get(out temp); - return temp; - } - set + if (disposed) { - SetProperty(View.Property.OPACITY, new Tizen.NUI.PropertyValue(value)); + return; } - } - /// - /// Retrieves and sets the layer's visibility. - /// - /// 3 - public bool Visibility - { - get - { - bool temp = false; - GetProperty(View.Property.VISIBLE).Get(out temp); - return temp; - } - set + if (type == DisposeTypes.Explicit) { - SetProperty(View.Property.VISIBLE, new Tizen.NUI.PropertyValue(value)); + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. } - } - /// - /// Get the number of children held by the layer. - /// - /// 3 - public new uint ChildCount - { - get + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) { - return Convert.ToUInt32(Children.Count); + if (swigCMemOwn) + { + swigCMemOwn = false; + Interop.Layer.delete_Layer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } + + base.Dispose(type); + } - /// - /// Gets or sets the layer's name. - /// - /// 3 - public string Name + private void SetBehavior(LayerBehavior behavior) { - get - { - return GetName(); - } - set - { - SetName(value); - } + Interop.Layer.Layer_SetBehavior(swigCPtr, (int)behavior); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal string GetName() + private LayerBehavior GetBehavior() { - string ret = NDalicPINVOKE.Actor_GetName(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Layer.LayerBehavior ret = (Layer.LayerBehavior)Interop.Layer.Layer_GetBehavior(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal void SetName(string name) + internal class Property { - NDalicPINVOKE.Actor_SetName(swigCPtr, name); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + internal static readonly int BEHAVIOR = Interop.Layer.Layer_Property_BEHAVIOR_get(); } - } } \ No newline at end of file