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)
{
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
+ if (_onRelayoutEventCallback != null)
+ {
+ this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback);
+ }
+
+ if (_offWindowEventCallback != null)
+ {
+ this.OffWindowSignal().Disconnect(_offWindowEventCallback);
+ }
+
+ if (_onWindowEventCallback != null)
+ {
+ this.OnWindowSignal().Disconnect(_onWindowEventCallback);
+ }
+
+ if (_wheelEventCallback != null)
+ {
+ this.WheelEventSignal().Disconnect(_wheelEventCallback);
+ }
+
+ if (_hoverEventCallback != null)
+ {
+ this.HoveredSignal().Disconnect(_hoverEventCallback);
+ }
+
+ if (_touchDataCallback != null)
+ {
+ this.TouchSignal().Disconnect(_touchDataCallback);
+ }
+
+ if (_ResourcesLoadedCallback != null)
+ {
+ this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback);
+ }
+
+ if (_offWindowEventCallback != null)
+ {
+ this.OffWindowSignal().Disconnect(_offWindowEventCallback);
+ }
+
+ if (_onWindowEventCallback != null)
+ {
+ this.OnWindowSignal().Disconnect(_onWindowEventCallback);
+ }
+
+ if (_wheelEventCallback != null)
+ {
+ this.WheelEventSignal().Disconnect(_wheelEventCallback);
+ }
+
+ if (_hoverEventCallback != null)
+ {
+ this.HoveredSignal().Disconnect(_hoverEventCallback);
+ }
+
+ if (_touchDataCallback != null)
+ {
+ this.TouchSignal().Disconnect(_touchDataCallback);
+ }
+
+ if (_onRelayoutEventCallback != null)
+ {
+ this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback);
+ }
+
+ if (_keyCallback != null)
+ {
+ this.KeyEventSignal().Disconnect(_keyCallback);
+ }
+
+ if (_keyInputFocusLostCallback != null)
+ {
+ this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback);
+ }
+
+ if (_keyInputFocusGainedCallback != null)
+ {
+ this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback);
+ }
+
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
/// </summary>
/// <param name="handle">Handle to an object</param>
/// <returns>A handle to a View or an uninitialized handle</returns>
+ [Obsolete("Please do not use! this will be deprecated, instead please use as keyword.")]
public new static View DownCast(BaseHandle handle)
{
- View ret = new View(NDalicPINVOKE.View_DownCast(BaseHandle.getCPtr(handle)), true);
+ View ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as View;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
- [Obsolete("Please do not use! this will be deprecated")]
+ [Obsolete("Please do not use! this will be deprecated, instead please use as keyword.")]
public static T DownCast<T>(View view) where T : View
{
- //View ret = ViewRegistry.GetViewFromBaseHandle(view);
- View ret = View.DownCast(view);
+ T ret = Registry.GetManagedBaseHandleFromNativePtr(view) as T;
if (ret != null)
{
- return (T)ret;
+ return ret;
}
return null;
}
{
View view = null;
- if (Parent)
+ if (Parent is View)
{
- view = Parent.FindChildById(id);
+ View parentView = Parent as View;
+ view = parentView.FindChildById(id);
}
if (!view)
}
}
- public bool Visibility
+ [Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")]
+ public bool Visible
{
get
{
}
}
- [Obsolete("Please do not use! this will be internal property")]
+ /// <summary>
+ /// Returns the natural size of the view.
+ /// </summary>
+ /// <remarks>
+ /// Deriving classes stipulate the natural size and by default a view has a ZERO natural size.
+ /// </remarks>
+ [Obsolete("Please do not use! this will be deprecated, please use NaturalSize2D instead")]
public Vector3 NaturalSize
{
get
}
/// <summary>
+ /// Returns the natural size (Size2D) of the view.
+ /// </summary>
+ /// <remarks>
+ /// Deriving classes stipulate the natural size and by default a view has a ZERO natural size.
+ /// </remarks>
+ public Size2D NaturalSize2D
+ {
+ get
+ {
+ Vector3 temp = new Vector3(NDalicPINVOKE.Actor_GetNaturalSize(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ return new Size2D((int)temp.Width, (int)temp.Height);
+ }
+ }
+
+ /// <summary>
/// Shows the View.
/// </summary>
/// <remarks>
internal Layer GetLayer()
{
- Layer ret = new Layer(NDalicPINVOKE.Actor_GetLayer(swigCPtr), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// <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();
- }
+ IntPtr cPtr = NDalicPINVOKE.Actor_GetLayer(swigCPtr);
+ Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer;
- internal void Unparent()
- {
- NDalicPINVOKE.Actor_Unparent(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
- /// <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.
+ /// Removes a View from its Parent View / Layer. If the View has no parent, this method does nothing.
/// </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)
+ /// <pre>The (child) View has been initialized. </pre>
+ public void Unparent()
{
- IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index);
-
- View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
-
+ NDalicPINVOKE.Actor_Unparent(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret ?? null;
}
/// <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 View GetParent()
{
+ View ret;
IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
- View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
+ BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr);
+
+ if(basehandle is Layer)
+ {
+ View ret2 = new View(cPtr,false);
+ return ret2;
+ }
+
+ ret = basehandle as View;
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
public Renderer GetRendererAt(uint index)
{
- Renderer ret = new Renderer(NDalicPINVOKE.Actor_GetRendererAt(swigCPtr, index), true);
+ IntPtr cPtr = NDalicPINVOKE.Actor_GetRendererAt(swigCPtr, index);
+ Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Renderer;
+
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
/// If an view is not visible, then the view and its children will not be rendered.
/// This is regardless of the individual visibility values of the children i.e.an view will only be rendered if all of its parents have visibility set to true.
/// </remarks>
- public bool Visible
+ public bool Visibility
{
get
{
bool temp = false;
GetProperty(View.Property.VISIBLE).Get(out temp);
return temp;
- }/* only get is required : removed
- set
- {
- SetProperty(View.Property.VISIBLE, new Tizen.NUI.PropertyValue(value));
- }*/
+ }
}
/// <summary>
}
/// <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>
}
}
- [Obsolete("Please do not use! this will be deprecated")]
+ [Obsolete("Please do not use! this will be deprecated, please use Size2D instead")]
public Size Size
{
get