X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FLayer.cs;h=f4aaa35abc5822d90cfa915b731ac258fad6ecbd;hb=bf0dc32c2ce4f0169fae2157907a81cb253c5a71;hp=6bef8bfe35a7c5fc665953eca0f355c791211cfc;hpb=7e3eafcc5e174f53360bb47fed87b48e42b8c72b;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 6bef8bf..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
@@ -336,6 +348,55 @@ namespace Tizen.NUI
}
///
+ /// Internal only property to Enable/Disable Clipping, type Boolean.
+ /// By default this is false, i.e. the viewport of the Layer is the entire window.
+ ///
+ internal bool ClippingEnabled
+ {
+ 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();
+ }
+ }
+
+ ///
+ /// Sets the Viewport (in window coordinates), type Rectangle.
+ /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true.
+ ///
+ public Rectangle Viewport
+ {
+ 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;
+ }
+ }
+
+ ///
/// Retrieves and sets the Layer's opacity.
///
public float Opacity
@@ -412,5 +473,6 @@ namespace Tizen.NUI
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+
}
}