using System;
using System.Runtime.InteropServices;
-
-
/// <summary>
/// View is the base class for all views.
/// </summary>
- public class View : Animatable //CustomActor => Animatable
+ public class View : 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 View.
+ /// </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 View. If the view was not a child of this view, this is a no-op.
+ /// </summary>
+ /// <seealso cref="Container::Remove()">
+ /// </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>
+ /// <seealso cref="Container::GetChildAt()">
+ /// </seealso>
+ public override View GetChildAt(uint index)
+ {
+ 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;
+ }
+
+ /// <summary>
+ /// Retrieves the number of children held by the view.
+ /// </summary>
+ /// <seealso cref="Container::GetChildCount()">
+ /// </seealso>
+ protected override uint GetChildCount()
+ {
+ uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Get the Views parent
+ /// </summary>
+ /// <seealso cref="Container::GetParent()">
+
+ protected override Container GetParent()
+ {
+ Container ret;
+ IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
+
+ BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr);
+
+ if(basehandle is Layer)
+ {
+ ret = basehandle as Layer;
+ }
+ else
+ {
+ ret = basehandle as View;
+ }
+
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ ///
+
// you can override it to clean-up your own resources.
protected override void Dispose(DisposeTypes type)
{
{
View view = null;
- if (Parent)
+ if (Parent is View)
{
- view = Parent.FindChildById(id);
+ View parentView = Parent as View;
+ view = parentView.FindChildById(id);
}
if (!view)
}
}
- /// <summary>
- /// Retrieves the view's parent.<br>
- /// </summary>
- public View Parent
- {
- get
- {
- return GetParent();
- }
- }
-
public bool Visibility
{
get
}
/// <summary>
- /// Adds a child view to this View.
- /// </summary>
- /// <pre>This View(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.</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 view. This may change child's position, color, scale etc as it now inherits them from this view.</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();
- }
-
- /// <summary>
- /// Removes a child View from this View. If the view was not a child of this view, this is a no-op.
- /// </summary>
- /// <pre>This View(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();
- }
-
- /// <summary>
/// Removes a View from its Parent View / Layer. If the View has no parent, this method does nothing.
/// </summary>
/// <pre>The (child) View has been initialized. </pre>
}
/// <summary>
- /// Retrieves the number of children held by the view.
- /// </summary>
- /// <pre>The View has been initialized.</pre>
- /// <returns>The number of children</returns>
- internal uint GetChildCount()
- {
- uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// <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)
- {
- 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;
- }
-
- /// <summary>
/// Search through this view's hierarchy for an view with the given name.
/// The view itself is also considered in the search.
/// </summary>
return ret;
}
- internal View GetParent()
- {
- View ret;
- IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
-
- BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr);
-
- if(basehandle is Layer)
- {
- ret = new View(cPtr,false);
- }
- else
- {
- ret = basehandle as View;
- }
-
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
internal void SetParentOrigin(Vector3 origin)
{
NDalicPINVOKE.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin));
}
/// <summary>
- /// Get the number of children held by the view.
- /// </summary>
- public uint ChildCount
- {
- get
- {
- return GetChildCount();
- }
- }
-
- /// <summary>
/// Gets the View's ID.
/// Readonly
/// </summary>
--- /dev/null
+/** Copyright (c) 2017 Samsung Electronics Co., Ltd.\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+using System;\r
+using Tizen.NUI.BaseComponents;\r
+\r
+namespace Tizen.NUI\r
+{\r
+ /// <summary>\r
+ ///\r
+ /// Container is an abstract class to be inherited from by classes that desire to have Views\r
+ /// added to them.\r
+ ///\r
+ /// </summary>\r
+\r
+ public abstract class Container : Animatable\r
+ {\r
+\r
+ internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)\r
+ {\r
+ // No un-managed data hence no need to store a native ptr\r
+ }\r
+\r
+ protected override void Dispose(DisposeTypes type)\r
+ {\r
+ if (disposed)\r
+ {\r
+ return;\r
+ }\r
+\r
+ base.Dispose(type);\r
+ }\r
+\r
+\r
+ /// <summary>\r
+ /// Adds a child view to this Container.\r
+ /// </summary>\r
+ /// <pre>This Container(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.</pre>\r
+ /// <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>\r
+ /// <remarks>If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view.</remarks>\r
+ /// <param name="view">The child view to add</param>\r
+ public abstract void Add( View view );\r
+\r
+ /// <summary>\r
+ /// Removes a child View from this View. If the view was not a child of this view, this is a no-op.\r
+ /// </summary>\r
+ /// <pre>This View(the parent) has been initialized. The child view is not the same as the parent view.</pre>\r
+ /// <param name="child">The child</param>\r
+ public abstract void Remove( View view );\r
+\r
+ /// <summary>\r
+ /// Retrieves child view by index.\r
+ /// </summary>\r
+ /// <pre>The View has been initialized.</pre>\r
+ /// <param name="index">The index of the child to retrieve</param>\r
+ /// <returns>The view for the given index or empty handle if children not initialized</returns>\r
+ public abstract View GetChildAt( uint index );\r
+\r
+ /// <summary>\r
+ /// Get the parent of this container\r
+ /// </summary>\r
+ /// <pre>The child container has been initialized.</pre>\r
+ /// <returns>The parent container</returns>\r
+ protected abstract Container GetParent();\r
+\r
+ /// <summary>\r
+ /// Get the number of children for this container\r
+ /// </summary>\r
+ /// <pre>The container has been initialized.</pre>\r
+ /// <returns>number of children</returns>\r
+ protected abstract UInt32 GetChildCount();\r
+\r
+ /// <summary>\r
+ /// Get the parent Container\r
+ /// Read only\r
+ /// </summary>\r
+ /// <pre>The child container has been initialized.</pre>\r
+ /// <returns>The parent container</returns>\r
+ public Container Parent\r
+ {\r
+ get\r
+ {\r
+ return GetParent();\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Get the number of children for this container\r
+ /// Read only\r
+ /// </summary>\r
+ /// <pre>The container has been initialized.</pre>\r
+ /// <returns>number of children</returns>\r
+ public uint ChildCount\r
+ {\r
+ get\r
+ {\r
+ return GetChildCount();\r
+ }\r
+ }\r
+ }\r
+} // namespace Tizen.NUI
\ No newline at end of file
/// <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)
}
/// <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();
- }
-
- /// <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();
- }
-
- /// <summary>
/// Queries the depth of the layer.<br>
/// 0 is the bottom most layer, higher number is on top.<br>
/// </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);
-
- View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
-
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- return ret ?? null;
- }
-
- /// <summary>
/// Enumeration for the behavior of the layer.
/// </summary>
public enum LayerBehavior
SetProperty(View.Property.VISIBLE, new Tizen.NUI.PropertyValue(value));
}
}
-
- /// <summary>
- /// Get the number of children held by the layer.
- /// </summary>
- public uint ChildCount
- {
- get
- {
- uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- }
}
}