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.
19 using System.ComponentModel;
20 using global::System.Diagnostics;
23 namespace Tizen.NUI.BaseComponents
26 /// View is the base class for all views.
28 /// <since_tizen> 3 </since_tizen>
29 public partial class View
31 internal string styleName;
33 internal virtual LayoutItem CreateDefaultLayout()
35 return new AbsoluteLayout();
38 internal class ThemeData
41 private enum States : byte
44 ControlStatePropagation = 1 << 0,
45 ThemeChangeSensitive = 1 << 1,
46 ThemeApplied = 1 << 2, // It is true when the view has valid style name or the platform theme has a component style for this view type.
47 // That indicates the view can have different styles by theme.
48 // Hence if the current state has ThemeApplied and ThemeChangeSensitive, the view will change its style by theme changing.
49 ListeningThemeChangeEvent = 1 << 3,
52 private States states = ThemeManager.ApplicationThemeChangeSensitive ? States.ThemeChangeSensitive : States.None;
53 public ViewStyle viewStyle;
54 public ControlState controlStates = ControlState.Normal;
55 public ViewSelectorData selectorData;
57 public bool ControlStatePropagation
59 get => ((states & States.ControlStatePropagation) != 0);
60 set => SetOption(States.ControlStatePropagation, value);
63 public bool ThemeChangeSensitive
65 get => ((states & States.ThemeChangeSensitive) != 0);
66 set => SetOption(States.ThemeChangeSensitive, value);
69 public bool ThemeApplied
71 get => ((states & States.ThemeApplied) != 0);
72 set => SetOption(States.ThemeApplied, value);
75 public bool ListeningThemeChangeEvent
77 get => ((states & States.ListeningThemeChangeEvent) != 0);
78 set => SetOption(States.ListeningThemeChangeEvent, value);
81 private void SetOption(States option, bool value)
83 if (value) states |= option;
84 else states &= ~option;
89 /// The color mode of View.
90 /// This specifies whether the View uses its own color, or inherits its parent color.
91 /// The default is ColorMode.UseOwnMultiplyParentColor.
93 internal ColorMode ColorMode
101 return GetColorMode();
105 internal LayoutLength SuggestedMinimumWidth
109 float result = Interop.Actor.GetSuggestedMinimumWidth(SwigCPtr);
110 if (NDalicPINVOKE.SWIGPendingException.Pending)
111 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112 return new LayoutLength(result);
116 internal LayoutLength SuggestedMinimumHeight
120 float result = Interop.Actor.GetSuggestedMinimumHeight(SwigCPtr);
121 if (NDalicPINVOKE.SWIGPendingException.Pending)
122 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 return new LayoutLength(result);
127 internal float WorldPositionX
132 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionX);
136 internal float WorldPositionY
141 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionY);
145 internal float WorldPositionZ
150 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionZ);
154 internal bool FocusState
158 return IsKeyboardFocusable();
162 SetKeyboardFocusable(value);
166 internal void SetLayout(LayoutItem layout)
170 this.layout = layout;
171 this.layout?.AttachToOwner(this);
172 this.layout?.RequestLayout();
175 internal void AttachTransitionsToChildren(LayoutTransition transition)
177 // Iterate children, adding the transition unless a transition
178 // for the same condition and property has already been
180 foreach (View view in Children)
182 LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
186 internal float ParentOriginX
191 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginX);
196 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.WorldPositionX, value);
197 NotifyPropertyChanged();
201 internal float ParentOriginY
206 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginY);
211 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginY, value);
212 NotifyPropertyChanged();
216 internal float ParentOriginZ
221 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ);
226 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ, value);
227 NotifyPropertyChanged();
231 internal float PivotPointX
236 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointX);
241 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointX, value);
245 internal float PivotPointY
250 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointY);
255 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointY, value);
259 internal float PivotPointZ
264 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ);
269 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ, value);
273 internal Matrix WorldMatrix
277 Matrix returnValue = new Matrix();
278 PropertyValue wordMatrix = GetProperty(View.Property.WorldMatrix);
279 wordMatrix?.Get(returnValue);
280 wordMatrix?.Dispose();
286 /// The number of layouts including view's layout and children's layouts.
287 /// This can be used to set/unset Process callback to calculate Layout.
289 internal int LayoutCount
298 if (layoutCount == value) return;
300 if (value < 0) throw new global::System.ArgumentOutOfRangeException(nameof(LayoutCount), "LayoutCount(" + LayoutCount + ") should not be less than zero");
302 int diff = value - layoutCount;
305 if (InternalParent != null)
307 var parentView = InternalParent as View;
308 if (parentView != null)
310 parentView.LayoutCount += diff;
314 var parentLayer = InternalParent as Layer;
315 if (parentLayer != null)
317 parentLayer.LayoutCount += diff;
325 /// Indicates that this View should listen Touch event to handle its ControlState.
327 private bool enableControlState = false;
329 private int LeftFocusableViewId
334 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId);
339 Object.InternalSetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId, value);
343 private int RightFocusableViewId
348 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId);
353 Object.InternalSetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId, value);
357 private int UpFocusableViewId
362 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId);
367 Object.InternalSetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId, value);
371 private int DownFocusableViewId
376 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId);
381 Object.InternalSetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId, value);
385 private int ClockwiseFocusableViewId
390 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId);
395 Object.InternalSetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId, value);
399 private int CounterClockwiseFocusableViewId
404 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId);
409 Object.InternalSetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId, value);
413 internal string GetName()
415 string ret = Interop.Actor.GetName(SwigCPtr);
416 if (NDalicPINVOKE.SWIGPendingException.Pending)
417 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 internal void SetName(string name)
423 Interop.Actor.SetName(SwigCPtr, name);
424 if (NDalicPINVOKE.SWIGPendingException.Pending)
425 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428 internal uint GetId()
430 uint ret = Interop.Actor.GetId(SwigCPtr);
431 if (NDalicPINVOKE.SWIGPendingException.Pending)
432 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
436 internal bool IsRoot()
438 bool ret = Interop.ActorInternal.IsRoot(SwigCPtr);
439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
443 internal bool OnWindow()
445 bool ret = Interop.Actor.OnStage(SwigCPtr);
446 if (NDalicPINVOKE.SWIGPendingException.Pending)
447 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451 internal View FindChildById(uint id)
453 //to fix memory leak issue, match the handle count with native side.
454 IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
455 View ret = this.GetInstanceSafely<View>(cPtr);
456 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
460 internal override View FindCurrentChildById(uint id)
462 return FindChildById(id);
465 internal void SetParentOrigin(Position origin)
467 Interop.ActorInternal.SetParentOrigin(SwigCPtr, Position.getCPtr(origin));
468 if (NDalicPINVOKE.SWIGPendingException.Pending)
469 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
472 internal Position GetCurrentParentOrigin()
475 if(internalCurrentParentOrigin == null)
477 internalCurrentParentOrigin = new Position(0, 0, 0);
480 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.ParentOrigin, internalCurrentParentOrigin.SwigCPtr);
482 if (NDalicPINVOKE.SWIGPendingException.Pending)
484 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486 return internalCurrentParentOrigin;
489 internal void SetAnchorPoint(Position anchorPoint)
491 Interop.Actor.SetAnchorPoint(SwigCPtr, Position.getCPtr(anchorPoint));
492 if (NDalicPINVOKE.SWIGPendingException.Pending)
493 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496 internal Position GetCurrentAnchorPoint()
499 if(internalCurrentAnchorPoint == null)
501 internalCurrentAnchorPoint = new Position(0, 0, 0);
504 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.AnchorPoint, internalCurrentAnchorPoint.SwigCPtr);
506 if (NDalicPINVOKE.SWIGPendingException.Pending)
508 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
510 return internalCurrentAnchorPoint;
513 internal void SetSize(float width, float height)
515 Interop.ActorInternal.SetSize(SwigCPtr, width, height);
516 if (NDalicPINVOKE.SWIGPendingException.Pending)
517 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520 internal void SetSize(float width, float height, float depth)
522 Interop.ActorInternal.SetSize(SwigCPtr, width, height, depth);
523 if (NDalicPINVOKE.SWIGPendingException.Pending)
524 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
527 internal void SetSize(Vector2 size)
529 Interop.ActorInternal.SetSizeVector2(SwigCPtr, Vector2.getCPtr(size));
530 if (NDalicPINVOKE.SWIGPendingException.Pending)
531 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
534 internal void SetSize(Vector3 size)
536 Interop.ActorInternal.SetSizeVector3(SwigCPtr, Vector3.getCPtr(size));
537 if (NDalicPINVOKE.SWIGPendingException.Pending)
538 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541 internal Vector3 GetTargetSize()
544 if(internalTargetSize == null)
546 internalTargetSize = new Vector3(0, 0, 0);
549 Interop.ActorInternal.RetrieveTargetSize(SwigCPtr, internalTargetSize.SwigCPtr);
551 if (NDalicPINVOKE.SWIGPendingException.Pending)
553 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
555 return internalTargetSize;
558 internal Size2D GetCurrentSize()
561 if(internalCurrentSize == null)
563 internalCurrentSize = new Size2D(0, 0);
566 Interop.ActorInternal.RetrieveCurrentPropertyVector2ActualVector3(SwigCPtr, Property.SIZE, internalCurrentSize.SwigCPtr);
568 if (NDalicPINVOKE.SWIGPendingException.Pending)
570 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572 return internalCurrentSize;
575 internal Size2D GetCurrentSizeFloat()
577 Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
578 if (NDalicPINVOKE.SWIGPendingException.Pending)
579 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584 /// GetNaturalSize() function behaviour can be changed for each subclass of View.
585 /// So we make GetNaturalSize() function virtual, and make subclass can define it's owned logic
587 internal virtual Vector3 GetNaturalSize()
589 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
590 if (NDalicPINVOKE.SWIGPendingException.Pending)
591 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
595 internal void SetX(float x)
597 Interop.ActorInternal.SetX(SwigCPtr, x);
598 if (NDalicPINVOKE.SWIGPendingException.Pending)
599 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
602 internal void SetY(float y)
604 Interop.ActorInternal.SetY(SwigCPtr, y);
605 if (NDalicPINVOKE.SWIGPendingException.Pending)
606 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
609 internal void SetZ(float z)
611 Interop.ActorInternal.SetZ(SwigCPtr, z);
612 if (NDalicPINVOKE.SWIGPendingException.Pending)
613 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
616 internal void TranslateBy(Vector3 distance)
618 Interop.ActorInternal.TranslateBy(SwigCPtr, Vector3.getCPtr(distance));
619 if (NDalicPINVOKE.SWIGPendingException.Pending)
620 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
623 internal Position GetCurrentPosition()
626 if(internalCurrentPosition == null)
628 internalCurrentPosition = new Position(0, 0, 0);
631 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, Property.POSITION, internalCurrentPosition.SwigCPtr);
633 if (NDalicPINVOKE.SWIGPendingException.Pending)
635 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 return internalCurrentPosition;
639 internal Vector3 GetCurrentWorldPosition()
642 if(internalCurrentWorldPosition == null)
644 internalCurrentWorldPosition = new Vector3(0, 0, 0);
647 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldPosition, internalCurrentWorldPosition.SwigCPtr);
649 if (NDalicPINVOKE.SWIGPendingException.Pending)
651 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
653 return internalCurrentWorldPosition;
656 internal Vector2 GetCurrentScreenPosition()
659 if(internalCurrentScreenPosition == null)
661 internalCurrentScreenPosition = new Vector2(0, 0);
664 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.ScreenPosition, internalCurrentScreenPosition.SwigCPtr);
666 if (NDalicPINVOKE.SWIGPendingException.Pending)
668 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670 return internalCurrentScreenPosition;
673 internal Vector4 GetCurrentScreenPositionSize()
675 Vector4 ret = new Vector4(Interop.Actor.CalculateScreenExtents(SwigCPtr), true);
676 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
680 internal void SetInheritPosition(bool inherit)
682 Interop.ActorInternal.SetInheritPosition(SwigCPtr, inherit);
683 if (NDalicPINVOKE.SWIGPendingException.Pending)
684 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687 internal bool IsPositionInherited()
689 bool ret = Interop.ActorInternal.IsPositionInherited(SwigCPtr);
690 if (NDalicPINVOKE.SWIGPendingException.Pending)
691 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
695 internal void SetOrientation(Degree angle, Vector3 axis)
697 Interop.ActorInternal.SetOrientationDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
698 if (NDalicPINVOKE.SWIGPendingException.Pending)
699 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
702 internal void SetOrientation(Radian angle, Vector3 axis)
704 Interop.ActorInternal.SetOrientationRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
705 if (NDalicPINVOKE.SWIGPendingException.Pending)
706 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
709 internal void SetOrientation(Rotation orientation)
711 Interop.ActorInternal.SetOrientationQuaternion(SwigCPtr, Rotation.getCPtr(orientation));
712 if (NDalicPINVOKE.SWIGPendingException.Pending)
713 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
716 internal Rotation GetCurrentOrientation()
718 Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentOrientation(SwigCPtr), true);
719 if (NDalicPINVOKE.SWIGPendingException.Pending)
720 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724 internal void SetInheritOrientation(bool inherit)
726 Interop.ActorInternal.SetInheritOrientation(SwigCPtr, inherit);
727 if (NDalicPINVOKE.SWIGPendingException.Pending)
728 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
731 internal bool IsOrientationInherited()
733 bool ret = Interop.ActorInternal.IsOrientationInherited(SwigCPtr);
734 if (NDalicPINVOKE.SWIGPendingException.Pending)
735 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739 internal Rotation GetCurrentWorldOrientation()
741 Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentWorldOrientation(SwigCPtr), true);
742 if (NDalicPINVOKE.SWIGPendingException.Pending)
743 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 internal void SetScale(float scale)
749 Interop.ActorInternal.SetScale(SwigCPtr, scale);
750 if (NDalicPINVOKE.SWIGPendingException.Pending)
751 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
754 internal void SetScale(float scaleX, float scaleY, float scaleZ)
756 Interop.ActorInternal.SetScale(SwigCPtr, scaleX, scaleY, scaleZ);
757 if (NDalicPINVOKE.SWIGPendingException.Pending)
758 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
761 internal void SetScale(Vector3 scale)
763 Interop.ActorInternal.SetScale(SwigCPtr, Vector3.getCPtr(scale));
764 if (NDalicPINVOKE.SWIGPendingException.Pending)
765 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
768 internal Vector3 GetCurrentScale()
771 if(internalCurrentScale == null)
773 internalCurrentScale = new Vector3(0, 0, 0);
776 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.SCALE, internalCurrentScale.SwigCPtr);
778 if (NDalicPINVOKE.SWIGPendingException.Pending)
780 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 return internalCurrentScale;
785 internal Vector3 GetCurrentWorldScale()
788 if(internalCurrentWorldScale == null)
790 internalCurrentWorldScale = new Vector3(0, 0, 0);
793 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldScale, internalCurrentWorldScale.SwigCPtr);
795 if (NDalicPINVOKE.SWIGPendingException.Pending)
797 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799 return internalCurrentWorldScale;
802 internal void SetInheritScale(bool inherit)
804 Interop.ActorInternal.SetInheritScale(SwigCPtr, inherit);
805 if (NDalicPINVOKE.SWIGPendingException.Pending)
806 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809 internal bool IsScaleInherited()
811 bool ret = Interop.ActorInternal.IsScaleInherited(SwigCPtr);
812 if (NDalicPINVOKE.SWIGPendingException.Pending)
813 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
817 internal Matrix GetCurrentWorldMatrix()
819 Matrix ret = new Matrix(Interop.ActorInternal.GetCurrentWorldMatrix(SwigCPtr), true);
820 if (NDalicPINVOKE.SWIGPendingException.Pending)
821 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825 internal void SetVisible(bool visible)
827 Interop.Actor.SetVisible(SwigCPtr, visible);
828 if (NDalicPINVOKE.SWIGPendingException.Pending)
829 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
833 /// Retrieve the View's current Visibility.
836 /// The <see cref="Visibility"/> property is set in the main thread, so it is not updated in real time when the value is changed in the render thread.
837 /// However, this method can get the current actual value updated in real time.
839 internal bool IsVisible()
841 bool ret = Interop.ActorInternal.IsVisible(SwigCPtr);
842 if (NDalicPINVOKE.SWIGPendingException.Pending)
843 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
847 internal void SetOpacity(float opacity)
849 Interop.ActorInternal.SetOpacity(SwigCPtr, opacity);
850 if (NDalicPINVOKE.SWIGPendingException.Pending)
851 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
854 internal float GetCurrentOpacity()
856 float ret = Interop.ActorInternal.GetCurrentOpacity(SwigCPtr);
857 if (NDalicPINVOKE.SWIGPendingException.Pending)
858 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 internal Vector4 GetCurrentColor()
865 if(internalCurrentColor == null)
867 internalCurrentColor = new Vector4(0, 0, 0, 0);
870 Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Interop.ActorProperty.ColorGet(), internalCurrentColor.SwigCPtr);
872 if (NDalicPINVOKE.SWIGPendingException.Pending)
874 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
876 return internalCurrentColor;
878 internal ColorMode GetColorMode()
880 ColorMode ret = (ColorMode)Interop.ActorInternal.GetColorMode(SwigCPtr);
881 if (NDalicPINVOKE.SWIGPendingException.Pending)
882 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
886 internal Vector4 GetCurrentWorldColor()
889 if(internalCurrentWorldColor == null)
891 internalCurrentWorldColor = new Vector4(0, 0, 0, 0);
894 Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Property.WorldColor, internalCurrentWorldColor.SwigCPtr);
896 if (NDalicPINVOKE.SWIGPendingException.Pending)
898 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900 return internalCurrentWorldColor;
903 internal void SetDrawMode(DrawModeType drawMode)
905 Interop.ActorInternal.SetDrawMode(SwigCPtr, (int)drawMode);
906 if (NDalicPINVOKE.SWIGPendingException.Pending)
907 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
910 internal DrawModeType GetDrawMode()
912 DrawModeType ret = (DrawModeType)Interop.ActorInternal.GetDrawMode(SwigCPtr);
913 if (NDalicPINVOKE.SWIGPendingException.Pending)
914 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
918 internal void SetKeyboardFocusable(bool focusable)
920 Interop.ActorInternal.SetKeyboardFocusable(SwigCPtr, focusable);
921 if (NDalicPINVOKE.SWIGPendingException.Pending)
922 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
925 internal bool IsKeyboardFocusable()
927 bool ret = Interop.ActorInternal.IsKeyboardFocusable(SwigCPtr);
928 if (NDalicPINVOKE.SWIGPendingException.Pending)
929 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
933 internal void SetKeyboardFocusableChildren(bool focusable)
935 Interop.ActorInternal.SetKeyboardFocusableChildren(SwigCPtr, focusable);
936 if (NDalicPINVOKE.SWIGPendingException.Pending)
937 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
940 internal bool AreChildrenKeyBoardFocusable()
942 bool ret = Interop.ActorInternal.AreChildrenKeyBoardFocusable(SwigCPtr);
943 if (NDalicPINVOKE.SWIGPendingException.Pending)
944 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948 internal void SetFocusableInTouch(bool enabled)
950 Interop.ActorInternal.SetFocusableInTouch(SwigCPtr, enabled);
951 if (NDalicPINVOKE.SWIGPendingException.Pending)
952 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
955 internal bool IsFocusableInTouch()
957 bool ret = Interop.ActorInternal.IsFocusableInTouch(SwigCPtr);
958 if (NDalicPINVOKE.SWIGPendingException.Pending)
959 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963 internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
965 Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
966 if (NDalicPINVOKE.SWIGPendingException.Pending)
967 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
970 internal ResizePolicyType GetResizePolicy(DimensionType dimension)
972 ResizePolicyType ret = (ResizePolicyType)Interop.Actor.GetResizePolicy(SwigCPtr, (int)dimension);
973 if (NDalicPINVOKE.SWIGPendingException.Pending)
974 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
978 internal Vector3 GetSizeModeFactor()
981 if (internalSizeModeFactor == null)
983 internalSizeModeFactor = new Vector3(OnSizeModeFactorChanged, 0, 0, 0);
985 Object.InternalRetrievingPropertyVector3(SwigCPtr, View.Property.SizeModeFactor, internalSizeModeFactor.SwigCPtr);
986 return internalSizeModeFactor;
989 internal void SetMinimumSize(Vector2 size)
991 Interop.ActorInternal.SetMinimumSize(SwigCPtr, Vector2.getCPtr(size));
992 if (NDalicPINVOKE.SWIGPendingException.Pending)
993 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
996 internal Vector2 GetMinimumSize()
999 if (internalMinimumSize == null)
1001 internalMinimumSize = new Size2D(OnMinimumSizeChanged, 0, 0);
1003 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MinimumSize, internalMinimumSize.SwigCPtr);
1004 return internalMinimumSize;
1007 internal void SetMaximumSize(Vector2 size)
1009 Interop.ActorInternal.SetMaximumSize(SwigCPtr, Vector2.getCPtr(size));
1010 if (NDalicPINVOKE.SWIGPendingException.Pending)
1011 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1014 internal Vector2 GetMaximumSize()
1017 if (internalMaximumSize == null)
1019 internalMaximumSize = new Size2D(OnMaximumSizeChanged, 0, 0);
1021 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MaximumSize, internalMaximumSize.SwigCPtr);
1022 return internalMaximumSize;
1025 internal int GetHierarchyDepth()
1027 int ret = Interop.Actor.GetHierarchyDepth(SwigCPtr);
1028 if (NDalicPINVOKE.SWIGPendingException.Pending)
1029 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1033 internal uint GetRendererCount()
1035 uint ret = Interop.Actor.GetRendererCount(SwigCPtr);
1036 if (NDalicPINVOKE.SWIGPendingException.Pending)
1037 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1041 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
1043 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1046 internal bool IsTopLevelView()
1048 if (GetParent() is Layer)
1056 /// Check whether Current view don't has BackgroundVisual or not.
1057 /// Some API (like Animation, Borderline) required non-empty backgrounds.
1059 internal bool IsBackgroundEmpty()
1062 int visualType = (int)Visual.Type.Invalid;
1063 Interop.View.InternalRetrievingVisualPropertyInt(this.SwigCPtr, Property.BACKGROUND, Visual.Property.Type, out visualType);
1064 return visualType == (int)Visual.Type.Invalid;
1067 internal void SetKeyInputFocus()
1069 Interop.ViewInternal.SetKeyInputFocus(SwigCPtr);
1070 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1073 internal void ClearKeyInputFocus()
1075 Interop.ViewInternal.ClearKeyInputFocus(SwigCPtr);
1076 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1079 internal PinchGestureDetector GetPinchGestureDetector()
1081 PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.GetPinchGestureDetector(SwigCPtr), true);
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1086 internal PanGestureDetector GetPanGestureDetector()
1088 PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.GetPanGestureDetector(SwigCPtr), true);
1089 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1093 internal TapGestureDetector GetTapGestureDetector()
1095 TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.GetTapGestureDetector(SwigCPtr), true);
1096 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1100 internal LongPressGestureDetector GetLongPressGestureDetector()
1102 LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.GetLongPressGestureDetector(SwigCPtr), true);
1103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1107 internal IntPtr GetPtrfromView()
1109 return (IntPtr)SwigCPtr;
1112 internal void RemoveChild(View child)
1114 // If the view had focus, it clears focus.
1115 if (child == FocusManager.Instance.GetCurrentFocusView())
1117 FocusManager.Instance.ClearFocus();
1119 // Do actual child removal
1120 Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
1121 if (NDalicPINVOKE.SWIGPendingException.Pending)
1122 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1124 Children.Remove(child);
1125 child.InternalParent = null;
1126 LayoutCount -= child.LayoutCount;
1128 OnChildRemoved(child);
1129 if (ChildRemoved != null)
1131 ChildRemovedEventArgs e = new ChildRemovedEventArgs
1135 ChildRemoved(this, e);
1140 /// Removes the layout from this View.
1142 internal void ResetLayout()
1149 internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1151 return (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1154 /// TODO open as a protected level
1155 internal virtual void ApplyCornerRadius()
1157 if (backgroundExtraData == null) return;
1160 // Update corner radius properties to background and shadow by ActionUpdateProperty
1161 if (backgroundExtraData.CornerRadius != null)
1163 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1164 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1166 Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1167 Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1170 /// TODO open as a protected level
1171 internal virtual void ApplyBorderline()
1173 if (backgroundExtraData == null) return;
1176 // ActionUpdateProperty works well only if BACKGROUND visual setup before.
1177 // If view don't have BACKGROUND visual, we set transparent background color in default.
1178 if (IsBackgroundEmpty())
1180 // BACKGROUND visual doesn't exist.
1181 SetBackgroundColor(Color.Transparent);
1182 // SetBackgroundColor function apply borderline internally.
1183 // So we can just return now.
1187 // Update borderline properties to background by ActionUpdateProperty
1188 Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineWidth, backgroundExtraData.BorderlineWidth);
1189 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineColor, Vector4.getCPtr(backgroundExtraData.BorderlineColor ?? Color.Black));
1190 Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineOffset, backgroundExtraData.BorderlineOffset);
1194 /// Get selector value from the triggerable selector or related property.
1196 internal Selector<T> GetSelector<T>(TriggerableSelector<T> triggerableSelector, NUI.Binding.BindableProperty relatedProperty)
1198 var selector = triggerableSelector?.Get();
1199 if (selector != null)
1204 var value = (T)GetValue(relatedProperty);
1205 return value == null ? null : new Selector<T>(value);
1208 internal void SetThemeApplied()
1210 if (themeData == null) themeData = new ThemeData();
1211 themeData.ThemeApplied = true;
1213 if (ThemeChangeSensitive && !themeData.ListeningThemeChangeEvent)
1215 themeData.ListeningThemeChangeEvent = true;
1216 ThemeManager.ThemeChangedInternal.Add(OnThemeChanged);
1221 /// you can override it to clean-up your own resources.
1223 /// <param name="type">DisposeTypes</param>
1224 /// <since_tizen> 3 </since_tizen>
1225 protected override void Dispose(DisposeTypes type)
1232 disposeDebugging(type);
1234 //_mergedStyle = null;
1236 internalMaximumSize?.Dispose();
1237 internalMaximumSize = null;
1238 internalMinimumSize?.Dispose();
1239 internalMinimumSize = null;
1240 internalMargin?.Dispose();
1241 internalMargin = null;
1242 internalPadding?.Dispose();
1243 internalPadding = null;
1244 internalSizeModeFactor?.Dispose();
1245 internalSizeModeFactor = null;
1246 internalCellIndex?.Dispose();
1247 internalCellIndex = null;
1248 internalBackgroundColor?.Dispose();
1249 internalBackgroundColor = null;
1250 internalColor?.Dispose();
1251 internalColor = null;
1252 internalPivotPoint?.Dispose();
1253 internalPivotPoint = null;
1254 internalPosition?.Dispose();
1255 internalPosition = null;
1256 internalPosition2D?.Dispose();
1257 internalPosition2D = null;
1258 internalScale?.Dispose();
1259 internalScale = null;
1260 internalSize?.Dispose();
1261 internalSize = null;
1262 internalSize2D?.Dispose();
1263 internalSize2D = null;
1265 panGestureDetector?.Dispose();
1266 panGestureDetector = null;
1267 longGestureDetector?.Dispose();
1268 longGestureDetector = null;
1269 pinchGestureDetector?.Dispose();
1270 pinchGestureDetector = null;
1271 tapGestureDetector?.Dispose();
1272 tapGestureDetector = null;
1273 rotationGestureDetector?.Dispose();
1274 rotationGestureDetector = null;
1277 internalCurrentParentOrigin?.Dispose();
1278 internalCurrentParentOrigin = null;
1279 internalCurrentAnchorPoint?.Dispose();
1280 internalCurrentAnchorPoint = null;
1281 internalTargetSize?.Dispose();
1282 internalTargetSize = null;
1283 internalCurrentSize?.Dispose();
1284 internalCurrentSize = null;
1285 internalNaturalSize?.Dispose();
1286 internalNaturalSize = null;
1287 internalCurrentPosition?.Dispose();
1288 internalCurrentPosition = null;
1289 internalCurrentWorldPosition?.Dispose();
1290 internalCurrentWorldPosition = null;
1291 internalCurrentScale?.Dispose();
1292 internalCurrentScale = null;
1293 internalCurrentWorldScale?.Dispose();
1294 internalCurrentWorldScale = null;
1295 internalCurrentColor?.Dispose();
1296 internalCurrentColor = null;
1297 internalCurrentWorldColor?.Dispose();
1298 internalCurrentWorldColor = null;
1299 internalSizeModeFactor?.Dispose();
1300 internalSizeModeFactor = null;
1301 internalCurrentScreenPosition?.Dispose();
1302 internalCurrentScreenPosition = null;
1304 if (type == DisposeTypes.Explicit)
1307 //Release your own managed resources here.
1308 //You should release all of your own disposable objects here.
1309 if (themeData != null)
1311 themeData.selectorData?.Reset(this);
1312 if (themeData.ListeningThemeChangeEvent)
1314 ThemeManager.ThemeChangedInternal.Remove(OnThemeChanged);
1317 if (widthConstraint != null)
1319 widthConstraint.Remove();
1320 widthConstraint.Dispose();
1322 if (heightConstraint != null)
1324 heightConstraint.Remove();
1325 heightConstraint.Dispose();
1329 //Release your own unmanaged resources here.
1330 //You should not access any managed member here except static instance.
1331 //because the execution order of Finalizes is non-deterministic.
1333 DisConnectFromSignals();
1335 foreach (View view in Children)
1337 view.InternalParent = null;
1342 NUILog.Debug($"[Dispose] View.Dispose({type}) END");
1343 NUILog.Debug($"=============================");
1348 /// This will not be public opened.
1349 [EditorBrowsable(EditorBrowsableState.Never)]
1350 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1352 Interop.View.DeleteView(swigCPtr);
1356 /// The touch event handler for ControlState.
1357 /// Please change ControlState value by touch state if needed.
1359 /// <exception cref="ArgumentNullException"> Thrown when touch is null. </exception>
1360 [EditorBrowsable(EditorBrowsableState.Never)]
1361 protected virtual bool HandleControlStateOnTouch(Touch touch)
1365 throw new global::System.ArgumentNullException(nameof(touch));
1368 switch (touch.GetState(0))
1370 case PointStateType.Down:
1371 ControlState += ControlState.Pressed;
1373 case PointStateType.Interrupted:
1374 case PointStateType.Up:
1375 if (ControlState.Contains(ControlState.Pressed))
1377 ControlState -= ControlState.Pressed;
1387 /// Internal callback of enabled property changes.
1388 /// Inherited view can override this method to implements enabled property changes.
1390 [EditorBrowsable(EditorBrowsableState.Never)]
1391 protected virtual void OnEnabled(bool enabled)
1395 if (State == View.States.Disabled)
1397 State = View.States.Normal;
1399 if (enableControlState)
1401 ControlState -= ControlState.Disabled;
1406 State = View.States.Disabled;
1407 if (enableControlState)
1409 ControlState += ControlState.Disabled;
1415 private void DisConnectFromSignals()
1417 if (HasBody() == false)
1419 NUILog.Debug($"[Dispose] DisConnectFromSignals() No native body! No need to Disconnect Signals!");
1422 NUILog.Debug($"[Dispose] DisConnectFromSignals START");
1423 NUILog.Debug($"[Dispose] View.DisConnectFromSignals() type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
1424 NUILog.Debug($"[Dispose] ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
1426 if (onRelayoutEventCallback != null)
1428 NUILog.Debug($"[Dispose] onRelayoutEventCallback");
1430 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(GetBaseHandleCPtrHandleRef), false);
1431 signal?.Disconnect(onRelayoutEventCallback);
1432 onRelayoutEventCallback = null;
1435 if (offWindowEventCallback != null)
1437 NUILog.Debug($"[Dispose] offWindowEventCallback");
1439 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(GetBaseHandleCPtrHandleRef), false);
1440 signal?.Disconnect(offWindowEventCallback);
1441 offWindowEventCallback = null;
1444 if (onWindowEventCallback != null)
1446 NUILog.Debug($"[Dispose] onWindowEventCallback");
1448 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1449 signal?.Disconnect(onWindowEventCallback);
1450 onWindowEventCallback = null;
1453 if (wheelEventCallback != null)
1455 NUILog.Debug($"[Dispose] wheelEventCallback");
1457 using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(GetBaseHandleCPtrHandleRef), false);
1458 signal?.Disconnect(wheelEventCallback);
1459 wheelEventCallback = null;
1462 if (hoverEventCallback != null)
1464 NUILog.Debug($"[Dispose] hoverEventCallback");
1466 using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(GetBaseHandleCPtrHandleRef), false);
1467 signal?.Disconnect(hoverEventCallback);
1468 hoverEventCallback = null;
1471 if (hitTestResultDataCallback != null)
1473 NUILog.Debug($"[Dispose] hitTestResultDataCallback");
1475 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorHitTestResultSignal(GetBaseHandleCPtrHandleRef), false);
1476 signal?.Disconnect(hitTestResultDataCallback);
1477 hitTestResultDataCallback = null;
1481 if (interceptTouchDataCallback != null)
1483 NUILog.Debug($"[Dispose] interceptTouchDataCallback");
1485 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(GetBaseHandleCPtrHandleRef), false);
1486 signal?.Disconnect(interceptTouchDataCallback);
1487 interceptTouchDataCallback = null;
1490 if (touchDataCallback != null)
1492 NUILog.Debug($"[Dispose] touchDataCallback");
1494 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(GetBaseHandleCPtrHandleRef), false);
1495 signal?.Disconnect(touchDataCallback);
1496 touchDataCallback = null;
1499 if (ResourcesLoadedCallback != null)
1501 NUILog.Debug($"[Dispose] ResourcesLoadedCallback");
1503 using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1504 signal?.Disconnect(ResourcesLoadedCallback);
1505 ResourcesLoadedCallback = null;
1508 if (keyCallback != null)
1510 NUILog.Debug($"[Dispose] keyCallback");
1512 using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(GetBaseHandleCPtrHandleRef), false);
1513 signal?.Disconnect(keyCallback);
1517 if (keyInputFocusLostCallback != null)
1519 NUILog.Debug($"[Dispose] keyInputFocusLostCallback");
1521 using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(GetBaseHandleCPtrHandleRef), false);
1522 signal?.Disconnect(keyInputFocusLostCallback);
1523 keyInputFocusLostCallback = null;
1524 keyInputFocusLostEventHandler = null;
1527 if (keyInputFocusGainedCallback != null)
1529 NUILog.Debug($"[Dispose] keyInputFocusGainedCallback");
1531 using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(GetBaseHandleCPtrHandleRef), false);
1532 signal?.Disconnect(keyInputFocusGainedCallback);
1533 keyInputFocusGainedCallback = null;
1534 keyInputFocusGainedEventHandler = null;
1537 if (backgroundResourceLoadedCallback != null)
1539 NUILog.Debug($"[Dispose] backgroundResourceLoadedCallback");
1541 using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1542 signal?.Disconnect(backgroundResourceLoadedCallback);
1543 backgroundResourceLoadedCallback = null;
1546 if (onWindowSendEventCallback != null)
1548 NUILog.Debug($"[Dispose] onWindowSendEventCallback");
1550 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1551 signal?.Disconnect(onWindowSendEventCallback);
1552 onWindowSendEventCallback = null;
1554 NUILog.Debug($"[Dispose] DisConnectFromSignals END");
1558 /// Apply initial style to the view.
1560 [EditorBrowsable(EditorBrowsableState.Never)]
1561 protected virtual void InitializeStyle(ViewStyle style = null)
1564 // tv profile doesn't use NUI Style, so do nothing and just return here!
1567 var initialStyle = ThemeManager.GetInitialStyleWithoutClone(GetType());
1570 ApplyStyle(initialStyle);
1574 var refinedStyle = style;
1575 if (style.IncludeDefaultStyle)
1577 refinedStyle = initialStyle?.Merge(style);
1579 ApplyStyle(refinedStyle);
1582 // Listen theme change event if needs.
1583 if (ThemeManager.PlatformThemeEnabled && initialStyle != null)
1589 private View ConvertIdToView(uint id)
1591 View view = GetParent()?.FindCurrentChildById(id);
1593 //If we can't find the parent's children, find in the top layer.
1596 Container parent = GetParent();
1597 while ((parent is View) && (parent != null))
1599 parent = parent.GetParent();
1600 if (parent is Layer)
1602 view = parent.FindCurrentChildById(id);
1611 private void OnScaleChanged(float x, float y, float z)
1613 Scale = new Vector3(x, y, z);
1616 private void OnBackgroundColorChanged(float r, float g, float b, float a)
1618 BackgroundColor = new Color(r, g, b, a);
1621 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1623 Padding = new Extents(start, end, top, bottom);
1626 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1628 Margin = new Extents(start, end, top, bottom);
1631 private void OnAnchorPointChanged(float x, float y, float z)
1633 AnchorPoint = new Position(x, y, z);
1636 private void OnCellIndexChanged(float x, float y)
1638 CellIndex = new Vector2(x, y);
1641 private void OnFlexMarginChanged(float x, float y, float z, float w)
1643 FlexMargin = new Vector4(x, y, z, w);
1646 private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1648 PaddingEX = new Extents(start, end, top, bottom);
1651 private void OnSizeModeFactorChanged(float x, float y, float z)
1653 SizeModeFactor = new Vector3(x, y, z);
1656 private bool EmptyOnTouch(object target, TouchEventArgs args)
1661 [EditorBrowsable(EditorBrowsableState.Never)]
1662 protected virtual bool CheckResourceReady()
1667 private ViewSelectorData EnsureSelectorData()
1669 if (themeData == null) themeData = new ThemeData();
1671 return themeData.selectorData ?? (themeData.selectorData = new ViewSelectorData());
1674 [Conditional("NUI_DISPOSE_DEBUG_ON")]
1675 private void disposeDebugging(DisposeTypes type)
1677 DebugFileLogging.Instance.WriteLog($"View.Dispose({type}) START");
1678 DebugFileLogging.Instance.WriteLog($"type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
1681 DebugFileLogging.Instance.WriteLog($"ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
1685 DebugFileLogging.Instance.WriteLog($"has no native body!");