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
131 #if NUI_PROPERTY_CHANGE_3
132 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionX);
134 float returnValue = 0.0f;
135 PropertyValue wordPositionX = GetProperty(View.Property.WorldPositionX);
136 wordPositionX?.Get(out returnValue);
137 wordPositionX?.Dispose();
143 internal float WorldPositionY
147 #if NUI_PROPERTY_CHANGE_3
148 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionY);
150 float returnValue = 0.0f;
151 PropertyValue wordPositionY = GetProperty(View.Property.WorldPositionY);
152 wordPositionY?.Get(out returnValue);
153 wordPositionY?.Dispose();
159 internal float WorldPositionZ
163 #if NUI_PROPERTY_CHANGE_3
164 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.WorldPositionZ);
166 float returnValue = 0.0f;
167 PropertyValue wordPositionZ = GetProperty(View.Property.WorldPositionZ);
168 wordPositionZ?.Get(out returnValue);
169 wordPositionZ?.Dispose();
175 internal bool FocusState
179 return IsKeyboardFocusable();
183 SetKeyboardFocusable(value);
187 internal void SetLayout(LayoutItem layout)
191 this.layout = layout;
192 this.layout?.AttachToOwner(this);
193 this.layout?.RequestLayout();
196 internal void AttachTransitionsToChildren(LayoutTransition transition)
198 // Iterate children, adding the transition unless a transition
199 // for the same condition and property has already been
201 foreach (View view in Children)
203 LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
207 internal float ParentOriginX
211 #if NUI_PROPERTY_CHANGE_3
212 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginX);
214 float returnValue = 0.0f;
215 PropertyValue parentOriginX = GetProperty(View.Property.ParentOriginX);
216 parentOriginX?.Get(out returnValue);
217 parentOriginX?.Dispose();
223 #if NUI_PROPERTY_CHANGE_3
224 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.WorldPositionX, value);
226 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
227 SetProperty(View.Property.ParentOriginX, setValue);
230 NotifyPropertyChanged();
234 internal float ParentOriginY
238 #if NUI_PROPERTY_CHANGE_3
239 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginY);
241 float returnValue = 0.0f;
242 PropertyValue parentOriginY = GetProperty(View.Property.ParentOriginY);
243 parentOriginY?.Get(out returnValue);
244 parentOriginY?.Dispose();
250 #if NUI_PROPERTY_CHANGE_3
251 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginY, value);
254 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
255 SetProperty(View.Property.ParentOriginY, setValue);
258 NotifyPropertyChanged();
262 internal float ParentOriginZ
266 #if NUI_PROPERTY_CHANGE_3
267 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ);
269 float returnValue = 0.0f;
270 PropertyValue parentOriginZ = GetProperty(View.Property.ParentOriginZ);
271 parentOriginZ?.Get(out returnValue);
272 parentOriginZ?.Dispose();
278 #if NUI_PROPERTY_CHANGE_3
279 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.ParentOriginZ, value);
281 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
282 SetProperty(View.Property.ParentOriginZ, setValue);
285 NotifyPropertyChanged();
289 internal float PivotPointX
293 #if NUI_PROPERTY_CHANGE_3
294 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointX);
296 float returnValue = 0.0f;
297 PropertyValue anchorPointX = GetProperty(View.Property.AnchorPointX);
298 anchorPointX?.Get(out returnValue);
299 anchorPointX?.Dispose();
305 #if NUI_PROPERTY_CHANGE_3
306 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointX, value);
308 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
309 SetProperty(View.Property.AnchorPointX, setValue);
315 internal float PivotPointY
319 #if NUI_PROPERTY_CHANGE_3
320 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointY);
323 float returnValue = 0.0f;
324 PropertyValue anchorPointY = GetProperty(View.Property.AnchorPointY);
325 anchorPointY?.Get(out returnValue);
326 anchorPointY?.Dispose();
332 #if NUI_PROPERTY_CHANGE_3
333 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointY, value);
335 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
336 SetProperty(View.Property.AnchorPointY, setValue);
342 internal float PivotPointZ
346 #if NUI_PROPERTY_CHANGE_3
347 return Object.InternalGetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ);
349 float returnValue = 0.0f;
350 PropertyValue anchorPointZ = GetProperty(View.Property.AnchorPointZ);
351 anchorPointZ?.Get(out returnValue);
352 anchorPointZ?.Dispose();
358 #if NUI_PROPERTY_CHANGE_3
359 Object.InternalSetPropertyFloat(SwigCPtr, View.Property.AnchorPointZ, value);
361 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
362 SetProperty(View.Property.AnchorPointZ, setValue);
368 internal Matrix WorldMatrix
372 Matrix returnValue = new Matrix();
373 PropertyValue wordMatrix = GetProperty(View.Property.WorldMatrix);
374 wordMatrix?.Get(returnValue);
375 wordMatrix?.Dispose();
381 /// The number of layouts including view's layout and children's layouts.
382 /// This can be used to set/unset Process callback to calculate Layout.
384 internal int LayoutCount
393 if (layoutCount == value) return;
395 if (value < 0) throw new global::System.ArgumentOutOfRangeException(nameof(LayoutCount), "LayoutCount(" + LayoutCount + ") should not be less than zero");
397 int diff = value - layoutCount;
400 if (InternalParent != null)
402 var parentView = InternalParent as View;
403 if (parentView != null)
405 parentView.LayoutCount += diff;
409 var parentLayer = InternalParent as Layer;
410 if (parentLayer != null)
412 parentLayer.LayoutCount += diff;
420 /// Indicates that this View should listen Touch event to handle its ControlState.
422 private bool enableControlState = false;
424 private int LeftFocusableViewId
428 #if NUI_PROPERTY_CHANGE_3
429 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId);
432 PropertyValue leftFocusableViewId = GetProperty(View.Property.LeftFocusableViewId);
433 leftFocusableViewId?.Get(out returnValue);
434 leftFocusableViewId?.Dispose();
440 #if NUI_PROPERTY_CHANGE_3
441 Object.InternalSetPropertyInt(SwigCPtr, View.Property.LeftFocusableViewId, value);
443 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
444 SetProperty(View.Property.LeftFocusableViewId, setValue);
450 private int RightFocusableViewId
454 #if NUI_PROPERTY_CHANGE_3
455 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId);
458 PropertyValue rightFocusableViewId = GetProperty(View.Property.RightFocusableViewId);
459 rightFocusableViewId?.Get(out returnValue);
460 rightFocusableViewId?.Dispose();
466 #if NUI_PROPERTY_CHANGE_3
467 Object.InternalSetPropertyInt(SwigCPtr, View.Property.RightFocusableViewId, value);
469 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
470 SetProperty(View.Property.RightFocusableViewId, setValue);
476 private int UpFocusableViewId
480 #if NUI_PROPERTY_CHANGE_3
481 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId);
484 PropertyValue upFocusableViewId = GetProperty(View.Property.UpFocusableViewId);
485 upFocusableViewId?.Get(out returnValue);
486 upFocusableViewId?.Dispose();
492 #if NUI_PROPERTY_CHANGE_3
493 Object.InternalSetPropertyInt(SwigCPtr, View.Property.UpFocusableViewId, value);
495 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
496 SetProperty(View.Property.UpFocusableViewId, setValue);
502 private int DownFocusableViewId
506 #if NUI_PROPERTY_CHANGE_3
507 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId);
510 PropertyValue downFocusableViewId = GetProperty(View.Property.DownFocusableViewId);
511 downFocusableViewId?.Get(out returnValue);
512 downFocusableViewId?.Dispose();
518 #if NUI_PROPERTY_CHANGE_3
519 Object.InternalSetPropertyInt(SwigCPtr, View.Property.DownFocusableViewId, value);
521 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
522 SetProperty(View.Property.DownFocusableViewId, setValue);
528 private int ClockwiseFocusableViewId
532 #if NUI_PROPERTY_CHANGE_3
533 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId);
535 int returnValue = -1;
536 PropertyValue clockwiseFocusableViewId = GetProperty(View.Property.ClockwiseFocusableViewId);
537 clockwiseFocusableViewId?.Get(out returnValue);
538 clockwiseFocusableViewId?.Dispose();
544 #if NUI_PROPERTY_CHANGE_3
545 Object.InternalSetPropertyInt(SwigCPtr, View.Property.ClockwiseFocusableViewId, value);
547 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
548 SetProperty(View.Property.ClockwiseFocusableViewId, setValue);
554 private int CounterClockwiseFocusableViewId
558 #if NUI_PROPERTY_CHANGE_3
559 return Object.InternalGetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId);
561 int returnValue = -1;
562 PropertyValue counterClockwiseFocusableViewId = GetProperty(View.Property.CounterClockwiseFocusableViewId);
563 counterClockwiseFocusableViewId?.Get(out returnValue);
564 counterClockwiseFocusableViewId?.Dispose();
570 #if NUI_PROPERTY_CHANGE_3
571 Object.InternalSetPropertyInt(SwigCPtr, View.Property.CounterClockwiseFocusableViewId, value);
573 PropertyValue setValue = new Tizen.NUI.PropertyValue(value);
574 SetProperty(View.Property.CounterClockwiseFocusableViewId, setValue);
580 internal string GetName()
582 string ret = Interop.Actor.GetName(SwigCPtr);
583 if (NDalicPINVOKE.SWIGPendingException.Pending)
584 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
588 internal void SetName(string name)
590 Interop.Actor.SetName(SwigCPtr, name);
591 if (NDalicPINVOKE.SWIGPendingException.Pending)
592 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
595 internal uint GetId()
597 uint ret = Interop.Actor.GetId(SwigCPtr);
598 if (NDalicPINVOKE.SWIGPendingException.Pending)
599 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
603 internal bool IsRoot()
605 bool ret = Interop.ActorInternal.IsRoot(SwigCPtr);
606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610 internal bool OnWindow()
612 bool ret = Interop.Actor.OnStage(SwigCPtr);
613 if (NDalicPINVOKE.SWIGPendingException.Pending)
614 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 internal View FindChildById(uint id)
620 //to fix memory leak issue, match the handle count with native side.
621 IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
622 View ret = this.GetInstanceSafely<View>(cPtr);
623 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
627 internal override View FindCurrentChildById(uint id)
629 return FindChildById(id);
632 internal void SetParentOrigin(Position origin)
634 Interop.ActorInternal.SetParentOrigin(SwigCPtr, Position.getCPtr(origin));
635 if (NDalicPINVOKE.SWIGPendingException.Pending)
636 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
639 internal Position GetCurrentParentOrigin()
641 #if NUI_PROPERTY_CHANGE_3
642 if(internalCurrentParentOrigin == null)
644 internalCurrentParentOrigin = new Position(0, 0, 0);
647 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.ParentOrigin, internalCurrentParentOrigin.SwigCPtr);
649 if (NDalicPINVOKE.SWIGPendingException.Pending)
651 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
653 return internalCurrentParentOrigin;
655 Position ret = new Position(Interop.ActorInternal.GetCurrentParentOrigin(SwigCPtr), true);
657 if (NDalicPINVOKE.SWIGPendingException.Pending)
658 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
663 internal void SetAnchorPoint(Position anchorPoint)
665 Interop.Actor.SetAnchorPoint(SwigCPtr, Position.getCPtr(anchorPoint));
666 if (NDalicPINVOKE.SWIGPendingException.Pending)
667 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670 internal Position GetCurrentAnchorPoint()
672 #if NUI_PROPERTY_CHANGE_3
673 if(internalCurrentAnchorPoint == null)
675 internalCurrentAnchorPoint = new Position(0, 0, 0);
678 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.AnchorPoint, internalCurrentAnchorPoint.SwigCPtr);
680 if (NDalicPINVOKE.SWIGPendingException.Pending)
682 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
684 return internalCurrentAnchorPoint;
686 Position ret = new Position(Interop.ActorInternal.GetCurrentAnchorPoint(SwigCPtr), true);
687 if (NDalicPINVOKE.SWIGPendingException.Pending)
688 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
693 internal void SetSize(float width, float height)
695 Interop.ActorInternal.SetSize(SwigCPtr, width, height);
696 if (NDalicPINVOKE.SWIGPendingException.Pending)
697 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 internal void SetSize(float width, float height, float depth)
702 Interop.ActorInternal.SetSize(SwigCPtr, width, height, depth);
703 if (NDalicPINVOKE.SWIGPendingException.Pending)
704 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
707 internal void SetSize(Vector2 size)
709 Interop.ActorInternal.SetSizeVector2(SwigCPtr, Vector2.getCPtr(size));
710 if (NDalicPINVOKE.SWIGPendingException.Pending)
711 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
714 internal void SetSize(Vector3 size)
716 Interop.ActorInternal.SetSizeVector3(SwigCPtr, Vector3.getCPtr(size));
717 if (NDalicPINVOKE.SWIGPendingException.Pending)
718 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
721 internal Vector3 GetTargetSize()
723 #if NUI_PROPERTY_CHANGE_3
724 if(internalTargetSize == null)
726 internalTargetSize = new Vector3(0, 0, 0);
729 Interop.ActorInternal.RetrieveTargetSize(SwigCPtr, internalTargetSize.SwigCPtr);
731 if (NDalicPINVOKE.SWIGPendingException.Pending)
733 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
735 return internalTargetSize;
737 Vector3 ret = new Vector3(Interop.ActorInternal.GetTargetSize(SwigCPtr), true);
738 if (NDalicPINVOKE.SWIGPendingException.Pending)
739 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
744 internal Size2D GetCurrentSize()
746 #if NUI_PROPERTY_CHANGE_3
747 if(internalCurrentSize == null)
749 internalCurrentSize = new Size2D(0, 0);
752 Interop.ActorInternal.RetrieveCurrentPropertyVector2ActualVector3(SwigCPtr, Property.SIZE, internalCurrentSize.SwigCPtr);
754 if (NDalicPINVOKE.SWIGPendingException.Pending)
756 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 return internalCurrentSize;
760 Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
761 if (NDalicPINVOKE.SWIGPendingException.Pending)
762 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 Size2D size = new Size2D((int)ret.Width, (int)ret.Height);
769 internal Size2D GetCurrentSizeFloat()
771 Size ret = new Size(Interop.Actor.GetCurrentSize(SwigCPtr), true);
772 if (NDalicPINVOKE.SWIGPendingException.Pending)
773 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778 /// GetNaturalSize() function behaviour can be changed for each subclass of View.
779 /// So we make GetNaturalSize() function virtual, and make subclass can define it's owned logic
781 internal virtual Vector3 GetNaturalSize()
783 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
784 if (NDalicPINVOKE.SWIGPendingException.Pending)
785 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
789 internal void SetX(float x)
791 Interop.ActorInternal.SetX(SwigCPtr, x);
792 if (NDalicPINVOKE.SWIGPendingException.Pending)
793 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
796 internal void SetY(float y)
798 Interop.ActorInternal.SetY(SwigCPtr, y);
799 if (NDalicPINVOKE.SWIGPendingException.Pending)
800 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
803 internal void SetZ(float z)
805 Interop.ActorInternal.SetZ(SwigCPtr, z);
806 if (NDalicPINVOKE.SWIGPendingException.Pending)
807 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810 internal void TranslateBy(Vector3 distance)
812 Interop.ActorInternal.TranslateBy(SwigCPtr, Vector3.getCPtr(distance));
813 if (NDalicPINVOKE.SWIGPendingException.Pending)
814 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
817 internal Position GetCurrentPosition()
819 #if NUI_PROPERTY_CHANGE_3
820 if(internalCurrentPosition == null)
822 internalCurrentPosition = new Position(0, 0, 0);
825 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, Property.POSITION, internalCurrentPosition.SwigCPtr);
827 if (NDalicPINVOKE.SWIGPendingException.Pending)
829 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
831 return internalCurrentPosition;
834 Position ret = new Position(Interop.Actor.GetCurrentPosition(SwigCPtr), true);
835 if (NDalicPINVOKE.SWIGPendingException.Pending)
836 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
840 internal Vector3 GetCurrentWorldPosition()
842 #if NUI_PROPERTY_CHANGE_3
843 if(internalCurrentWorldPosition == null)
845 internalCurrentWorldPosition = new Vector3(0, 0, 0);
848 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldPosition, internalCurrentWorldPosition.SwigCPtr);
850 if (NDalicPINVOKE.SWIGPendingException.Pending)
852 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
854 return internalCurrentWorldPosition;
856 Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldPosition(SwigCPtr), true);
857 if (NDalicPINVOKE.SWIGPendingException.Pending)
858 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
863 internal Vector2 GetCurrentScreenPosition()
865 #if NUI_VISUAL_PROPERTY_CHANGE_1
866 if(internalCurrentScreenPosition == null)
868 internalCurrentScreenPosition = new Vector2(0, 0);
871 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.ScreenPosition, internalCurrentScreenPosition.SwigCPtr);
873 if (NDalicPINVOKE.SWIGPendingException.Pending)
875 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
877 return internalCurrentScreenPosition;
879 Vector2 temp = new Vector2(0.0f, 0.0f);
880 var pValue = GetProperty(View.Property.ScreenPosition);
887 internal void SetInheritPosition(bool inherit)
889 Interop.ActorInternal.SetInheritPosition(SwigCPtr, inherit);
890 if (NDalicPINVOKE.SWIGPendingException.Pending)
891 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
894 internal bool IsPositionInherited()
896 bool ret = Interop.ActorInternal.IsPositionInherited(SwigCPtr);
897 if (NDalicPINVOKE.SWIGPendingException.Pending)
898 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
902 internal void SetOrientation(Degree angle, Vector3 axis)
904 Interop.ActorInternal.SetOrientationDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
905 if (NDalicPINVOKE.SWIGPendingException.Pending)
906 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
909 internal void SetOrientation(Radian angle, Vector3 axis)
911 Interop.ActorInternal.SetOrientationRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
912 if (NDalicPINVOKE.SWIGPendingException.Pending)
913 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
916 internal void SetOrientation(Rotation orientation)
918 Interop.ActorInternal.SetOrientationQuaternion(SwigCPtr, Rotation.getCPtr(orientation));
919 if (NDalicPINVOKE.SWIGPendingException.Pending)
920 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
923 internal Rotation GetCurrentOrientation()
925 Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentOrientation(SwigCPtr), true);
926 if (NDalicPINVOKE.SWIGPendingException.Pending)
927 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
931 internal void SetInheritOrientation(bool inherit)
933 Interop.ActorInternal.SetInheritOrientation(SwigCPtr, inherit);
934 if (NDalicPINVOKE.SWIGPendingException.Pending)
935 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
938 internal bool IsOrientationInherited()
940 bool ret = Interop.ActorInternal.IsOrientationInherited(SwigCPtr);
941 if (NDalicPINVOKE.SWIGPendingException.Pending)
942 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
946 internal Rotation GetCurrentWorldOrientation()
948 Rotation ret = new Rotation(Interop.ActorInternal.GetCurrentWorldOrientation(SwigCPtr), true);
949 if (NDalicPINVOKE.SWIGPendingException.Pending)
950 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
954 internal void SetScale(float scale)
956 Interop.ActorInternal.SetScale(SwigCPtr, scale);
957 if (NDalicPINVOKE.SWIGPendingException.Pending)
958 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
961 internal void SetScale(float scaleX, float scaleY, float scaleZ)
963 Interop.ActorInternal.SetScale(SwigCPtr, scaleX, scaleY, scaleZ);
964 if (NDalicPINVOKE.SWIGPendingException.Pending)
965 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
968 internal void SetScale(Vector3 scale)
970 Interop.ActorInternal.SetScale(SwigCPtr, Vector3.getCPtr(scale));
971 if (NDalicPINVOKE.SWIGPendingException.Pending)
972 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
975 internal Vector3 GetCurrentScale()
977 #if NUI_PROPERTY_CHANGE_3
978 if(internalCurrentScale == null)
980 internalCurrentScale = new Vector3(0, 0, 0);
983 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.SCALE, internalCurrentScale.SwigCPtr);
985 if (NDalicPINVOKE.SWIGPendingException.Pending)
987 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
989 return internalCurrentScale;
992 Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentScale(SwigCPtr), true);
993 if (NDalicPINVOKE.SWIGPendingException.Pending)
994 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
999 internal Vector3 GetCurrentWorldScale()
1001 #if NUI_PROPERTY_CHANGE_3
1002 if(internalCurrentWorldScale == null)
1004 internalCurrentWorldScale = new Vector3(0, 0, 0);
1007 Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldScale, internalCurrentWorldScale.SwigCPtr);
1009 if (NDalicPINVOKE.SWIGPendingException.Pending)
1011 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 return internalCurrentWorldScale;
1016 Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldScale(SwigCPtr), true);
1017 if (NDalicPINVOKE.SWIGPendingException.Pending)
1018 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1023 internal void SetInheritScale(bool inherit)
1025 Interop.ActorInternal.SetInheritScale(SwigCPtr, inherit);
1026 if (NDalicPINVOKE.SWIGPendingException.Pending)
1027 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1030 internal bool IsScaleInherited()
1032 bool ret = Interop.ActorInternal.IsScaleInherited(SwigCPtr);
1033 if (NDalicPINVOKE.SWIGPendingException.Pending)
1034 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1038 internal Matrix GetCurrentWorldMatrix()
1040 Matrix ret = new Matrix(Interop.ActorInternal.GetCurrentWorldMatrix(SwigCPtr), true);
1041 if (NDalicPINVOKE.SWIGPendingException.Pending)
1042 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1046 internal void SetVisible(bool visible)
1048 Interop.Actor.SetVisible(SwigCPtr, visible);
1049 if (NDalicPINVOKE.SWIGPendingException.Pending)
1050 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1054 /// Retrieve the View's current Visibility.
1057 /// 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.
1058 /// However, this method can get the current actual value updated in real time.
1060 internal bool IsVisible()
1062 bool ret = Interop.ActorInternal.IsVisible(SwigCPtr);
1063 if (NDalicPINVOKE.SWIGPendingException.Pending)
1064 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068 internal void SetOpacity(float opacity)
1070 Interop.ActorInternal.SetOpacity(SwigCPtr, opacity);
1071 if (NDalicPINVOKE.SWIGPendingException.Pending)
1072 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1075 internal float GetCurrentOpacity()
1077 float ret = Interop.ActorInternal.GetCurrentOpacity(SwigCPtr);
1078 if (NDalicPINVOKE.SWIGPendingException.Pending)
1079 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1083 internal Vector4 GetCurrentColor()
1085 #if NUI_PROPERTY_CHANGE_3
1086 if(internalCurrentColor == null)
1088 internalCurrentColor = new Vector4(0, 0, 0, 0);
1091 Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Interop.ActorProperty.ColorGet(), internalCurrentColor.SwigCPtr);
1093 if (NDalicPINVOKE.SWIGPendingException.Pending)
1095 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1097 return internalCurrentColor;
1100 Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentColor(SwigCPtr), true);
1101 if (NDalicPINVOKE.SWIGPendingException.Pending)
1102 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106 internal ColorMode GetColorMode()
1108 ColorMode ret = (ColorMode)Interop.ActorInternal.GetColorMode(SwigCPtr);
1109 if (NDalicPINVOKE.SWIGPendingException.Pending)
1110 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1114 internal Vector4 GetCurrentWorldColor()
1116 #if NUI_PROPERTY_CHANGE_3
1117 if(internalCurrentWorldColor == null)
1119 internalCurrentWorldColor = new Vector4(0, 0, 0, 0);
1122 Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Property.WorldColor, internalCurrentWorldColor.SwigCPtr);
1124 if (NDalicPINVOKE.SWIGPendingException.Pending)
1126 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1128 return internalCurrentWorldColor;
1131 Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentWorldColor(SwigCPtr), true);
1132 if (NDalicPINVOKE.SWIGPendingException.Pending)
1133 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1138 internal void SetDrawMode(DrawModeType drawMode)
1140 Interop.ActorInternal.SetDrawMode(SwigCPtr, (int)drawMode);
1141 if (NDalicPINVOKE.SWIGPendingException.Pending)
1142 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1145 internal DrawModeType GetDrawMode()
1147 DrawModeType ret = (DrawModeType)Interop.ActorInternal.GetDrawMode(SwigCPtr);
1148 if (NDalicPINVOKE.SWIGPendingException.Pending)
1149 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1153 internal void SetKeyboardFocusable(bool focusable)
1155 Interop.ActorInternal.SetKeyboardFocusable(SwigCPtr, focusable);
1156 if (NDalicPINVOKE.SWIGPendingException.Pending)
1157 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1160 internal bool IsKeyboardFocusable()
1162 bool ret = Interop.ActorInternal.IsKeyboardFocusable(SwigCPtr);
1163 if (NDalicPINVOKE.SWIGPendingException.Pending)
1164 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1168 internal void SetKeyboardFocusableChildren(bool focusable)
1170 Interop.ActorInternal.SetKeyboardFocusableChildren(SwigCPtr, focusable);
1171 if (NDalicPINVOKE.SWIGPendingException.Pending)
1172 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175 internal bool AreChildrenKeyBoardFocusable()
1177 bool ret = Interop.ActorInternal.AreChildrenKeyBoardFocusable(SwigCPtr);
1178 if (NDalicPINVOKE.SWIGPendingException.Pending)
1179 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1183 internal void SetFocusableInTouch(bool enabled)
1185 Interop.ActorInternal.SetFocusableInTouch(SwigCPtr, enabled);
1186 if (NDalicPINVOKE.SWIGPendingException.Pending)
1187 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1190 internal bool IsFocusableInTouch()
1192 bool ret = Interop.ActorInternal.IsFocusableInTouch(SwigCPtr);
1193 if (NDalicPINVOKE.SWIGPendingException.Pending)
1194 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1198 internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
1200 Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
1201 if (NDalicPINVOKE.SWIGPendingException.Pending)
1202 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1205 internal ResizePolicyType GetResizePolicy(DimensionType dimension)
1207 ResizePolicyType ret = (ResizePolicyType)Interop.Actor.GetResizePolicy(SwigCPtr, (int)dimension);
1208 if (NDalicPINVOKE.SWIGPendingException.Pending)
1209 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1213 internal Vector3 GetSizeModeFactor()
1215 #if NUI_PROPERTY_CHANGE_1
1216 if (internalSizeModeFactor == null)
1218 internalSizeModeFactor = new Vector3(OnSizeModeFactorChanged, 0, 0, 0);
1220 Object.InternalRetrievingPropertyVector3(SwigCPtr, View.Property.SizeModeFactor, internalSizeModeFactor.SwigCPtr);
1221 return internalSizeModeFactor;
1224 Vector3 ret = new Vector3(Interop.Actor.GetSizeModeFactor(SwigCPtr), true);
1225 if (NDalicPINVOKE.SWIGPendingException.Pending)
1226 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1231 internal void SetMinimumSize(Vector2 size)
1233 Interop.ActorInternal.SetMinimumSize(SwigCPtr, Vector2.getCPtr(size));
1234 if (NDalicPINVOKE.SWIGPendingException.Pending)
1235 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1238 internal Vector2 GetMinimumSize()
1240 #if NUI_PROPERTY_CHANGE_1
1241 if (internalMinimumSize == null)
1243 internalMinimumSize = new Size2D(OnMinimumSizeChanged, 0, 0);
1245 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MinimumSize, internalMinimumSize.SwigCPtr);
1246 return internalMinimumSize;
1248 Vector2 ret = new Vector2(Interop.ActorInternal.GetMinimumSize(SwigCPtr), true);
1249 if (NDalicPINVOKE.SWIGPendingException.Pending)
1250 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1255 internal void SetMaximumSize(Vector2 size)
1257 Interop.ActorInternal.SetMaximumSize(SwigCPtr, Vector2.getCPtr(size));
1258 if (NDalicPINVOKE.SWIGPendingException.Pending)
1259 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1262 internal Vector2 GetMaximumSize()
1264 #if NUI_PROPERTY_CHANGE_1
1265 if (internalMaximumSize == null)
1267 internalMaximumSize = new Size2D(OnMaximumSizeChanged, 0, 0);
1269 Object.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MaximumSize, internalMaximumSize.SwigCPtr);
1270 return internalMaximumSize;
1273 Vector2 ret = new Vector2(Interop.ActorInternal.GetMaximumSize(SwigCPtr), true);
1274 if (NDalicPINVOKE.SWIGPendingException.Pending)
1275 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1280 internal int GetHierarchyDepth()
1282 int ret = Interop.Actor.GetHierarchyDepth(SwigCPtr);
1283 if (NDalicPINVOKE.SWIGPendingException.Pending)
1284 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1288 internal uint GetRendererCount()
1290 uint ret = Interop.Actor.GetRendererCount(SwigCPtr);
1291 if (NDalicPINVOKE.SWIGPendingException.Pending)
1292 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1296 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
1298 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1301 internal bool IsTopLevelView()
1303 if (GetParent() is Layer)
1311 /// Check whether Current view don't has BackgroundVisual or not.
1312 /// Some API (like Animation, Borderline) required non-empty backgrounds.
1314 internal bool IsBackgroundEmpty()
1316 #if NUI_VISUAL_PROPERTY_CHANGE_1
1317 int visualType = (int)Visual.Type.Invalid;
1318 Interop.View.InternalRetrievingVisualPropertyInt(this.SwigCPtr, Property.BACKGROUND, Visual.Property.Type, out visualType);
1319 return visualType == (int)Visual.Type.Invalid;
1321 PropertyMap background = Background;
1322 return (background == null || background.Empty());
1326 internal void SetKeyInputFocus()
1328 Interop.ViewInternal.SetKeyInputFocus(SwigCPtr);
1329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1332 internal void ClearKeyInputFocus()
1334 Interop.ViewInternal.ClearKeyInputFocus(SwigCPtr);
1335 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1338 internal PinchGestureDetector GetPinchGestureDetector()
1340 PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.GetPinchGestureDetector(SwigCPtr), true);
1341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1345 internal PanGestureDetector GetPanGestureDetector()
1347 PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.GetPanGestureDetector(SwigCPtr), true);
1348 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1352 internal TapGestureDetector GetTapGestureDetector()
1354 TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.GetTapGestureDetector(SwigCPtr), true);
1355 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1359 internal LongPressGestureDetector GetLongPressGestureDetector()
1361 LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.GetLongPressGestureDetector(SwigCPtr), true);
1362 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1366 internal IntPtr GetPtrfromView()
1368 return (IntPtr)SwigCPtr;
1371 internal void RemoveChild(View child)
1373 // If the view had focus, it clears focus.
1374 if (child == FocusManager.Instance.GetCurrentFocusView())
1376 FocusManager.Instance.ClearFocus();
1378 // Do actual child removal
1379 Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
1380 if (NDalicPINVOKE.SWIGPendingException.Pending)
1381 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1383 Children.Remove(child);
1384 child.InternalParent = null;
1385 LayoutCount -= child.LayoutCount;
1387 OnChildRemoved(child);
1388 if (ChildRemoved != null)
1390 ChildRemovedEventArgs e = new ChildRemovedEventArgs
1394 ChildRemoved(this, e);
1399 /// Removes the layout from this View.
1401 internal void ResetLayout()
1408 internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1410 return (ResourceLoadingStatusType)Interop.View.GetVisualResourceStatus(this.SwigCPtr, Property.BACKGROUND);
1413 /// TODO open as a protected level
1414 internal virtual void ApplyCornerRadius()
1416 if (backgroundExtraData == null) return;
1418 #if NUI_VISUAL_PROPERTY_CHANGE_1
1419 // Update corner radius properties to background and shadow by ActionUpdateProperty
1420 if (backgroundExtraData.CornerRadius != null)
1422 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1423 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadius, Vector4.getCPtr(backgroundExtraData.CornerRadius));
1425 Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1426 Interop.View.InternalUpdateVisualPropertyInt(this.SwigCPtr, View.Property.SHADOW, Visual.Property.CornerRadiusPolicy, (int)backgroundExtraData.CornerRadiusPolicy);
1428 var cornerRadiusValue = backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius);
1429 var cornerRadiusPolicyValue = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
1431 // Make current propertyMap
1432 PropertyMap currentPropertyMap = new PropertyMap();
1433 currentPropertyMap[Visual.Property.CornerRadius] = cornerRadiusValue;
1434 currentPropertyMap[Visual.Property.CornerRadiusPolicy] = cornerRadiusPolicyValue;
1435 var temp = new PropertyValue(currentPropertyMap);
1437 // Update corner radius properties to background and shadow by ActionUpdateProperty
1438 DoAction(View.Property.BACKGROUND, ActionUpdateProperty, temp);
1439 DoAction(View.Property.SHADOW, ActionUpdateProperty, temp);
1442 currentPropertyMap.Dispose();
1443 cornerRadiusValue.Dispose();
1444 cornerRadiusPolicyValue.Dispose();
1448 /// TODO open as a protected level
1449 internal virtual void ApplyBorderline()
1451 if (backgroundExtraData == null) return;
1453 #if NUI_VISUAL_PROPERTY_CHANGE_1
1454 // ActionUpdateProperty works well only if BACKGROUND visual setup before.
1455 // If view don't have BACKGROUND visual, we set transparent background color in default.
1456 if (IsBackgroundEmpty())
1458 // BACKGROUND visual doesn't exist.
1459 SetBackgroundColor(Color.Transparent);
1460 // SetBackgroundColor function apply borderline internally.
1461 // So we can just return now.
1465 // Update borderline properties to background by ActionUpdateProperty
1466 Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineWidth, backgroundExtraData.BorderlineWidth);
1467 Interop.View.InternalUpdateVisualPropertyVector4(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineColor, Vector4.getCPtr(backgroundExtraData.BorderlineColor ?? Color.Black));
1468 Interop.View.InternalUpdateVisualPropertyFloat(this.SwigCPtr, View.Property.BACKGROUND, Visual.Property.BorderlineOffset, backgroundExtraData.BorderlineOffset);
1470 // ActionUpdateProperty works well only if BACKGROUND visual setup before.
1471 // If view don't have BACKGROUND visual, we set transparent background color in default.
1472 using (PropertyMap backgroundPropertyMap = new PropertyMap())
1474 using (PropertyValue propertyValue = Object.GetProperty(SwigCPtr, Property.BACKGROUND))
1476 propertyValue?.Get(backgroundPropertyMap);
1477 if (backgroundPropertyMap.Empty())
1479 // BACKGROUND visual doesn't exist.
1480 SetBackgroundColor(Color.Transparent);
1481 // SetBackgroundColor function apply borderline internally.
1482 // So we can just return now.
1488 var borderlineWidthValue = new PropertyValue(backgroundExtraData.BorderlineWidth);
1489 var borderlineColorValue = backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor);
1490 var borderlineOffsetValue = new PropertyValue(backgroundExtraData.BorderlineOffset);
1492 // Make current propertyMap
1493 PropertyMap currentPropertyMap = new PropertyMap();
1494 currentPropertyMap[Visual.Property.BorderlineWidth] = borderlineWidthValue;
1495 currentPropertyMap[Visual.Property.BorderlineColor] = borderlineColorValue;
1496 currentPropertyMap[Visual.Property.BorderlineOffset] = borderlineOffsetValue;
1497 var temp = new PropertyValue(currentPropertyMap);
1499 // Update borderline properties to background by ActionUpdateProperty
1500 DoAction(View.Property.BACKGROUND, ActionUpdateProperty, temp);
1503 currentPropertyMap.Dispose();
1504 borderlineWidthValue.Dispose();
1505 borderlineColorValue.Dispose();
1506 borderlineOffsetValue.Dispose();
1511 /// Get selector value from the triggerable selector or related property.
1513 internal Selector<T> GetSelector<T>(TriggerableSelector<T> triggerableSelector, NUI.Binding.BindableProperty relatedProperty)
1515 var selector = triggerableSelector?.Get();
1516 if (selector != null)
1521 var value = (T)GetValue(relatedProperty);
1522 return value == null ? null : new Selector<T>(value);
1525 internal void SetThemeApplied()
1527 if (themeData == null) themeData = new ThemeData();
1528 themeData.ThemeApplied = true;
1530 if (ThemeChangeSensitive && !themeData.ListeningThemeChangeEvent)
1532 themeData.ListeningThemeChangeEvent = true;
1533 ThemeManager.ThemeChangedInternal.Add(OnThemeChanged);
1538 /// you can override it to clean-up your own resources.
1540 /// <param name="type">DisposeTypes</param>
1541 /// <since_tizen> 3 </since_tizen>
1542 protected override void Dispose(DisposeTypes type)
1549 disposeDebugging(type);
1551 //_mergedStyle = null;
1553 internalMaximumSize?.Dispose();
1554 internalMaximumSize = null;
1555 internalMinimumSize?.Dispose();
1556 internalMinimumSize = null;
1557 internalMargin?.Dispose();
1558 internalMargin = null;
1559 internalPadding?.Dispose();
1560 internalPadding = null;
1561 internalSizeModeFactor?.Dispose();
1562 internalSizeModeFactor = null;
1563 internalCellIndex?.Dispose();
1564 internalCellIndex = null;
1565 internalBackgroundColor?.Dispose();
1566 internalBackgroundColor = null;
1567 internalColor?.Dispose();
1568 internalColor = null;
1569 internalPivotPoint?.Dispose();
1570 internalPivotPoint = null;
1571 internalPosition?.Dispose();
1572 internalPosition = null;
1573 internalPosition2D?.Dispose();
1574 internalPosition2D = null;
1575 internalScale?.Dispose();
1576 internalScale = null;
1577 internalSize?.Dispose();
1578 internalSize = null;
1579 internalSize2D?.Dispose();
1580 internalSize2D = null;
1582 panGestureDetector?.Dispose();
1583 panGestureDetector = null;
1584 longGestureDetector?.Dispose();
1585 longGestureDetector = null;
1586 pinchGestureDetector?.Dispose();
1587 pinchGestureDetector = null;
1588 tapGestureDetector?.Dispose();
1589 tapGestureDetector = null;
1590 rotationGestureDetector?.Dispose();
1591 rotationGestureDetector = null;
1593 #if NUI_PROPERTY_CHANGE_3
1594 internalCurrentParentOrigin?.Dispose();
1595 internalCurrentParentOrigin = null;
1596 internalCurrentAnchorPoint?.Dispose();
1597 internalCurrentAnchorPoint = null;
1598 internalTargetSize?.Dispose();
1599 internalTargetSize = null;
1600 internalCurrentSize?.Dispose();
1601 internalCurrentSize = null;
1602 internalNaturalSize?.Dispose();
1603 internalNaturalSize = null;
1604 internalCurrentPosition?.Dispose();
1605 internalCurrentPosition = null;
1606 internalCurrentWorldPosition?.Dispose();
1607 internalCurrentWorldPosition = null;
1608 internalCurrentScale?.Dispose();
1609 internalCurrentScale = null;
1610 internalCurrentWorldScale?.Dispose();
1611 internalCurrentWorldScale = null;
1612 internalCurrentColor?.Dispose();
1613 internalCurrentColor = null;
1614 internalCurrentWorldColor?.Dispose();
1615 internalCurrentWorldColor = null;
1616 internalSizeModeFactor?.Dispose();
1617 internalSizeModeFactor = null;
1619 #if NUI_VISUAL_PROPERTY_CHANGE_1
1620 internalCurrentScreenPosition?.Dispose();
1621 internalCurrentScreenPosition = null;
1624 if (type == DisposeTypes.Explicit)
1627 //Release your own managed resources here.
1628 //You should release all of your own disposable objects here.
1629 if (themeData != null)
1631 themeData.selectorData?.Reset(this);
1632 if (themeData.ListeningThemeChangeEvent)
1634 ThemeManager.ThemeChangedInternal.Remove(OnThemeChanged);
1637 if (widthConstraint != null)
1639 widthConstraint.Remove();
1640 widthConstraint.Dispose();
1642 if (heightConstraint != null)
1644 heightConstraint.Remove();
1645 heightConstraint.Dispose();
1649 //Release your own unmanaged resources here.
1650 //You should not access any managed member here except static instance.
1651 //because the execution order of Finalizes is non-deterministic.
1653 DisConnectFromSignals();
1655 foreach (View view in Children)
1657 view.InternalParent = null;
1662 NUILog.Debug($"[Dispose] View.Dispose({type}) END");
1663 NUILog.Debug($"=============================");
1668 /// This will not be public opened.
1669 [EditorBrowsable(EditorBrowsableState.Never)]
1670 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1672 Interop.View.DeleteView(swigCPtr);
1676 /// The touch event handler for ControlState.
1677 /// Please change ControlState value by touch state if needed.
1679 /// <exception cref="ArgumentNullException"> Thrown when touch is null. </exception>
1680 [EditorBrowsable(EditorBrowsableState.Never)]
1681 protected virtual bool HandleControlStateOnTouch(Touch touch)
1685 throw new global::System.ArgumentNullException(nameof(touch));
1688 switch (touch.GetState(0))
1690 case PointStateType.Down:
1691 ControlState += ControlState.Pressed;
1693 case PointStateType.Interrupted:
1694 case PointStateType.Up:
1695 if (ControlState.Contains(ControlState.Pressed))
1697 ControlState -= ControlState.Pressed;
1707 /// Internal callback of enabled property changes.
1708 /// Inherited view can override this method to implements enabled property changes.
1710 [EditorBrowsable(EditorBrowsableState.Never)]
1711 protected virtual void OnEnabled(bool enabled)
1715 if (State == View.States.Disabled)
1717 State = View.States.Normal;
1719 if (enableControlState)
1721 ControlState -= ControlState.Disabled;
1726 State = View.States.Disabled;
1727 if (enableControlState)
1729 ControlState += ControlState.Disabled;
1735 private void DisConnectFromSignals()
1737 if (HasBody() == false)
1739 NUILog.Debug($"[Dispose] DisConnectFromSignals() No native body! No need to Disconnect Signals!");
1742 NUILog.Debug($"[Dispose] DisConnectFromSignals START");
1743 NUILog.Debug($"[Dispose] View.DisConnectFromSignals() type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
1744 NUILog.Debug($"[Dispose] ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
1746 if (onRelayoutEventCallback != null)
1748 NUILog.Debug($"[Dispose] onRelayoutEventCallback");
1750 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(GetBaseHandleCPtrHandleRef), false);
1751 signal?.Disconnect(onRelayoutEventCallback);
1752 onRelayoutEventCallback = null;
1755 if (offWindowEventCallback != null)
1757 NUILog.Debug($"[Dispose] offWindowEventCallback");
1759 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(GetBaseHandleCPtrHandleRef), false);
1760 signal?.Disconnect(offWindowEventCallback);
1761 offWindowEventCallback = null;
1764 if (onWindowEventCallback != null)
1766 NUILog.Debug($"[Dispose] onWindowEventCallback");
1768 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1769 signal?.Disconnect(onWindowEventCallback);
1770 onWindowEventCallback = null;
1773 if (wheelEventCallback != null)
1775 NUILog.Debug($"[Dispose] wheelEventCallback");
1777 using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(GetBaseHandleCPtrHandleRef), false);
1778 signal?.Disconnect(wheelEventCallback);
1779 wheelEventCallback = null;
1782 if (hoverEventCallback != null)
1784 NUILog.Debug($"[Dispose] hoverEventCallback");
1786 using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(GetBaseHandleCPtrHandleRef), false);
1787 signal?.Disconnect(hoverEventCallback);
1788 hoverEventCallback = null;
1791 if (hitTestResultDataCallback != null)
1793 NUILog.Debug($"[Dispose] hitTestResultDataCallback");
1795 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorHitTestResultSignal(GetBaseHandleCPtrHandleRef), false);
1796 signal?.Disconnect(hitTestResultDataCallback);
1797 hitTestResultDataCallback = null;
1801 if (interceptTouchDataCallback != null)
1803 NUILog.Debug($"[Dispose] interceptTouchDataCallback");
1805 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(GetBaseHandleCPtrHandleRef), false);
1806 signal?.Disconnect(interceptTouchDataCallback);
1807 interceptTouchDataCallback = null;
1810 if (touchDataCallback != null)
1812 NUILog.Debug($"[Dispose] touchDataCallback");
1814 using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(GetBaseHandleCPtrHandleRef), false);
1815 signal?.Disconnect(touchDataCallback);
1816 touchDataCallback = null;
1819 if (ResourcesLoadedCallback != null)
1821 NUILog.Debug($"[Dispose] ResourcesLoadedCallback");
1823 using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1824 signal?.Disconnect(ResourcesLoadedCallback);
1825 ResourcesLoadedCallback = null;
1828 if (keyCallback != null)
1830 NUILog.Debug($"[Dispose] keyCallback");
1832 using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(GetBaseHandleCPtrHandleRef), false);
1833 signal?.Disconnect(keyCallback);
1837 if (keyInputFocusLostCallback != null)
1839 NUILog.Debug($"[Dispose] keyInputFocusLostCallback");
1841 using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(GetBaseHandleCPtrHandleRef), false);
1842 signal?.Disconnect(keyInputFocusLostCallback);
1843 keyInputFocusLostCallback = null;
1844 keyInputFocusLostEventHandler = null;
1847 if (keyInputFocusGainedCallback != null)
1849 NUILog.Debug($"[Dispose] keyInputFocusGainedCallback");
1851 using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(GetBaseHandleCPtrHandleRef), false);
1852 signal?.Disconnect(keyInputFocusGainedCallback);
1853 keyInputFocusGainedCallback = null;
1854 keyInputFocusGainedEventHandler = null;
1857 if (backgroundResourceLoadedCallback != null)
1859 NUILog.Debug($"[Dispose] backgroundResourceLoadedCallback");
1861 using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1862 signal?.Disconnect(backgroundResourceLoadedCallback);
1863 backgroundResourceLoadedCallback = null;
1866 if (onWindowSendEventCallback != null)
1868 NUILog.Debug($"[Dispose] onWindowSendEventCallback");
1870 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1871 signal?.Disconnect(onWindowSendEventCallback);
1872 onWindowSendEventCallback = null;
1874 NUILog.Debug($"[Dispose] DisConnectFromSignals END");
1878 /// Apply initial style to the view.
1880 [EditorBrowsable(EditorBrowsableState.Never)]
1881 protected virtual void InitializeStyle(ViewStyle style = null)
1883 var initialStyle = ThemeManager.GetInitialStyleWithoutClone(GetType());
1886 ApplyStyle(initialStyle);
1890 var refinedStyle = style;
1891 if (style.IncludeDefaultStyle)
1893 refinedStyle = initialStyle?.Merge(style);
1895 ApplyStyle(refinedStyle);
1898 // Listen theme change event if needs.
1899 if (ThemeManager.PlatformThemeEnabled && initialStyle != null)
1905 private View ConvertIdToView(uint id)
1907 View view = GetParent()?.FindCurrentChildById(id);
1909 //If we can't find the parent's children, find in the top layer.
1912 Container parent = GetParent();
1913 while ((parent is View) && (parent != null))
1915 parent = parent.GetParent();
1916 if (parent is Layer)
1918 view = parent.FindCurrentChildById(id);
1927 private void OnScaleChanged(float x, float y, float z)
1929 Scale = new Vector3(x, y, z);
1932 private void OnBackgroundColorChanged(float r, float g, float b, float a)
1934 BackgroundColor = new Color(r, g, b, a);
1937 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1939 Padding = new Extents(start, end, top, bottom);
1942 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1944 Margin = new Extents(start, end, top, bottom);
1947 private void OnAnchorPointChanged(float x, float y, float z)
1949 AnchorPoint = new Position(x, y, z);
1952 private void OnCellIndexChanged(float x, float y)
1954 CellIndex = new Vector2(x, y);
1957 private void OnFlexMarginChanged(float x, float y, float z, float w)
1959 FlexMargin = new Vector4(x, y, z, w);
1962 private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1964 PaddingEX = new Extents(start, end, top, bottom);
1967 private void OnSizeModeFactorChanged(float x, float y, float z)
1969 SizeModeFactor = new Vector3(x, y, z);
1972 private bool EmptyOnTouch(object target, TouchEventArgs args)
1977 [EditorBrowsable(EditorBrowsableState.Never)]
1978 protected virtual bool CheckResourceReady()
1983 private ViewSelectorData EnsureSelectorData()
1985 if (themeData == null) themeData = new ThemeData();
1987 return themeData.selectorData ?? (themeData.selectorData = new ViewSelectorData());
1990 [Conditional("NUI_DISPOSE_DEBUG_ON")]
1991 private void disposeDebugging(DisposeTypes type)
1993 DebugFileLogging.Instance.WriteLog($"View.Dispose({type}) START");
1994 DebugFileLogging.Instance.WriteLog($"type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
1997 DebugFileLogging.Instance.WriteLog($"ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
2001 DebugFileLogging.Instance.WriteLog($"has no native body!");