using System;
using Tizen.NUI.BaseComponents;
using System.ComponentModel;
+using System.Runtime.InteropServices;
namespace Tizen.NUI
{
{
private Window window;
private int layoutCount = 0;
+ private EventHandler<VisibilityChangedEventArgs> visibilityChangedEventHandler;
+ private VisibilityChangedEventCallbackType visibilityChangedEventCallback;
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate void VisibilityChangedEventCallbackType(IntPtr data, bool visibility, VisibilityChangeType type);
/// <summary>
/// Creates a Layer object.
return;
}
+ if (visibilityChangedEventCallback != null)
+ {
+ NUILog.Debug($"[Dispose] visibilityChangedEventCallback");
+
+ Interop.ActorSignal.VisibilityChangedDisconnect(GetBaseHandleCPtrHandleRef, visibilityChangedEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExistsDebug();
+ visibilityChangedEventCallback = null;
+ }
+
LayoutCount = 0;
base.Dispose(type);
Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this layer.");
return;
}
+ // If the view had focus, it clears focus.
+ if (child == FocusManager.Instance.GetCurrentFocusView())
+ {
+ FocusManager.Instance.ClearFocus();
+ }
+
Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
/// </summary>
/// <returns>The child count of the layer.</returns>
/// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API9, will be removed in API11. Please use ChildCount property instead!")]
+ [Obsolete("This has been deprecated in API9 and will be removed in API11. Use ChildCount property instead")]
public override uint GetChildCount()
{
return Convert.ToUInt32(Children.Count);
/// </summary>
/// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
/// <since_tizen> 3 </since_tizen>
- /// Please do not use! this will be deprecated!
- /// Instead please use as keyword.
- [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead!")]
+ /// Do not use this, that will be deprecated. Use as keyword instead.
+ [Obsolete("Do not use this, that will be deprecated. Use as keyword instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static Layer DownCast(BaseHandle handle)
{
/// <since_tizen> 3 </since_tizen>
public void MoveAbove(Layer target)
{
- Interop.Layer.MoveAbove(SwigCPtr, Layer.getCPtr(target));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ RaiseAbove(target);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public void MoveBelow(Layer target)
{
- Interop.Layer.MoveBelow(SwigCPtr, Layer.getCPtr(target));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ LowerBelow(target);
}
/// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+ /// <summary>
+ /// An event for visibility change which can be used to subscribe or unsubscribe the event handler.<br />
+ /// This signal is emitted when the visible property of this or a parent view is changed.<br />
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<VisibilityChangedEventArgs> VisibilityChanged
+ {
+ add
+ {
+ if (visibilityChangedEventHandler == null)
+ {
+ visibilityChangedEventCallback = OnVisibilityChanged;
+ Interop.ActorSignal.VisibilityChangedConnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ }
+ visibilityChangedEventHandler += value;
+ }
+
+ remove
+ {
+ visibilityChangedEventHandler -= value;
+ if (visibilityChangedEventHandler == null && visibilityChangedEventCallback != null)
+ {
+ Interop.ActorSignal.VisibilityChangedDisconnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ visibilityChangedEventCallback = null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Event arguments of visibility changed.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class VisibilityChangedEventArgs : EventArgs
+ {
+ private Layer layer;
+ private bool visibility;
+
+ /// <summary>
+ /// The layer whose visibility has changed.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Layer Layer
+ {
+ get
+ {
+ return layer;
+ }
+ set
+ {
+ layer = value;
+ }
+ }
+
+ /// <summary>
+ /// Whether the layer is now visible or not.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Visibility
+ {
+ get
+ {
+ return visibility;
+ }
+ set
+ {
+ visibility = value;
+ }
+ }
+ }
+
internal uint GetDepth()
{
var parentChildren = window?.LayersChildren;
{
internal static readonly int BEHAVIOR = Interop.Layer.BehaviorGet();
}
+
+ // Callback for View visibility change signal
+ // type is not used because layer does not have parent so layer's visibility cannot be changed by its parent.
+ private void OnVisibilityChanged(IntPtr data, bool visibility, VisibilityChangeType type)
+ {
+ VisibilityChangedEventArgs e = new VisibilityChangedEventArgs();
+ if (data != IntPtr.Zero)
+ {
+ e.Layer = Registry.GetManagedBaseHandleFromNativePtr(data) as Layer;
+ }
+ e.Visibility = visibility;
+
+ if (visibilityChangedEventHandler != null)
+ {
+ visibilityChangedEventHandler(this, e);
+ }
+ }
}
}