2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using Tizen.NUI.BaseComponents;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
25 /// Layers provide a mechanism for overlaying groups of actors on top of each other.
27 /// <since_tizen> 3 </since_tizen>
28 public class Layer : Container
30 private Window window;
31 private int layoutCount = 0;
32 private EventHandler<VisibilityChangedEventArgs> visibilityChangedEventHandler;
33 private VisibilityChangedEventCallbackType visibilityChangedEventCallback;
34 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
35 private delegate void VisibilityChangedEventCallbackType(IntPtr data, bool visibility, VisibilityChangeType type);
38 /// Creates a Layer object.
40 /// <since_tizen> 3 </since_tizen>
41 public Layer() : this(Interop.Layer.New(), true)
43 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44 this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft);
45 this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions);
48 internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
53 /// Dispose Explicit or Implicit
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 protected override void Dispose(DisposeTypes type)
63 if (visibilityChangedEventCallback != null)
65 NUILog.Debug($"[Dispose] visibilityChangedEventCallback");
67 Interop.ActorSignal.VisibilityChangedDisconnect(GetBaseHandleCPtrHandleRef, visibilityChangedEventCallback.ToHandleRef(this));
68 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
69 visibilityChangedEventCallback = null;
78 /// Enumeration for the behavior of the layer.
80 /// <since_tizen> 3 </since_tizen>
81 public enum LayerBehavior
84 /// UI control rendering mode (default mode).
85 /// This mode is designed for UI controls that can overlap. In this
86 /// mode renderer order will be respective to the tree hierarchy of
88 /// The rendering order is depth first, so for the following actor tree,
89 /// A will be drawn first, then B, D, E, then C, F. This ensures that
90 /// overlapping actors are drawn as expected (whereas, with breadth first
91 /// traversal, the actors would interleave).<br />
93 /// <since_tizen> 3 </since_tizen>
97 /// Layer will use depth test.
98 /// This mode is designed for a 3 dimensional scene where actors in front
99 /// of other actors will obscure them, i.e. the actors are sorted by the
100 /// distance from the camera.<br />
101 /// When using this mode, a depth test will be used. A depth clear will
102 /// happen for each layer, which means actors in a layer "above" other
103 /// layers will be rendered in front of actors in those layers regardless
104 /// of their Z positions (see Layer::Raise() and Layer::Lower()).<br />
105 /// Opaque renderers are drawn first and write to the depth buffer. Then
106 /// transparent renderers are drawn with depth test enabled but depth
107 /// write switched off. Transparent renderers are drawn based on their
108 /// distance from the camera. A renderer's DEPTH_INDEX property is used to
109 /// offset the distance to the camera when ordering transparent renderers.
110 /// This is useful if you want to define the draw order of two or more
111 /// transparent renderers that are equal distance from the camera. Unlike
112 /// LAYER_UI, parent-child relationship does not affect rendering order at
115 /// <since_tizen> 3 </since_tizen>
119 internal enum TreeDepthMultiplier
121 TREE_DEPTH_MULTIPLIER = 10000
125 /// Layer behavior, type String (Layer.LayerBehavior).
127 /// <since_tizen> 3 </since_tizen>
128 public Layer.LayerBehavior Behavior
132 return GetBehavior();
141 /// Sets the viewport (in window coordinates), type rectangle.
142 /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true.
144 /// <since_tizen> 4 </since_tizen>
145 public Rectangle Viewport
151 Rectangle ret = new Rectangle(Interop.Layer.GetClippingBox(SwigCPtr), true);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
157 // Clipping not enabled so return the window size
158 Size2D windowSize = window?.Size;
159 Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height);
165 Interop.Layer.SetClippingBox(SwigCPtr, Rectangle.getCPtr(value));
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 ClippingEnabled = true;
172 /// Retrieves and sets the layer's opacity.<br />
174 /// <since_tizen> 3 </since_tizen>
180 var pValue = GetProperty(View.Property.OPACITY);
181 pValue.Get(out temp);
187 var temp = new Tizen.NUI.PropertyValue(value);
188 SetProperty(View.Property.OPACITY, temp);
194 /// Retrieves and sets the layer's visibility.
196 /// <since_tizen> 3 </since_tizen>
197 public bool Visibility
202 var pValue = GetProperty(View.Property.VISIBLE);
203 pValue.Get(out temp);
209 var temp = new Tizen.NUI.PropertyValue(value);
210 SetProperty(View.Property.VISIBLE, temp);
216 /// Get the number of children held by the layer.
218 /// <since_tizen> 3 </since_tizen>
219 public new uint ChildCount
223 return Convert.ToUInt32(Children.Count);
228 /// Gets or sets the layer's name.
230 /// <since_tizen> 3 </since_tizen>
244 /// Queries the depth of the layer.<br />
245 /// 0 is the bottommost layer, higher number is on the top.<br />
247 /// <since_tizen> 3 </since_tizen>
257 /// Internal only property to enable or disable clipping, type boolean.
258 /// By default, this is false, i.e., the viewport of the layer is the entire window.
260 internal bool ClippingEnabled
264 bool ret = Interop.Layer.IsClipping(SwigCPtr);
265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 Interop.Layer.SetClipping(SwigCPtr, value);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 /// Gets the Layer's ID
279 /// <remarks>Hidden-API</remarks>
280 [EditorBrowsable(EditorBrowsableState.Never)]
290 /// From the Container base class.
293 /// Adds a child view to this layer.
295 /// <seealso cref="Container.Add">
297 /// <exception cref="ArgumentNullException"> Thrown when child is null. </exception>
298 /// <since_tizen> 4 </since_tizen>
299 public override void Add(View child)
303 throw new ArgumentNullException(nameof(child));
306 Container oldParent = child.GetParent();
308 if (oldParent != this)
310 if (oldParent != null)
312 oldParent.Remove(child);
316 child.InternalParent = this;
319 LayoutCount += child.LayoutCount;
321 Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
322 if (NDalicPINVOKE.SWIGPendingException.Pending)
323 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330 /// Removes a child view from this layer. If the view was not a child of this layer, this is a no-op.
332 /// <seealso cref="Container.Remove">
334 /// <exception cref="ArgumentNullException"> Thrown when child is null. </exception>
335 /// <since_tizen> 4 </since_tizen>
336 public override void Remove(View child)
340 throw new ArgumentNullException(nameof(child));
342 if (child.GetParent() == null) // Early out if child parent is null.
345 if (child.GetParent() != this)
347 //throw new System.InvalidOperationException("You have deleted a view that is not a child of this layer.");
348 Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this layer.");
351 // If the view had focus, it clears focus.
352 if (child == FocusManager.Instance.GetCurrentFocusView())
354 FocusManager.Instance.ClearFocus();
357 Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
358 if (NDalicPINVOKE.SWIGPendingException.Pending)
359 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 Children.Remove(child);
362 child.InternalParent = null;
363 OnChildRemoved(child);
364 LayoutCount -= child.LayoutCount;
368 /// Retrieves a child view by the index.
370 /// <pre>The view has been initialized.</pre>
371 /// <param name="index">The index of the child to retrieve.</param>
372 /// <returns>The view for the given index or empty handle if children not initialized.</returns>
373 /// <since_tizen> 4 </since_tizen>
374 public override View GetChildAt(uint index)
376 if (index < Children.Count)
378 return Children[Convert.ToInt32(index)];
387 /// Get parent of the layer.
389 /// <returns>The view's container</returns>
390 /// <since_tizen> 4 </since_tizen>
391 public override Container GetParent()
397 /// Get the child count of the layer.
399 /// <returns>The child count of the layer.</returns>
400 /// <since_tizen> 4 </since_tizen>
401 [Obsolete("This has been deprecated in API9 and will be removed in API11. Use ChildCount property instead")]
402 public override uint GetChildCount()
404 return Convert.ToUInt32(Children.Count);
408 /// Downcasts a handle to layer handle.
410 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
411 /// <since_tizen> 3 </since_tizen>
412 /// Do not use this, that will be deprecated. Use as keyword instead.
413 [Obsolete("Do not use this, that will be deprecated. Use as keyword instead.")]
414 [EditorBrowsable(EditorBrowsableState.Never)]
415 public static Layer DownCast(BaseHandle handle)
419 throw new ArgumentNullException(nameof(handle));
421 Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer;
422 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427 /// Search through this layer's hierarchy for a view with the given unique ID.
429 /// <pre>This layer (the parent) has been initialized.</pre>
430 /// <remarks>The actor itself is also considered in the search.</remarks>
431 /// <param name="id">The id of the child to find</param>
432 /// <returns> A handle to the view if found, or an empty handle if not. </returns>
433 /// <since_tizen> 3 </since_tizen>
434 public View FindChildById(uint id)
436 //to fix memory leak issue, match the handle count with native side.
437 IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
438 View ret = this.GetInstanceSafely<View>(cPtr);
439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
443 internal override View FindCurrentChildById(uint id)
445 return FindChildById(id);
448 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
449 [EditorBrowsable(EditorBrowsableState.Never)]
450 public View FindChildByName(string viewName)
452 //to fix memory leak issue, match the handle count with native side.
453 IntPtr cPtr = Interop.Actor.FindChildByName(SwigCPtr, viewName);
454 View ret = this.GetInstanceSafely<View>(cPtr);
455 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
460 /// Increments the depth of the layer.
462 /// <since_tizen> 3 </since_tizen>
465 var parentChildren = window?.LayersChildren;
466 if (parentChildren != null)
468 int currentIdx = parentChildren.IndexOf(this);
470 if (currentIdx >= 0 && currentIdx < parentChildren.Count - 1)
472 var upper = parentChildren[currentIdx + 1];
479 /// Decrements the depth of the layer.
481 /// <since_tizen> 3 </since_tizen>
484 var parentChildren = window?.LayersChildren;
485 if (parentChildren != null)
487 int currentIdx = parentChildren.IndexOf(this);
488 int idx = window.IsBorderEnabled ? 1 : 0;
490 if (currentIdx > idx && currentIdx < parentChildren.Count)
492 var low = parentChildren[currentIdx - 1];
499 /// Raises the layer to the top.
501 /// <since_tizen> 3 </since_tizen>
502 public void RaiseToTop()
504 var parentChildren = window?.LayersChildren;
506 if (parentChildren != null)
508 parentChildren.Remove(this);
509 parentChildren.Add(this);
511 Interop.Layer.RaiseToTop(SwigCPtr);
512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
517 /// Lowers the layer to the bottom.
519 /// <since_tizen> 3 </since_tizen>
520 public void LowerToBottom()
522 var parentChildren = window?.LayersChildren;
524 if (parentChildren != null)
526 parentChildren.Remove(this);
527 parentChildren.Insert(0, this);
529 Interop.Layer.LowerToBottom(SwigCPtr);
531 if (window.IsBorderEnabled)
533 Layer bottomLayer = window.GetBorderWindowBottomLayer();
534 parentChildren.Remove(bottomLayer);
535 parentChildren.Insert(0, bottomLayer);
536 Interop.Layer.LowerToBottom(Layer.getCPtr(bottomLayer));
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543 /// Moves the layer directly above the given layer.<br />
544 /// After the call, this layer's depth will be immediately above target.<br />
546 /// <param name="target">The layer to get on top of.</param>
547 /// <since_tizen> 3 </since_tizen>
548 public void MoveAbove(Layer target)
554 /// Moves the layer directly below the given layer.<br />
555 /// After the call, this layer's depth will be immediately below target.<br />
557 /// <param name="target">The layer to get below of.</param>
558 /// <since_tizen> 3 </since_tizen>
559 public void MoveBelow(Layer target)
564 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
565 [EditorBrowsable(EditorBrowsableState.Never)]
566 public void SetAnchorPoint(Vector3 anchorPoint)
568 Interop.Actor.SetAnchorPoint(SwigCPtr, Vector3.getCPtr(anchorPoint));
569 if (NDalicPINVOKE.SWIGPendingException.Pending)
570 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
573 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
574 [EditorBrowsable(EditorBrowsableState.Never)]
575 public void SetSize(float width, float height)
577 Interop.ActorInternal.SetSize(SwigCPtr, width, height);
578 if (NDalicPINVOKE.SWIGPendingException.Pending)
579 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
583 [EditorBrowsable(EditorBrowsableState.Never)]
584 public void SetParentOrigin(Vector3 parentOrigin)
586 Interop.ActorInternal.SetParentOrigin(SwigCPtr, Vector3.getCPtr(parentOrigin));
587 if (NDalicPINVOKE.SWIGPendingException.Pending)
588 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
591 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
592 [EditorBrowsable(EditorBrowsableState.Never)]
593 public void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
595 Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
596 if (NDalicPINVOKE.SWIGPendingException.Pending)
597 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
602 /// This allows the user to specify whether this layer should consume touch (including gestures).
603 /// If set, any layers behind this layer will not be hit-test.
605 /// <param name="consume">Whether the layer should consume touch (including gestures).</param>
606 [EditorBrowsable(EditorBrowsableState.Never)]
607 public void SetTouchConsumed(bool consume)
609 Interop.Layer.SetTouchConsumed(SwigCPtr, consume);
610 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
615 /// This allows the user to specify whether this layer should consume hover.
616 /// If set, any layers behind this layer will not be hit-test.
618 /// <param name="consume">Whether the layer should consume hover</param>
619 [EditorBrowsable(EditorBrowsableState.Never)]
620 public void SetHoverConsumed(bool consume)
622 Interop.Layer.SetHoverConsumed(SwigCPtr, consume);
623 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
627 /// An event for visibility change which can be used to subscribe or unsubscribe the event handler.<br />
628 /// This signal is emitted when the visible property of this or a parent view is changed.<br />
630 [EditorBrowsable(EditorBrowsableState.Never)]
631 public event EventHandler<VisibilityChangedEventArgs> VisibilityChanged
635 if (visibilityChangedEventHandler == null)
637 visibilityChangedEventCallback = OnVisibilityChanged;
638 Interop.ActorSignal.VisibilityChangedConnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
639 NDalicPINVOKE.ThrowExceptionIfExists();
641 visibilityChangedEventHandler += value;
646 visibilityChangedEventHandler -= value;
647 if (visibilityChangedEventHandler == null && visibilityChangedEventCallback != null)
649 Interop.ActorSignal.VisibilityChangedDisconnect(SwigCPtr, visibilityChangedEventCallback.ToHandleRef(this));
650 NDalicPINVOKE.ThrowExceptionIfExists();
651 visibilityChangedEventCallback = null;
657 /// Event arguments of visibility changed.
659 [EditorBrowsable(EditorBrowsableState.Never)]
660 public class VisibilityChangedEventArgs : EventArgs
663 private bool visibility;
666 /// The layer whose visibility has changed.
668 [EditorBrowsable(EditorBrowsableState.Never)]
682 /// Whether the layer is now visible or not.
684 [EditorBrowsable(EditorBrowsableState.Never)]
685 public bool Visibility
698 internal uint GetDepth()
700 var parentChildren = window?.LayersChildren;
701 if (parentChildren != null)
703 int idx = parentChildren.IndexOf(this);
706 return Convert.ToUInt32(idx); ;
711 internal void RaiseAbove(Layer target)
713 var parentChildren = window?.LayersChildren;
714 if (parentChildren != null)
716 int currentIndex = parentChildren.IndexOf(this);
717 int targetIndex = parentChildren.IndexOf(target);
719 if (currentIndex < 0 || targetIndex < 0 ||
720 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
722 NUILog.Error("index should be bigger than 0 and less than children of layer count");
726 // If the currentIndex is less than the target index and the target has the same parent.
727 if (currentIndex < targetIndex)
729 parentChildren.Remove(this);
730 parentChildren.Insert(targetIndex, this);
732 Interop.Layer.MoveAbove(SwigCPtr, Layer.getCPtr(target));
733 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 internal void LowerBelow(Layer target)
740 var parentChildren = window?.LayersChildren;
742 if (parentChildren != null)
744 int currentIndex = parentChildren.IndexOf(this);
745 int targetIndex = parentChildren.IndexOf(target);
747 if (currentIndex < 0 || targetIndex < 0 ||
748 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
750 NUILog.Error("index should be bigger than 0 and less than children of layer count");
754 // If the currentIndex is not already the 0th index and the target has the same parent.
755 if ((currentIndex != 0) && (targetIndex != -1) &&
756 (currentIndex > targetIndex))
758 parentChildren.Remove(this);
759 parentChildren.Insert(targetIndex, this);
761 Interop.Layer.MoveBelow(SwigCPtr, Layer.getCPtr(target));
762 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
767 internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function)
769 Interop.Layer.SetSortFunction(SwigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function));
770 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
773 internal bool IsTouchConsumed()
775 bool ret = Interop.Layer.IsTouchConsumed(SwigCPtr);
776 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 internal bool IsHoverConsumed()
781 bool ret = Interop.Layer.IsHoverConsumed(SwigCPtr);
782 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 internal void AddViewToLayerList(View view)
791 internal void RemoveViewFromLayerList(View view)
793 Children.Remove(view);
796 internal string GetName()
798 string ret = Interop.Actor.GetName(SwigCPtr);
799 if (NDalicPINVOKE.SWIGPendingException.Pending)
800 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 internal void SetName(string name)
806 Interop.Actor.SetName(SwigCPtr, name);
807 if (NDalicPINVOKE.SWIGPendingException.Pending)
808 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
811 internal void SetWindow(Window win)
813 if (window == win) return;
817 window.LayoutController.LayoutCount -= LayoutCount;
824 window.LayoutController.LayoutCount += LayoutCount;
828 internal uint GetId()
830 uint ret = Interop.Actor.GetId(SwigCPtr);
831 if (NDalicPINVOKE.SWIGPendingException.Pending)
832 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
837 /// The number of layouts of children views.
838 /// This can be used to set/unset Process callback to calculate Layout.
840 internal int LayoutCount
849 if (layoutCount == value) return;
851 if (value < 0) throw new global::System.ArgumentOutOfRangeException(nameof(LayoutCount), "LayoutCount(" + LayoutCount + ") should not be less than zero");
855 int diff = value - layoutCount;
856 window.LayoutController.LayoutCount += diff;
862 /// This will not be public opened.
863 [EditorBrowsable(EditorBrowsableState.Never)]
864 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
866 Interop.Layer.DeleteLayer(swigCPtr);
869 private void SetBehavior(LayerBehavior behavior)
871 Interop.Layer.SetBehavior(SwigCPtr, (int)behavior);
872 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
875 private LayerBehavior GetBehavior()
877 Layer.LayerBehavior ret = (Layer.LayerBehavior)Interop.Layer.GetBehavior(SwigCPtr);
878 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 internal class Property
884 internal static readonly int BEHAVIOR = Interop.Layer.BehaviorGet();
887 // Callback for View visibility change signal
888 // type is not used because layer does not have parent so layer's visibility cannot be changed by its parent.
889 private void OnVisibilityChanged(IntPtr data, bool visibility, VisibilityChangeType type)
891 VisibilityChangedEventArgs e = new VisibilityChangedEventArgs();
892 if (data != IntPtr.Zero)
894 e.Layer = Registry.GetManagedBaseHandleFromNativePtr(data) as Layer;
896 e.Visibility = visibility;
898 if (visibilityChangedEventHandler != null)
900 visibilityChangedEventHandler(this, e);