X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FLayer.cs;h=f4aaa35abc5822d90cfa915b731ac258fad6ecbd;hb=bf0dc32c2ce4f0169fae2157907a81cb253c5a71;hp=7888b5c8ce8509a71464ffcd2a4eaca2a62a1dc4;hpb=23a89104c29398a8edf1a2fffa49c0a001db60db;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 7888b5c..f4aaa35 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -22,7 +22,7 @@ namespace Tizen.NUI /// /// Layers provide a mechanism for overlaying groups of actors on top of each other. /// - public class Layer : Animatable + public class Layer : Container { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -36,6 +36,64 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + /// from Container base class + + /// + /// Adds a child view to this layer. + /// + /// + /// + public override void Add(View child) + { + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. + /// + /// + /// + public override void Remove(View child) + { + NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves child view by index. + /// + ///
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 + public override View GetChildAt(uint index) + { + System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + return ret ?? null; + } + + + protected override Container GetParent() + { + return null; + } + + protected override uint GetChildCount() + { + uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + protected override void Dispose(DisposeTypes type) { if(disposed) @@ -59,10 +117,6 @@ namespace Tizen.NUI if (swigCMemOwn) { swigCMemOwn = false; - - //Unreference this instance from Registry. - Registry.Unregister(this); - NDalicPINVOKE.delete_Layer(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); @@ -107,7 +161,7 @@ namespace Tizen.NUI [Obsolete("Please do not use! this will be deprecated")] public new static Layer DownCast(BaseHandle handle) { - Layer ret = new Layer(NDalicPINVOKE.Layer_DownCast(BaseHandle.getCPtr(handle)), true); + Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -121,36 +175,12 @@ namespace Tizen.NUI /// A handle to the view if found, or an empty handle if not. public View FindChildById(uint id) { - View ret = new View(NDalicPINVOKE.Actor_FindChildById(swigCPtr, id), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// Adds a child view to this layer. - /// - ///
This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.
- /// The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. - /// If the child already has a parent, it will be removed from old parent and reparented to this layer. This may change child's position, color, scale etc as it now inherits them from this layer. - /// The child - public void Add(View child) - { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } + IntPtr cPtr = NDalicPINVOKE.Actor_FindChildById(swigCPtr, id); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; - /// - /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. - /// - ///
This layer(the parent) has been initialized. The child view is not the same as the parent view.
- /// The child - public void Remove(View child) - { - NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// @@ -288,24 +318,6 @@ namespace Tizen.NUI } /// - /// Retrieves child view by index. - /// - ///
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 - public View GetChildAt(uint index) - { - System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); - - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; - - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - return ret ?? null; - } - - /// /// Enumeration for the behavior of the layer. /// public enum LayerBehavior @@ -431,5 +443,36 @@ namespace Tizen.NUI return ret; } } + + /// + /// Gets/Sets the Layer's name. + /// + public string Name + { + get + { + return GetName(); + } + set + { + SetName(value); + } + } + + internal string GetName() + { + string ret = NDalicPINVOKE.Actor_GetName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetName(string name) + { + NDalicPINVOKE.Actor_SetName(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } }