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();
- }
- }
-
[Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")]
public bool Visible
{
}
/// <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));
}
}
+ [Obsolete("Please DO NOT use! This will be deprecated! Please use 'Container GetParent()' instead!")]
+ public View Parent
+ {
+ get
+ {
+ 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;
+ }
+ }
+
+
--- /dev/null
+/** Copyright (c) 2017 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.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+using System;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI
+{
+ /// <summary>
+ ///
+ /// Container is an abstract class to be inherited from by classes that desire to have Views
+ /// added to them.
+ ///
+ /// </summary>
+
+ public abstract class Container : Animatable
+ {
+
+ internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ // No un-managed data hence no need to store a native ptr
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ base.Dispose(type);
+ }
+
+
+ /// <summary>
+ /// Adds a child view to this Container.
+ /// </summary>
+ /// <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>
+ /// <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="view">The child view to add</param>
+ public abstract void Add( View view );
+
+ /// <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 abstract void Remove( View view );
+
+ /// <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 abstract View GetChildAt( uint index );
+
+ /// <summary>
+ /// Get the parent of this container
+ /// </summary>
+ /// <pre>The child container has been initialized.</pre>
+ /// <returns>The parent container</returns>
+ protected abstract Container GetParent();
+
+ /// <summary>
+ /// Get the number of children for this container
+ /// </summary>
+ /// <pre>The container has been initialized.</pre>
+ /// <returns>number of children</returns>
+ protected abstract UInt32 GetChildCount();
+
+ /// <summary>
+ /// Get the parent Container
+ /// Read only
+ /// </summary>
+ /// <pre>The child container has been initialized.</pre>
+ /// <returns>The parent container</returns>
+ public Container Parent
+ {
+ get
+ {
+ return GetParent();
+ }
+ }
+
+ /// <summary>
+ /// Get the number of children for this container
+ /// Read only
+ /// </summary>
+ /// <pre>The container has been initialized.</pre>
+ /// <returns>number of children</returns>
+ public uint ChildCount
+ {
+ get
+ {
+ return GetChildCount();
+ }
+ }
+ }
+} // 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
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+
}
}