namespace Tizen.NUI
{
+ using System;
using Tizen.NUI.BaseComponents;
/// <summary>
/// Layers provide a mechanism for overlaying groups of actors on top of each other.
/// </summary>
- public class Layer : Animatable
+ public class Layer : Container
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
+ /// from Container base class
+
+ /// <summary>
+ /// Adds a child view to this layer.
+ /// </summary>
+ /// <seealso cref="Container::Add()">
+ /// </seealso>
+ public override void Add(View child)
+ {
+ NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op.
+ /// </summary>
+ /// <seealso cref="Container::Add()">
+ /// </seealso>
+ public override void Remove(View child)
+ {
+ NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Retrieves child view by index.
+ /// </summary>
+ /// <pre>The View has been initialized.</pre>
+ /// <param name="index">The index of the child to retrieve</param>
+ /// <returns>The view for the given index or empty handle if children not initialized</returns>
+ 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)
+ if(disposed)
{
return;
}
- if (type == DisposeTypes.Explicit)
+ if(type == DisposeTypes.Explicit)
{
//Called by User
//Release your own managed resources here.
public Layer() : this(NDalicPINVOKE.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);
+ }
}
- /// <summary>
- /// Downcasts a handle to Layer handle.<br>
- /// If handle points to a Layer, the downcast produces valid handle.<br>
- /// If not, the returned handle is left uninitialized.<br>
- /// </summary>
- /// <param name="handle">Handle to an object</param>
- /// <returns>Handle to a Layer or an uninitialized handle</returns>
- internal new static Layer DownCast(BaseHandle handle)
+ internal void SetAnchorPoint(Vector3 anchorPoint)
+ {
+ NDalicPINVOKE.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
+ {
+ NDalicPINVOKE.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+
+
+ [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;
}
/// <returns> A handle to the view if found, or an empty handle if not. </returns>
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;
- }
-
- /// <summary>
- /// Adds a child view to this layer.
- /// </summary>
- /// <pre>This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.</pre>
- /// <post>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.</post>
- /// <remarks>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.</remarks>
- /// <param name="child">The child</param>
- 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;
- /// <summary>
- /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op.
- /// </summary>
- /// <pre>This layer(the parent) has been initialized. The child view is not the same as the parent view.</pre>
- /// <param name="child">The child</param>
- public void Remove(View child)
- {
- NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
/// <summary>
}
/// <summary>
- /// Retrieves child view by index.
- /// </summary>
- /// <pre>The View has been initialized.</pre>
- /// <param name="index">The index of the child to retrieve</param>
- /// <returns>The view for the given index or empty handle if children not initialized</returns>
- public View GetChildAt(uint index)
- {
- System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index);
- cPtr = NDalicPINVOKE.View_SWIGUpcast(cPtr);
- cPtr = NDalicPINVOKE.Handle_SWIGUpcast(cPtr);
-
- BaseHandle ret = new BaseHandle(cPtr, false);
-
- View temp = ViewRegistry.GetViewFromBaseHandle(ret);
-
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- return temp ?? null;
- }
-
- /// <summary>
/// Enumeration for the behavior of the layer.
/// </summary>
public enum LayerBehavior
}
/// <summary>
+ /// 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.
+ /// </summary>
+ 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();
+ }
+ }
+
+ /// <summary>
+ /// Sets the Viewport (in window coordinates), type Rectangle.
+ /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true.
+ /// </summary>
+ 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;
+ }
+ }
+
+ /// <summary>
/// Retrieves and sets the Layer's opacity.<br>
/// </summary>
public float Opacity
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
- }\r
-\r
- /// <summary>\r
- /// Gets/Sets the Layer's name.\r
- /// </summary>\r
- public string Name\r
- {\r
- get\r
- {\r
- return GetName();\r
- }\r
- set\r
- {\r
- SetName(value);\r
- }\r
- }\r
-\r
- internal string GetName()\r
- {\r
- string ret = NDalicPINVOKE.Actor_GetName(swigCPtr);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending)\r
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
- internal void SetName(string name)\r
- {\r
- NDalicPINVOKE.Actor_SetName(swigCPtr, name);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending)\r
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- }\r
+ }
+
+ /// <summary>
+ /// Gets/Sets the Layer's name.
+ /// </summary>
+ 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();
+ }
+
}
}