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;
34 internal enum BackgroundExtraDataUpdatedFlag : byte
36 BackgroundCornerRadius = 1 << 0,
37 BackgroundBorderline = 1 << 1,
38 ShadowCornerRadius = 1 << 2,
39 ContentsCornerRadius = 1 << 3, /// Subclass cases.
40 ContentsBorderline = 1 << 4, /// Subclass cases.
42 Background = BackgroundCornerRadius | BackgroundBorderline,
43 Shadow = ShadowCornerRadius,
45 CornerRadius = BackgroundCornerRadius | ShadowCornerRadius | ContentsCornerRadius,
46 Borderline = BackgroundBorderline | ContentsBorderline,
49 All = Background | Shadow,
52 internal BackgroundExtraDataUpdatedFlag backgroundExtraDataUpdatedFlag = BackgroundExtraDataUpdatedFlag.None;
54 private bool backgroundExtraDataUpdateProcessAttachedFlag = false;
56 internal virtual LayoutItem CreateDefaultLayout()
58 return new AbsoluteLayout();
61 internal class ThemeData
64 private enum States : byte
67 ControlStatePropagation = 1 << 0,
68 ThemeChangeSensitive = 1 << 1,
69 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.
70 // That indicates the view can have different styles by theme.
71 // Hence if the current state has ThemeApplied and ThemeChangeSensitive, the view will change its style by theme changing.
72 ListeningThemeChangeEvent = 1 << 3,
75 private States states = ThemeManager.ApplicationThemeChangeSensitive ? States.ThemeChangeSensitive : States.None;
76 public ViewStyle viewStyle;
77 public ControlState controlStates = ControlState.Normal;
78 public ViewSelectorData selectorData;
80 public bool ControlStatePropagation
82 get => ((states & States.ControlStatePropagation) != 0);
83 set => SetOption(States.ControlStatePropagation, value);
86 public bool ThemeChangeSensitive
88 get => ((states & States.ThemeChangeSensitive) != 0);
89 set => SetOption(States.ThemeChangeSensitive, value);
92 public bool ThemeApplied
94 get => ((states & States.ThemeApplied) != 0);
95 set => SetOption(States.ThemeApplied, value);
98 public bool ListeningThemeChangeEvent
100 get => ((states & States.ListeningThemeChangeEvent) != 0);
101 set => SetOption(States.ListeningThemeChangeEvent, value);
104 private void SetOption(States option, bool value)
106 if (value) states |= option;
107 else states &= ~option;
112 /// The color mode of View.
113 /// This specifies whether the View uses its own color, or inherits its parent color.
114 /// The default is ColorMode.UseOwnMultiplyParentColor.
116 internal ColorMode ColorMode
124 return GetColorMode();
128 internal LayoutLength SuggestedMinimumWidth
132 float result = Interop.Actor.GetSuggestedMinimumWidth(SwigCPtr);
133 if (NDalicPINVOKE.SWIGPendingException.Pending)
134 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135 return new LayoutLength(result);
139 internal LayoutLength SuggestedMinimumHeight
143 float result = Interop.Actor.GetSuggestedMinimumHeight(SwigCPtr);
144 if (NDalicPINVOKE.SWIGPendingException.Pending)
145 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146 return new LayoutLength(result);
150 internal float WorldPositionX
155 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionX);
159 internal float WorldPositionY
164 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionY);
168 internal float WorldPositionZ
173 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionZ);
177 internal bool FocusState
181 return IsKeyboardFocusable();
185 SetKeyboardFocusable(value);
189 internal void SetLayout(LayoutItem layout)
193 this.layout = layout;
194 this.layout?.AttachToOwner(this);
195 this.layout?.RequestLayout();
198 internal void AttachTransitionsToChildren(LayoutTransition transition)
200 // Iterate children, adding the transition unless a transition
201 // for the same condition and property has already been
203 foreach (View view in Children)
205 LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
209 internal float ParentOriginX
214 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginX);
219 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.WorldPositionX, value);
220 NotifyPropertyChanged();
224 internal float ParentOriginY
229 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginY);
234 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginY, value);
235 NotifyPropertyChanged();
239 internal float ParentOriginZ
244 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ);
249 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ, value);
250 NotifyPropertyChanged();
254 internal float PivotPointX
259 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointX);
264 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointX, value);
268 internal float PivotPointY
273 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointY);
278 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointY, value);
282 internal float PivotPointZ
287 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ);
292 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ, value);
296 internal Matrix WorldMatrix
300 Matrix returnValue = new Matrix();
301 PropertyValue wordMatrix = GetProperty(View.Property.WorldMatrix);
302 wordMatrix?.Get(returnValue);
303 wordMatrix?.Dispose();
309 /// The number of layouts including view's layout and children's layouts.
310 /// This can be used to set/unset Process callback to calculate Layout.
312 internal int LayoutCount
321 if (layoutCount == value) return;
323 if (value < 0) throw new global::System.ArgumentOutOfRangeException(nameof(LayoutCount), "LayoutCount(" + LayoutCount + ") should not be less than zero");
325 int diff = value - layoutCount;
328 if (InternalParent != null)
330 var parentView = InternalParent as View;
331 if (parentView != null)
333 parentView.LayoutCount += diff;
337 var parentLayer = InternalParent as Layer;
338 if (parentLayer != null)
340 parentLayer.LayoutCount += diff;
348 /// Indicates that this View should listen Touch event to handle its ControlState.
350 private bool enableControlState = false;
352 private int LeftFocusableViewId
357 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId);
362 Object.InternalSetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId, value);
366 private int RightFocusableViewId
371 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId);
376 Object.InternalSetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId, value);
380 private int UpFocusableViewId
385 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId);
390 Object.InternalSetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId, value);
394 private int DownFocusableViewId
399 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId);
404 Object.InternalSetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId, value);
408 private int ClockwiseFocusableViewId
413 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId);
418 Object.InternalSetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId, value);
422 private int CounterClockwiseFocusableViewId
427 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId);
432 Object.InternalSetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId, value);
436 internal string GetName()
438 string ret = Interop.Actor.GetName(SwigCPtr);
439 if (NDalicPINVOKE.SWIGPendingException.Pending)
440 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
444 internal void SetName(string name)
446 Interop.Actor.SetName(SwigCPtr, name);
447 if (NDalicPINVOKE.SWIGPendingException.Pending)
448 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451 internal uint GetId()
453 uint ret = Interop.Actor.GetId(SwigCPtr);
454 if (NDalicPINVOKE.SWIGPendingException.Pending)
455 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
459 internal bool IsRoot()
461 bool ret = Interop.ActorInternal.IsRoot(SwigCPtr);
462 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
466 internal bool OnWindow()
468 bool ret = Interop.Actor.OnStage(SwigCPtr);
469 if (NDalicPINVOKE.SWIGPendingException.Pending)
470 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
474 internal View FindChildById(uint id)
476 //to fix memory leak issue, match the handle count with native side.
477 IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
478 View ret = this.GetInstanceSafely<View>(cPtr);
479 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
483 internal override View FindCurrentChildById(uint id)
485 return FindChildById(id);
488 internal void SetParentOrigin(Position origin)
490 Interop.ActorInternal.SetParentOrigin(SwigCPtr, Position.getCPtr(origin));
491 if (NDalicPINVOKE.SWIGPendingException.Pending)
492 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
495 internal Position GetCurrentParentOrigin()
498 if(internalCurrentParentOrigin == null)
500 internalCurrentParentOrigin = new Position(0, 0, 0);
503 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.ParentOrigin, internalCurrentParentOrigin.SwigCPtr);
505 if (NDalicPINVOKE.SWIGPendingException.Pending)
507 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
509 return internalCurrentParentOrigin;
512 internal void SetAnchorPoint(Position anchorPoint)
514 Interop.Actor.SetAnchorPoint(SwigCPtr, Position.getCPtr(anchorPoint));
515 if (NDalicPINVOKE.SWIGPendingException.Pending)
516 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
519 internal Position GetCurrentAnchorPoint()
522 if(internalCurrentAnchorPoint == null)
524 internalCurrentAnchorPoint = new Position(0, 0, 0);
527 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.AnchorPoint, internalCurrentAnchorPoint.SwigCPtr);
529 if (NDalicPINVOKE.SWIGPendingException.Pending)
531 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 return internalCurrentAnchorPoint;
536 internal void SetSize(float width, float height)
538 Interop.ActorInternal.SetSize(SwigCPtr, width, height);
539 if (NDalicPINVOKE.SWIGPendingException.Pending)
540 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543 internal void SetSize(float width, float height, float depth)
545 Interop.ActorInternal.SetSize(SwigCPtr, width, height, depth);
546 if (NDalicPINVOKE.SWIGPendingException.Pending)
547 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
550 internal void SetSize(Vector2 size)
552 Interop.ActorInternal.SetSizeVector2(SwigCPtr, Vector2.getCPtr(size));
553 if (NDalicPINVOKE.SWIGPendingException.Pending)
554 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
557 internal void SetSize(Vector3 size)
559 Interop.ActorInternal.SetSizeVector3(SwigCPtr, Vector3.getCPtr(size));
560 if (NDalicPINVOKE.SWIGPendingException.Pending)
561 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 internal Vector3 GetTargetSize()
567 if(internalTargetSize == null)
569 internalTargetSize = new Vector3(0, 0, 0);
572 Interop.ActorInternal.RetrieveTargetSize(SwigCPtr, internalTargetSize.SwigCPtr);
574 if (NDalicPINVOKE.SWIGPendingException.Pending)
576 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
578 return internalTargetSize;
581 internal Size2D GetCurrentSize()
584 if(internalCurrentSize == null)
586 internalCurrentSize = new Size2D(0, 0);
589 Interop.ActorInternal.RetrieveCurrentPropertyVector2ActualVector3(SwigCPtr, Property.SIZE, internalCurrentSize.SwigCPtr);
591 if (NDalicPINVOKE.SWIGPendingException.Pending)
593 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
595 return internalCurrentSize;
598 internal Size2D GetCurrentSizeFloat()
600 Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
601 if (NDalicPINVOKE.SWIGPendingException.Pending)
602 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607 /// GetNaturalSize() function behaviour can be changed for each subclass of View.
608 /// So we make GetNaturalSize() function virtual, and make subclass can define it's owned logic
610 internal virtual Vector3 GetNaturalSize()
612 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
613 if (NDalicPINVOKE.SWIGPendingException.Pending)
614 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 internal void SetX(float x)
620 Interop.ActorInternal.SetX(SwigCPtr, x);
621 if (NDalicPINVOKE.SWIGPendingException.Pending)
622 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625 internal void SetY(float y)
627 Interop.ActorInternal.SetY(SwigCPtr, y);
628 if (NDalicPINVOKE.SWIGPendingException.Pending)
629 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632 internal void SetZ(float z)
634 Interop.ActorInternal.SetZ(SwigCPtr, z);
635 if (NDalicPINVOKE.SWIGPendingException.Pending)
636 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
639 internal void TranslateBy(Vector3 distance)
641 Interop.ActorInternal.TranslateBy(SwigCPtr, Vector3.getCPtr(distance));
642 if (NDalicPINVOKE.SWIGPendingException.Pending)
643 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
646 internal Position GetCurrentPosition()
649 if(internalCurrentPosition == null)
651 internalCurrentPosition = new Position(0, 0, 0);
654 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, Property.POSITION, internalCurrentPosition.SwigCPtr);
656 if (NDalicPINVOKE.SWIGPendingException.Pending)
658 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
660 return internalCurrentPosition;
662 internal Vector3 GetCurrentWorldPosition()
665 if(internalCurrentWorldPosition == null)
667 internalCurrentWorldPosition = new Vector3(0, 0, 0);
670 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldPosition, internalCurrentWorldPosition.SwigCPtr);
672 if (NDalicPINVOKE.SWIGPendingException.Pending)
674 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676 return internalCurrentWorldPosition;
679 internal Vector2 GetCurrentScreenPosition()
682 if(internalCurrentScreenPosition == null)
684 internalCurrentScreenPosition = new Vector2(0, 0);
687 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.ScreenPosition, internalCurrentScreenPosition.SwigCPtr);
689 if (NDalicPINVOKE.SWIGPendingException.Pending)
691 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
693 return internalCurrentScreenPosition;
696 internal Vector4 GetCurrentScreenPositionSize()
698 Vector4 ret = new Vector4(Interop.Actor.CurrentScreenExtents(SwigCPtr), true);
699 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
703 internal void SetInheritPosition(bool inherit)
705 Interop.ActorInternal.SetInheritPosition(SwigCPtr, inherit);
706 if (NDalicPINVOKE.SWIGPendingException.Pending)
707 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710 internal bool IsPositionInherited()
712 bool ret = Interop.ActorInternal.IsPositionInherited(SwigCPtr);
713 if (NDalicPINVOKE.SWIGPendingException.Pending)
714 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718 internal void SetOrientation(Degree angle, Vector3 axis)
720 Interop.ActorInternal.SetOrientationDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
721 if (NDalicPINVOKE.SWIGPendingException.Pending)
722 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725 internal void SetOrientation(Radian angle, Vector3 axis)
727 Interop.ActorInternal.SetOrientationRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
728 if (NDalicPINVOKE.SWIGPendingException.Pending)
729 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732 internal void SetOrientation(Rotation orientation)
734 Interop.ActorInternal.SetOrientationQuaternion(SwigCPtr, Rotation.getCPtr(orientation));
735 if (NDalicPINVOKE.SWIGPendingException.Pending)
736 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739 internal Rotation GetCurrentOrientation()
741 Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentOrientation(SwigCPtr), true);
742 if (NDalicPINVOKE.SWIGPendingException.Pending)
743 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 internal void SetInheritOrientation(bool inherit)
749 Interop.ActorInternal.SetInheritOrientation(SwigCPtr, inherit);
750 if (NDalicPINVOKE.SWIGPendingException.Pending)
751 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
754 internal bool IsOrientationInherited()
756 bool ret = Interop.ActorInternal.IsOrientationInherited(SwigCPtr);
757 if (NDalicPINVOKE.SWIGPendingException.Pending)
758 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762 internal Rotation GetCurrentWorldOrientation()
764 Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentWorldOrientation(SwigCPtr), true);
765 if (NDalicPINVOKE.SWIGPendingException.Pending)
766 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 internal void SetScale(float scale)
772 Interop.ActorInternal.SetScale(SwigCPtr, scale);
773 if (NDalicPINVOKE.SWIGPendingException.Pending)
774 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 internal void SetScale(float scaleX, float scaleY, float scaleZ)
779 Interop.ActorInternal.SetScale(SwigCPtr, scaleX, scaleY, scaleZ);
780 if (NDalicPINVOKE.SWIGPendingException.Pending)
781 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
784 internal void SetScale(Vector3 scale)
786 Interop.ActorInternal.SetScale(SwigCPtr, Vector3.getCPtr(scale));
787 if (NDalicPINVOKE.SWIGPendingException.Pending)
788 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 internal Vector3 GetCurrentScale()
794 if(internalCurrentScale == null)
796 internalCurrentScale = new Vector3(0, 0, 0);
799 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.SCALE, internalCurrentScale.SwigCPtr);
801 if (NDalicPINVOKE.SWIGPendingException.Pending)
803 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
805 return internalCurrentScale;
808 internal Vector3 GetCurrentWorldScale()
811 if(internalCurrentWorldScale == null)
813 internalCurrentWorldScale = new Vector3(0, 0, 0);
816 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldScale, internalCurrentWorldScale.SwigCPtr);
818 if (NDalicPINVOKE.SWIGPendingException.Pending)
820 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 return internalCurrentWorldScale;
825 internal void SetInheritScale(bool inherit)
827 Interop.ActorInternal.SetInheritScale(SwigCPtr, inherit);
828 if (NDalicPINVOKE.SWIGPendingException.Pending)
829 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
832 internal bool IsScaleInherited()
834 bool ret = Interop.ActorInternal.IsScaleInherited(SwigCPtr);
835 if (NDalicPINVOKE.SWIGPendingException.Pending)
836 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
840 internal Matrix GetCurrentWorldMatrix()
842 Matrix ret = new Matrix(Interop.ActorInternal.GetCurrentWorldMatrix(SwigCPtr), true);
843 if (NDalicPINVOKE.SWIGPendingException.Pending)
844 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
848 internal void SetVisible(bool visible)
850 Interop.Actor.SetVisible(SwigCPtr, visible);
851 if (NDalicPINVOKE.SWIGPendingException.Pending)
852 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856 /// Retrieve the View's current Visibility.
859 /// 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.
860 /// However, this method can get the current actual value updated in real time.
862 internal bool IsVisible()
864 bool ret = Interop.ActorInternal.IsVisible(SwigCPtr);
865 if (NDalicPINVOKE.SWIGPendingException.Pending)
866 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
870 internal void SetOpacity(float opacity)
872 Interop.ActorInternal.SetOpacity(SwigCPtr, opacity);
873 if (NDalicPINVOKE.SWIGPendingException.Pending)
874 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
877 internal float GetCurrentOpacity()
879 float ret = Interop.ActorInternal.GetCurrentOpacity(SwigCPtr);
880 if (NDalicPINVOKE.SWIGPendingException.Pending)
881 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
885 internal Vector4 GetCurrentColor()
888 if(internalCurrentColor == null)
890 internalCurrentColor = new Vector4(0, 0, 0, 0);
893 Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Interop.ActorProperty.ColorGet(), internalCurrentColor.SwigCPtr);
895 if (NDalicPINVOKE.SWIGPendingException.Pending)
897 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
899 return internalCurrentColor;
901 internal ColorMode GetColorMode()
903 ColorMode ret = (ColorMode)Interop.ActorInternal.GetColorMode(SwigCPtr);
904 if (NDalicPINVOKE.SWIGPendingException.Pending)
905 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
909 internal Vector4 GetCurrentWorldColor()
912 if(internalCurrentWorldColor == null)
914 internalCurrentWorldColor = new Vector4(0, 0, 0, 0);
917 Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Property.WorldColor, internalCurrentWorldColor.SwigCPtr);
919 if (NDalicPINVOKE.SWIGPendingException.Pending)
921 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
923 return internalCurrentWorldColor;
926 internal void SetDrawMode(DrawModeType drawMode)
928 Interop.ActorInternal.SetDrawMode(SwigCPtr, (int)drawMode);
929 if (NDalicPINVOKE.SWIGPendingException.Pending)
930 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
933 internal DrawModeType GetDrawMode()
935 DrawModeType ret = (DrawModeType)Interop.ActorInternal.GetDrawMode(SwigCPtr);
936 if (NDalicPINVOKE.SWIGPendingException.Pending)
937 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
941 internal void SetKeyboardFocusable(bool focusable)
943 Interop.ActorInternal.SetKeyboardFocusable(SwigCPtr, focusable);
944 if (NDalicPINVOKE.SWIGPendingException.Pending)
945 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948 internal bool IsKeyboardFocusable()
950 bool ret = Interop.ActorInternal.IsKeyboardFocusable(SwigCPtr);
951 if (NDalicPINVOKE.SWIGPendingException.Pending)
952 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
956 internal void SetKeyboardFocusableChildren(bool focusable)
958 Interop.ActorInternal.SetKeyboardFocusableChildren(SwigCPtr, focusable);
959 if (NDalicPINVOKE.SWIGPendingException.Pending)
960 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963 internal bool AreChildrenKeyBoardFocusable()
965 bool ret = Interop.ActorInternal.AreChildrenKeyBoardFocusable(SwigCPtr);
966 if (NDalicPINVOKE.SWIGPendingException.Pending)
967 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
971 internal void SetFocusableInTouch(bool enabled)
973 Interop.ActorInternal.SetFocusableInTouch(SwigCPtr, enabled);
974 if (NDalicPINVOKE.SWIGPendingException.Pending)
975 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
978 internal bool IsFocusableInTouch()
980 bool ret = Interop.ActorInternal.IsFocusableInTouch(SwigCPtr);
981 if (NDalicPINVOKE.SWIGPendingException.Pending)
982 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
986 internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
988 Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
989 if (NDalicPINVOKE.SWIGPendingException.Pending)
990 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
993 internal ResizePolicyType GetResizePolicy(DimensionType dimension)
995 ResizePolicyType ret = (ResizePolicyType)Interop.Actor.GetResizePolicy(SwigCPtr, (int)dimension);
996 if (NDalicPINVOKE.SWIGPendingException.Pending)
997 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1001 internal Vector3 GetSizeModeFactor()
1004 if (internalSizeModeFactor == null)
1006 internalSizeModeFactor = new Vector3(OnSizeModeFactorChanged, 0, 0, 0);
1008 Object.InternalRetrievingPropertyVector3(SwigCPtr, View.Property.SizeModeFactor, internalSizeModeFactor.SwigCPtr);
1009 return internalSizeModeFactor;
1012 internal void SetMinimumSize(Vector2 size)
1014 Interop.ActorInternal.SetMinimumSize(SwigCPtr, Vector2.getCPtr(size));
1015 if (NDalicPINVOKE.SWIGPendingException.Pending)
1016 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1019 internal Vector2 GetMinimumSize()
1022 if (internalMinimumSize == null)
1024 internalMinimumSize = new Size2D(OnMinimumSizeChanged, 0, 0);
1026 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MinimumSize, internalMinimumSize.SwigCPtr);
1027 return internalMinimumSize;
1030 internal void SetMaximumSize(Vector2 size)
1032 Interop.ActorInternal.SetMaximumSize(SwigCPtr, Vector2.getCPtr(size));
1033 if (NDalicPINVOKE.SWIGPendingException.Pending)
1034 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1037 internal Vector2 GetMaximumSize()
1040 if (internalMaximumSize == null)
1042 internalMaximumSize = new Size2D(OnMaximumSizeChanged, 0, 0);
1044 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MaximumSize, internalMaximumSize.SwigCPtr);
1045 return internalMaximumSize;
1048 internal int GetHierarchyDepth()
1050 int ret = Interop.Actor.GetHierarchyDepth(SwigCPtr);
1051 if (NDalicPINVOKE.SWIGPendingException.Pending)
1052 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1056 internal uint GetRendererCount()
1058 uint ret = Interop.Actor.GetRendererCount(SwigCPtr);
1059 if (NDalicPINVOKE.SWIGPendingException.Pending)
1060 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1064 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
1066 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1069 internal bool IsTopLevelView()
1071 if (GetParent() is Layer)
1079 /// Check whether Current view don't has BackgroundVisual or not.
1080 /// Some API (like Animation, Borderline) required non-empty backgrounds.
1082 internal bool IsBackgroundEmpty()
1084 int visualType = (int)Visual.Type.Invalid;
1085 Interop.View.InternalRetrievingVisualPropertyInt(this.SwigCPtr, Property.BACKGROUND, Visual.Property.Type, out visualType);
1086 return visualType == (int)Visual.Type.Invalid;
1090 /// Check whether Current view don't has ShadowVisual or not.
1092 internal bool IsShadowEmpty()
1094 int visualType = (int)Visual.Type.Invalid;
1095 Interop.View.InternalRetrievingVisualPropertyInt(this.SwigCPtr, Property.SHADOW, Visual.Property.Type, out visualType);
1096 return visualType == (int)Visual.Type.Invalid;
1099 internal void SetKeyInputFocus()
1101 Interop.ViewInternal.SetKeyInputFocus(SwigCPtr);
1102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1105 internal void ClearKeyInputFocus()
1107 Interop.ViewInternal.ClearKeyInputFocus(SwigCPtr);
1108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1111 internal PinchGestureDetector GetPinchGestureDetector()
1113 PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.GetPinchGestureDetector(SwigCPtr), true);
1114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1118 internal PanGestureDetector GetPanGestureDetector()
1120 PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.GetPanGestureDetector(SwigCPtr), true);
1121 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1125 internal TapGestureDetector GetTapGestureDetector()
1127 TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.GetTapGestureDetector(SwigCPtr), true);
1128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132 internal LongPressGestureDetector GetLongPressGestureDetector()
1134 LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.GetLongPressGestureDetector(SwigCPtr), true);
1135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1139 internal IntPtr GetPtrfromView()
1141 return (IntPtr)SwigCPtr;
1144 internal void RemoveChild(View child)
1146 // If the view had focus, it clears focus.
1147 if (child == FocusManager.Instance.GetCurrentFocusView())
1149 FocusManager.Instance.ClearFocus();
1151 // Do actual child removal
1152 Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
1153 if (NDalicPINVOKE.SWIGPendingException.Pending)
1154 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1156 Children.Remove(child);
1157 child.InternalParent = null;
1158 LayoutCount -= child.LayoutCount;
1160 OnChildRemoved(child);
1161 if (ChildRemoved != null)
1163 ChildRemovedEventArgs e = new ChildRemovedEventArgs
1167 ChildRemoved(this, e);
1172 /// Removes the layout from this View.
1174 internal void ResetLayout()
1181 internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1183 return (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1187 /// Lazy call to UpdateBackgroundExtraData.
1188 /// Collect Properties need to be update, and set properties that starts the Processing.
1190 internal virtual void UpdateBackgroundExtraData(BackgroundExtraDataUpdatedFlag flag)
1192 if (backgroundExtraData == null)
1197 if (!backgroundExtraDataUpdatedFlag.HasFlag(flag))
1199 backgroundExtraDataUpdatedFlag |= flag;
1200 // TODO : Re-open this API when we resolve Animation issue.
1201 // Instead, let we call UpdateBackgroundExtraData() synchronously.
1202 UpdateBackgroundExtraData();
1203 // if (!backgroundExtraDataUpdateProcessAttachedFlag)
1205 // backgroundExtraDataUpdateProcessAttachedFlag = true;
1206 // ProcessorController.Instance.ProcessorOnceEvent += UpdateBackgroundExtraData;
1207 // // Call process hardly.
1208 // ProcessorController.Instance.Awake();
1214 /// Callback function to Lazy UpdateBackgroundExtraData.
1216 private void UpdateBackgroundExtraData(object source, EventArgs e)
1218 // Note : To allow event attachment during UpdateBackgroundExtraData, let we make flag as false before call UpdateBackgroundExtraData().
1219 backgroundExtraDataUpdateProcessAttachedFlag = false;
1220 UpdateBackgroundExtraData();
1224 /// Update background extra data properties synchronously.
1225 /// After call this API, All background extra data properties updated.
1227 internal virtual void UpdateBackgroundExtraData()
1229 if (backgroundExtraData == null)
1234 if (IsShadowEmpty())
1236 backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.Shadow;
1238 if (!Rectangle.IsNullOrZero(backgroundExtraData.BackgroundImageBorder))
1240 backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.Background;
1243 if (backgroundExtraDataUpdatedFlag == BackgroundExtraDataUpdatedFlag.None)
1248 if ((backgroundExtraDataUpdatedFlag & BackgroundExtraDataUpdatedFlag.Borderline) != BackgroundExtraDataUpdatedFlag.None)
1252 if ((backgroundExtraDataUpdatedFlag & BackgroundExtraDataUpdatedFlag.CornerRadius) != BackgroundExtraDataUpdatedFlag.None)
1254 ApplyCornerRadius();
1256 backgroundExtraDataUpdatedFlag = BackgroundExtraDataUpdatedFlag.None;
1259 /// TODO open as a protected level
1260 internal virtual void ApplyCornerRadius()
1262 if (backgroundExtraData == null) return;
1264 // Update corner radius properties to background and shadow by ActionUpdateProperty
1265 if (backgroundExtraDataUpdatedFlag.HasFlag(BackgroundExtraDataUpdatedFlag.BackgroundCornerRadius))
1267 if (backgroundExtraData.CornerRadius != null)
1269 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1271 Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1273 if (backgroundExtraDataUpdatedFlag.HasFlag(BackgroundExtraDataUpdatedFlag.ShadowCornerRadius))
1275 if (backgroundExtraData.CornerRadius != null)
1277 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1279 Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1283 /// TODO open as a protected level
1284 internal virtual void ApplyBorderline()
1286 if (backgroundExtraData == null) return;
1288 // ActionUpdateProperty works well only if BACKGROUND visual setup before.
1289 // If view don't have BACKGROUND visual, we set transparent background color in default.
1290 if (IsBackgroundEmpty())
1292 // BACKGROUND visual doesn't exist.
1293 SetBackgroundColor(Color.Transparent);
1294 // SetBackgroundColor function apply borderline internally.
1295 // So we can just return now.
1299 // Update borderline properties to background by ActionUpdateProperty
1300 if (backgroundExtraDataUpdatedFlag.HasFlag(BackgroundExtraDataUpdatedFlag.BackgroundBorderline))
1302 Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineWidth, backgroundExtraData.BorderlineWidth);
1303 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineColor, Vector4.getCPtr(backgroundExtraData.BorderlineColor ?? Color.Black));
1304 Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineOffset, backgroundExtraData.BorderlineOffset);
1309 /// Get selector value from the triggerable selector or related property.
1311 internal Selector<T> GetSelector<T>(TriggerableSelector<T> triggerableSelector, NUI.Binding.BindableProperty relatedProperty)
1313 var selector = triggerableSelector?.Get();
1314 if (selector != null)
1319 var value = (T)GetValue(relatedProperty);
1320 return value == null ? null : new Selector<T>(value);
1323 internal void SetThemeApplied()
1325 if (themeData == null) themeData = new ThemeData();
1326 themeData.ThemeApplied = true;
1328 if (ThemeChangeSensitive && !themeData.ListeningThemeChangeEvent)
1330 themeData.ListeningThemeChangeEvent = true;
1331 ThemeManager.ThemeChangedInternal.Add(OnThemeChanged);
1336 /// you can override it to clean-up your own resources.
1338 /// <param name="type">DisposeTypes</param>
1339 /// <since_tizen> 3 </since_tizen>
1340 protected override void Dispose(DisposeTypes type)
1347 disposeDebugging(type);
1349 if (SwigCMemOwn && !IsNativeHandleInvalid())
1351 Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr);
1352 NDalicPINVOKE.ThrowExceptionIfExists();
1355 //_mergedStyle = null;
1357 internalMaximumSize?.Dispose();
1358 internalMaximumSize = null;
1359 internalMinimumSize?.Dispose();
1360 internalMinimumSize = null;
1361 internalMargin?.Dispose();
1362 internalMargin = null;
1363 internalPadding?.Dispose();
1364 internalPadding = null;
1365 internalSizeModeFactor?.Dispose();
1366 internalSizeModeFactor = null;
1367 internalCellIndex?.Dispose();
1368 internalCellIndex = null;
1369 internalBackgroundColor?.Dispose();
1370 internalBackgroundColor = null;
1371 internalColor?.Dispose();
1372 internalColor = null;
1373 internalPivotPoint?.Dispose();
1374 internalPivotPoint = null;
1375 internalPosition?.Dispose();
1376 internalPosition = null;
1377 internalPosition2D?.Dispose();
1378 internalPosition2D = null;
1379 internalScale?.Dispose();
1380 internalScale = null;
1381 internalSize?.Dispose();
1382 internalSize = null;
1383 internalSize2D?.Dispose();
1384 internalSize2D = null;
1386 panGestureDetector?.Dispose();
1387 panGestureDetector = null;
1388 longGestureDetector?.Dispose();
1389 longGestureDetector = null;
1390 pinchGestureDetector?.Dispose();
1391 pinchGestureDetector = null;
1392 tapGestureDetector?.Dispose();
1393 tapGestureDetector = null;
1394 rotationGestureDetector?.Dispose();
1395 rotationGestureDetector = null;
1397 internalCurrentParentOrigin?.Dispose();
1398 internalCurrentParentOrigin = null;
1399 internalCurrentAnchorPoint?.Dispose();
1400 internalCurrentAnchorPoint = null;
1401 internalTargetSize?.Dispose();
1402 internalTargetSize = null;
1403 internalCurrentSize?.Dispose();
1404 internalCurrentSize = null;
1405 internalCurrentPosition?.Dispose();
1406 internalCurrentPosition = null;
1407 internalCurrentWorldPosition?.Dispose();
1408 internalCurrentWorldPosition = null;
1409 internalCurrentScale?.Dispose();
1410 internalCurrentScale = null;
1411 internalCurrentWorldScale?.Dispose();
1412 internalCurrentWorldScale = null;
1413 internalCurrentColor?.Dispose();
1414 internalCurrentColor = null;
1415 internalCurrentWorldColor?.Dispose();
1416 internalCurrentWorldColor = null;
1417 internalSizeModeFactor?.Dispose();
1418 internalSizeModeFactor = null;
1419 internalCurrentScreenPosition?.Dispose();
1420 internalCurrentScreenPosition = null;
1422 if (type == DisposeTypes.Explicit)
1425 //Release your own managed resources here.
1426 //You should release all of your own disposable objects here.
1427 if (themeData != null)
1429 themeData.selectorData?.Reset(this);
1430 if (themeData.ListeningThemeChangeEvent)
1432 ThemeManager.ThemeChangedInternal.Remove(OnThemeChanged);
1435 if (widthConstraint != null)
1437 widthConstraint.Remove();
1438 widthConstraint.Dispose();
1440 if (heightConstraint != null)
1442 heightConstraint.Remove();
1443 heightConstraint.Dispose();
1447 //Release your own unmanaged resources here.
1448 //You should not access any managed member here except static instance.
1449 //because the execution order of Finalizes is non-deterministic.
1451 DisConnectFromSignals();
1453 foreach (View view in Children)
1455 view.InternalParent = null;
1458 backgroundExtraDataUpdatedFlag = BackgroundExtraDataUpdatedFlag.None;
1459 if (backgroundExtraDataUpdateProcessAttachedFlag)
1461 ProcessorController.Instance.ProcessorOnceEvent -= UpdateBackgroundExtraData;
1462 backgroundExtraDataUpdateProcessAttachedFlag = false;
1467 NUILog.Debug($"[Dispose] View.Dispose({type}) END");
1468 NUILog.Debug($"=============================");
1475 /// This will not be public opened.
1476 [EditorBrowsable(EditorBrowsableState.Never)]
1477 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1479 Interop.View.DeleteView(swigCPtr);
1483 /// The touch event handler for ControlState.
1484 /// Please change ControlState value by touch state if needed.
1486 /// <exception cref="ArgumentNullException"> Thrown when touch is null. </exception>
1487 [EditorBrowsable(EditorBrowsableState.Never)]
1488 protected virtual bool HandleControlStateOnTouch(Touch touch)
1492 throw new global::System.ArgumentNullException(nameof(touch));
1495 switch (touch.GetState(0))
1497 case PointStateType.Down:
1498 ControlState += ControlState.Pressed;
1500 case PointStateType.Interrupted:
1501 case PointStateType.Up:
1502 if (ControlState.Contains(ControlState.Pressed))
1504 ControlState -= ControlState.Pressed;
1514 /// Internal callback of enabled property changes.
1515 /// Inherited view can override this method to implements enabled property changes.
1517 [EditorBrowsable(EditorBrowsableState.Never)]
1518 protected virtual void OnEnabled(bool enabled)
1522 if (State == View.States.Disabled)
1524 State = View.States.Normal;
1526 if (enableControlState)
1528 ControlState -= ControlState.Disabled;
1533 State = View.States.Disabled;
1534 if (enableControlState)
1536 ControlState += ControlState.Disabled;
1542 private void DisConnectFromSignals()
1544 if (HasBody() == false)
1546 NUILog.Debug($"[Dispose] DisConnectFromSignals() No native body! No need to Disconnect Signals!");
1549 NUILog.Debug($"[Dispose] DisConnectFromSignals START");
1550 NUILog.Debug($"[Dispose] View.DisConnectFromSignals() type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
1551 NUILog.Debug($"[Dispose] ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
1553 if (onRelayoutEventCallback != null)
1555 NUILog.Debug($"[Dispose] onRelayoutEventCallback");
1557 Interop.ActorSignal.OnRelayoutDisconnect(GetBaseHandleCPtrHandleRef, onRelayoutEventCallback.ToHandleRef(this));
1558 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1559 onRelayoutEventCallback = null;
1562 if (offWindowEventCallback != null)
1564 NUILog.Debug($"[Dispose] offWindowEventCallback");
1566 Interop.ActorSignal.OffSceneDisconnect(GetBaseHandleCPtrHandleRef, offWindowEventCallback.ToHandleRef(this));
1567 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1568 offWindowEventCallback = null;
1571 if (onWindowEventCallback != null)
1573 NUILog.Debug($"[Dispose] onWindowEventCallback");
1575 Interop.ActorSignal.OnSceneDisconnect(GetBaseHandleCPtrHandleRef, onWindowEventCallback.ToHandleRef(this));
1576 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1577 onWindowEventCallback = null;
1580 if (interceptWheelCallback != null)
1582 NUILog.Debug($"[Dispose] interceptWheelCallback");
1584 Interop.ActorSignal.InterceptWheelDisconnect(GetBaseHandleCPtrHandleRef, interceptWheelCallback.ToHandleRef(this));
1585 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1586 interceptWheelCallback = null;
1589 if (wheelEventCallback != null)
1591 NUILog.Debug($"[Dispose] wheelEventCallback");
1593 Interop.ActorSignal.WheelEventDisconnect(GetBaseHandleCPtrHandleRef, wheelEventCallback.ToHandleRef(this));
1594 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1595 wheelEventCallback = null;
1598 if (hoverEventCallback != null)
1600 NUILog.Debug($"[Dispose] hoverEventCallback");
1602 Interop.ActorSignal.HoveredDisconnect(GetBaseHandleCPtrHandleRef, hoverEventCallback.ToHandleRef(this));
1603 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1604 hoverEventCallback = null;
1607 if (hitTestResultDataCallback != null)
1609 NUILog.Debug($"[Dispose] hitTestResultDataCallback");
1611 Interop.ActorSignal.HitTestResultDisconnect(GetBaseHandleCPtrHandleRef, hitTestResultDataCallback.ToHandleRef(this));
1612 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1613 hitTestResultDataCallback = null;
1617 if (interceptTouchDataCallback != null)
1619 NUILog.Debug($"[Dispose] interceptTouchDataCallback");
1621 Interop.ActorSignal.InterceptTouchDisconnect(GetBaseHandleCPtrHandleRef, interceptTouchDataCallback.ToHandleRef(this));
1622 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1623 interceptTouchDataCallback = null;
1626 if (touchDataCallback != null)
1628 NUILog.Debug($"[Dispose] touchDataCallback");
1630 Interop.ActorSignal.TouchDisconnect(GetBaseHandleCPtrHandleRef, touchDataCallback.ToHandleRef(this));
1631 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1632 touchDataCallback = null;
1635 if (resourcesLoadedCallback != null)
1637 NUILog.Debug($"[Dispose] ResourcesLoadedCallback");
1639 Interop.ViewSignal.ResourceReadyDisconnect(GetBaseHandleCPtrHandleRef, resourcesLoadedCallback.ToHandleRef(this));
1640 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1641 resourcesLoadedCallback = null;
1644 if (keyCallback != null)
1646 NUILog.Debug($"[Dispose] keyCallback");
1648 Interop.ViewSignal.KeyEventDisconnect(GetBaseHandleCPtrHandleRef, keyCallback.ToHandleRef(this));
1649 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1653 if (keyInputFocusLostCallback != null)
1655 NUILog.Debug($"[Dispose] keyInputFocusLostCallback");
1657 Interop.ViewSignal.KeyInputFocusLostDisconnect(GetBaseHandleCPtrHandleRef, keyInputFocusLostCallback.ToHandleRef(this));
1658 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1659 keyInputFocusLostCallback = null;
1660 keyInputFocusLostEventHandler = null;
1663 if (keyInputFocusGainedCallback != null)
1665 NUILog.Debug($"[Dispose] keyInputFocusGainedCallback");
1667 Interop.ViewSignal.KeyInputFocusGainedDisconnect(GetBaseHandleCPtrHandleRef, keyInputFocusGainedCallback.ToHandleRef(this));
1668 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1669 keyInputFocusGainedCallback = null;
1670 keyInputFocusGainedEventHandler = null;
1673 if (backgroundResourceLoadedCallback != null)
1675 NUILog.Debug($"[Dispose] backgroundResourceLoadedCallback");
1677 Interop.ViewSignal.ResourceReadyDisconnect(GetBaseHandleCPtrHandleRef, backgroundResourceLoadedCallback.ToHandleRef(this));
1678 NDalicPINVOKE.ThrowExceptionIfExistsDebug();
1679 backgroundResourceLoadedCallback = null;
1682 NDalicPINVOKE.ThrowExceptionIfExists();
1683 NUILog.Debug($"[Dispose] DisConnectFromSignals END");
1687 /// Apply initial style to the view.
1689 [EditorBrowsable(EditorBrowsableState.Never)]
1690 protected virtual void InitializeStyle(ViewStyle style = null)
1692 if (style == null && ThemeManager.InitialThemeDisabled)
1694 // Fast return in most TV cases.
1698 var initialStyle = ThemeManager.GetInitialStyleWithoutClone(GetType());
1701 ApplyStyle(initialStyle);
1705 var refinedStyle = style;
1706 if (style.IncludeDefaultStyle)
1708 refinedStyle = initialStyle?.Merge(style);
1710 ApplyStyle(refinedStyle);
1713 // Listen theme change event if needs.
1714 if (initialStyle != null)
1720 private View ConvertIdToView(uint id)
1722 View view = GetParent()?.FindCurrentChildById(id);
1724 //If we can't find the parent's children, find in the top layer.
1727 Container parent = GetParent();
1728 while ((parent is View) && (parent != null))
1730 parent = parent.GetParent();
1731 if (parent is Layer)
1733 view = parent.FindCurrentChildById(id);
1742 private void OnScaleChanged(float x, float y, float z)
1744 Scale = new Vector3(x, y, z);
1747 private void OnBackgroundColorChanged(float r, float g, float b, float a)
1749 BackgroundColor = new Color(r, g, b, a);
1752 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1754 Padding = new Extents(start, end, top, bottom);
1757 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1759 Margin = new Extents(start, end, top, bottom);
1762 private void OnAnchorPointChanged(float x, float y, float z)
1764 AnchorPoint = new Position(x, y, z);
1767 private void OnCellIndexChanged(float x, float y)
1769 CellIndex = new Vector2(x, y);
1772 private void OnFlexMarginChanged(float x, float y, float z, float w)
1774 FlexMargin = new Vector4(x, y, z, w);
1777 private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1779 PaddingEX = new Extents(start, end, top, bottom);
1782 private void OnSizeModeFactorChanged(float x, float y, float z)
1784 SizeModeFactor = new Vector3(x, y, z);
1787 private bool EmptyOnTouch(object target, TouchEventArgs args)
1792 [EditorBrowsable(EditorBrowsableState.Never)]
1793 protected virtual bool CheckResourceReady()
1798 private ViewSelectorData EnsureSelectorData()
1800 if (themeData == null) themeData = new ThemeData();
1802 return themeData.selectorData ?? (themeData.selectorData = new ViewSelectorData());
1805 [Conditional("NUI_DISPOSE_DEBUG_ON")]
1806 private void disposeDebugging(DisposeTypes type)
1808 DebugFileLogging.Instance.WriteLog($"View.Dispose({type}) START");
1809 DebugFileLogging.Instance.WriteLog($"type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
1812 DebugFileLogging.Instance.WriteLog($"ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
1816 DebugFileLogging.Instance.WriteLog($"has no native body!");