2 * Copyright(c) 2019 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 System.Collections.Generic;
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.Binding;
26 namespace Tizen.NUI.BaseComponents
29 /// View is the base class for all views.
31 /// <since_tizen> 3 </since_tizen>
32 public partial class View
34 private MergedStyle mergedStyle = null;
35 private ViewSelectorData selectorData;
36 internal string styleName;
38 internal MergedStyle _mergedStyle
42 if (null == mergedStyle)
44 mergedStyle = new MergedStyle(GetType(), this);
52 /// The color mode of View.
53 /// This specifies whether the View uses its own color, or inherits its parent color.
54 /// The default is ColorMode.UseOwnMultiplyParentColor.
56 internal ColorMode ColorMode
64 return GetColorMode();
68 internal float WorldPositionX
73 GetProperty(View.Property.WORLD_POSITION_X).Get(out temp);
78 internal float WorldPositionY
83 GetProperty(View.Property.WORLD_POSITION_Y).Get(out temp);
88 internal float WorldPositionZ
93 GetProperty(View.Property.WORLD_POSITION_Z).Get(out temp);
98 internal bool FocusState
102 return IsKeyboardFocusable();
106 SetKeyboardFocusable(value);
110 internal void SetLayout(LayoutItem layout)
112 Window.Instance.LayoutController.CreateProcessCallback();
114 _layout?.AttachToOwner(this);
115 _layout?.RequestLayout();
119 /// Stores the calculated width value and its ModeType. Width component.
121 internal MeasureSpecification MeasureSpecificationWidth
125 _measureSpecificationWidth = value;
126 _layout?.RequestLayout();
130 return _measureSpecificationWidth;
135 /// Stores the calculated width value and its ModeType. Height component.
137 internal MeasureSpecification MeasureSpecificationHeight
141 _measureSpecificationHeight = value;
142 _layout?.RequestLayout();
146 return _measureSpecificationHeight;
150 internal void AttachTransitionsToChildren(LayoutTransition transition)
152 // Iterate children, adding the transition unless a transition
153 // for the same condition and property has already been
155 foreach (View view in Children)
157 LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
161 internal float ParentOriginX
166 GetProperty(View.Property.PARENT_ORIGIN_X).Get(out temp);
171 SetProperty(View.Property.PARENT_ORIGIN_X, new Tizen.NUI.PropertyValue(value));
172 NotifyPropertyChanged();
176 internal float ParentOriginY
181 GetProperty(View.Property.PARENT_ORIGIN_Y).Get(out temp);
186 SetProperty(View.Property.PARENT_ORIGIN_Y, new Tizen.NUI.PropertyValue(value));
187 NotifyPropertyChanged();
191 internal float ParentOriginZ
196 GetProperty(View.Property.PARENT_ORIGIN_Z).Get(out temp);
201 SetProperty(View.Property.PARENT_ORIGIN_Z, new Tizen.NUI.PropertyValue(value));
202 NotifyPropertyChanged();
206 internal float PivotPointX
211 GetProperty(View.Property.ANCHOR_POINT_X).Get(out temp);
216 SetProperty(View.Property.ANCHOR_POINT_X, new Tizen.NUI.PropertyValue(value));
220 internal float PivotPointY
225 GetProperty(View.Property.ANCHOR_POINT_Y).Get(out temp);
230 SetProperty(View.Property.ANCHOR_POINT_Y, new Tizen.NUI.PropertyValue(value));
234 internal float PivotPointZ
239 GetProperty(View.Property.ANCHOR_POINT_Z).Get(out temp);
244 SetProperty(View.Property.ANCHOR_POINT_Z, new Tizen.NUI.PropertyValue(value));
248 internal Matrix WorldMatrix
252 Matrix temp = new Matrix();
253 GetProperty(View.Property.WORLD_MATRIX).Get(temp);
259 /// Indicates that this View should listen Touch event to handle its ControlState.
261 private bool enableControlState = false;
263 private int LeftFocusableViewId
268 GetProperty(View.Property.LEFT_FOCUSABLE_VIEW_ID).Get(out temp);
273 SetProperty(View.Property.LEFT_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
277 private int RightFocusableViewId
282 GetProperty(View.Property.RIGHT_FOCUSABLE_VIEW_ID).Get(out temp);
287 SetProperty(View.Property.RIGHT_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
291 private int UpFocusableViewId
296 GetProperty(View.Property.UP_FOCUSABLE_VIEW_ID).Get(out temp);
301 SetProperty(View.Property.UP_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
305 private int DownFocusableViewId
310 GetProperty(View.Property.DOWN_FOCUSABLE_VIEW_ID).Get(out temp);
315 SetProperty(View.Property.DOWN_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
319 private ViewSelectorData SelectorData
323 if (selectorData == null)
325 selectorData = new ViewSelectorData();
331 internal void Raise()
333 var parentChildren = GetParent()?.Children;
335 if (parentChildren != null)
337 int currentIndex = parentChildren.IndexOf(this);
339 // If the view is not already the last item in the list.
340 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
342 View temp = parentChildren[currentIndex + 1];
343 parentChildren[currentIndex + 1] = this;
344 parentChildren[currentIndex] = temp;
346 Interop.NDalic.Raise(swigCPtr);
347 if (NDalicPINVOKE.SWIGPendingException.Pending)
348 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353 internal void Lower()
355 var parentChildren = GetParent()?.Children;
357 if (parentChildren != null)
359 int currentIndex = parentChildren.IndexOf(this);
361 // If the view is not already the first item in the list.
362 if (currentIndex > 0 && currentIndex < parentChildren.Count)
364 View temp = parentChildren[currentIndex - 1];
365 parentChildren[currentIndex - 1] = this;
366 parentChildren[currentIndex] = temp;
368 Interop.NDalic.Lower(swigCPtr);
369 if (NDalicPINVOKE.SWIGPendingException.Pending)
370 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
376 /// Raises the view to above the target view.
378 /// <remarks>The sibling order of views within the parent will be updated automatically.
379 /// Views on the level above the target view will still be shown above this view.
380 /// Raising this view above views with the same sibling order as each other will raise this view above them.
381 /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
383 /// <param name="target">Will be raised above this view.</param>
384 internal void RaiseAbove(View target)
386 var parentChildren = GetParent()?.Children;
388 if (parentChildren != null)
390 int currentIndex = parentChildren.IndexOf(this);
391 int targetIndex = parentChildren.IndexOf(target);
393 if (currentIndex < 0 || targetIndex < 0 ||
394 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
396 NUILog.Error("index should be bigger than 0 and less than children of layer count");
399 // If the currentIndex is less than the target index and the target has the same parent.
400 if (currentIndex < targetIndex)
402 parentChildren.Remove(this);
403 parentChildren.Insert(targetIndex, this);
405 Interop.NDalic.RaiseAbove(swigCPtr, View.getCPtr(target));
406 if (NDalicPINVOKE.SWIGPendingException.Pending)
407 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 /// Lowers the view to below the target view.
416 /// <remarks>The sibling order of views within the parent will be updated automatically.
417 /// Lowering this view below views with the same sibling order as each other will lower this view above them.
418 /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
420 /// <param name="target">Will be lowered below this view.</param>
421 internal void LowerBelow(View target)
423 var parentChildren = GetParent()?.Children;
425 if (parentChildren != null)
427 int currentIndex = parentChildren.IndexOf(this);
428 int targetIndex = parentChildren.IndexOf(target);
429 if (currentIndex < 0 || targetIndex < 0 ||
430 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
432 NUILog.Error("index should be bigger than 0 and less than children of layer count");
436 // If the currentIndex is not already the 0th index and the target has the same parent.
437 if ((currentIndex != 0) && (targetIndex != -1) &&
438 (currentIndex > targetIndex))
440 parentChildren.Remove(this);
441 parentChildren.Insert(targetIndex, this);
443 Interop.NDalic.LowerBelow(swigCPtr, View.getCPtr(target));
444 if (NDalicPINVOKE.SWIGPendingException.Pending)
445 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451 internal string GetName()
453 string ret = Interop.Actor.Actor_GetName(swigCPtr);
454 if (NDalicPINVOKE.SWIGPendingException.Pending)
455 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
459 internal void SetName(string name)
461 Interop.Actor.Actor_SetName(swigCPtr, name);
462 if (NDalicPINVOKE.SWIGPendingException.Pending)
463 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
466 internal uint GetId()
468 uint ret = Interop.Actor.Actor_GetId(swigCPtr);
469 if (NDalicPINVOKE.SWIGPendingException.Pending)
470 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
474 internal bool IsRoot()
476 bool ret = Interop.ActorInternal.Actor_IsRoot(swigCPtr);
477 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
481 internal bool OnWindow()
483 bool ret = Interop.Actor.Actor_OnStage(swigCPtr);
484 if (NDalicPINVOKE.SWIGPendingException.Pending)
485 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
489 internal View FindChildById(uint id)
491 //to fix memory leak issue, match the handle count with native side.
492 IntPtr cPtr = Interop.Actor.Actor_FindChildById(swigCPtr, id);
493 View ret = this.GetInstanceSafely<View>(cPtr);
494 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
498 internal override View FindCurrentChildById(uint id)
500 return FindChildById(id);
503 internal void SetParentOrigin(Vector3 origin)
505 Interop.ActorInternal.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin));
506 if (NDalicPINVOKE.SWIGPendingException.Pending)
507 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
510 internal Vector3 GetCurrentParentOrigin()
512 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentParentOrigin(swigCPtr), true);
513 if (NDalicPINVOKE.SWIGPendingException.Pending)
514 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518 internal void SetAnchorPoint(Vector3 anchorPoint)
520 Interop.Actor.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint));
521 if (NDalicPINVOKE.SWIGPendingException.Pending)
522 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
525 internal Vector3 GetCurrentAnchorPoint()
527 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentAnchorPoint(swigCPtr), true);
528 if (NDalicPINVOKE.SWIGPendingException.Pending)
529 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 internal void SetSize(float width, float height)
535 Interop.ActorInternal.Actor_SetSize__SWIG_0(swigCPtr, width, height);
536 if (NDalicPINVOKE.SWIGPendingException.Pending)
537 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
540 internal void SetSize(float width, float height, float depth)
542 Interop.ActorInternal.Actor_SetSize__SWIG_1(swigCPtr, width, height, depth);
543 if (NDalicPINVOKE.SWIGPendingException.Pending)
544 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 internal void SetSize(Vector2 size)
549 Interop.ActorInternal.Actor_SetSize__SWIG_2(swigCPtr, Vector2.getCPtr(size));
550 if (NDalicPINVOKE.SWIGPendingException.Pending)
551 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
554 internal void SetSize(Vector3 size)
556 Interop.ActorInternal.Actor_SetSize__SWIG_3(swigCPtr, Vector3.getCPtr(size));
557 if (NDalicPINVOKE.SWIGPendingException.Pending)
558 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
561 internal Vector3 GetTargetSize()
563 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetTargetSize(swigCPtr), true);
564 if (NDalicPINVOKE.SWIGPendingException.Pending)
565 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
569 internal Size2D GetCurrentSize()
571 Size ret = new Size(Interop.Actor.Actor_GetCurrentSize(swigCPtr), true);
572 if (NDalicPINVOKE.SWIGPendingException.Pending)
573 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
574 Size2D size = new Size2D((int)ret.Width, (int)ret.Height);
578 internal Size2D GetCurrentSizeFloat()
580 Size ret = new Size(Interop.Actor.Actor_GetCurrentSize(swigCPtr), true);
581 if (NDalicPINVOKE.SWIGPendingException.Pending)
582 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
586 internal Vector3 GetNaturalSize()
588 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
589 if (NDalicPINVOKE.SWIGPendingException.Pending)
590 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
594 internal void SetPosition(float x, float y)
596 Interop.ActorInternal.Actor_SetPosition__SWIG_0(swigCPtr, x, y);
597 if (NDalicPINVOKE.SWIGPendingException.Pending)
598 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 internal void SetPosition(float x, float y, float z)
603 Interop.ActorInternal.Actor_SetPosition__SWIG_1(swigCPtr, x, y, z);
604 if (NDalicPINVOKE.SWIGPendingException.Pending)
605 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608 internal void SetPosition(Vector3 position)
610 Interop.ActorInternal.Actor_SetPosition__SWIG_2(swigCPtr, Vector3.getCPtr(position));
611 if (NDalicPINVOKE.SWIGPendingException.Pending)
612 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
615 internal void SetX(float x)
617 Interop.ActorInternal.Actor_SetX(swigCPtr, x);
618 if (NDalicPINVOKE.SWIGPendingException.Pending)
619 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
622 internal void SetY(float y)
624 Interop.ActorInternal.Actor_SetY(swigCPtr, y);
625 if (NDalicPINVOKE.SWIGPendingException.Pending)
626 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
629 internal void SetZ(float z)
631 Interop.ActorInternal.Actor_SetZ(swigCPtr, z);
632 if (NDalicPINVOKE.SWIGPendingException.Pending)
633 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636 internal void TranslateBy(Vector3 distance)
638 Interop.ActorInternal.Actor_TranslateBy(swigCPtr, Vector3.getCPtr(distance));
639 if (NDalicPINVOKE.SWIGPendingException.Pending)
640 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643 internal Position GetCurrentPosition()
645 Position ret = new Position(Interop.Actor.Actor_GetCurrentPosition(swigCPtr), true);
646 if (NDalicPINVOKE.SWIGPendingException.Pending)
647 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651 internal Vector3 GetCurrentWorldPosition()
653 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentWorldPosition(swigCPtr), true);
654 if (NDalicPINVOKE.SWIGPendingException.Pending)
655 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659 internal void SetInheritPosition(bool inherit)
661 Interop.ActorInternal.Actor_SetInheritPosition(swigCPtr, inherit);
662 if (NDalicPINVOKE.SWIGPendingException.Pending)
663 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
666 internal bool IsPositionInherited()
668 bool ret = Interop.ActorInternal.Actor_IsPositionInherited(swigCPtr);
669 if (NDalicPINVOKE.SWIGPendingException.Pending)
670 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
674 internal void SetOrientation(Degree angle, Vector3 axis)
676 Interop.ActorInternal.Actor_SetOrientation__SWIG_0(swigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
677 if (NDalicPINVOKE.SWIGPendingException.Pending)
678 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
681 internal void SetOrientation(Radian angle, Vector3 axis)
683 Interop.ActorInternal.Actor_SetOrientation__SWIG_1(swigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
684 if (NDalicPINVOKE.SWIGPendingException.Pending)
685 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 internal void SetOrientation(Rotation orientation)
690 Interop.ActorInternal.Actor_SetOrientation__SWIG_2(swigCPtr, Rotation.getCPtr(orientation));
691 if (NDalicPINVOKE.SWIGPendingException.Pending)
692 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
695 internal Rotation GetCurrentOrientation()
697 Rotation ret = new Rotation(Interop.ActorInternal.Actor_GetCurrentOrientation(swigCPtr), true);
698 if (NDalicPINVOKE.SWIGPendingException.Pending)
699 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703 internal void SetInheritOrientation(bool inherit)
705 Interop.ActorInternal.Actor_SetInheritOrientation(swigCPtr, inherit);
706 if (NDalicPINVOKE.SWIGPendingException.Pending)
707 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710 internal bool IsOrientationInherited()
712 bool ret = Interop.ActorInternal.Actor_IsOrientationInherited(swigCPtr);
713 if (NDalicPINVOKE.SWIGPendingException.Pending)
714 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718 internal Rotation GetCurrentWorldOrientation()
720 Rotation ret = new Rotation(Interop.ActorInternal.Actor_GetCurrentWorldOrientation(swigCPtr), true);
721 if (NDalicPINVOKE.SWIGPendingException.Pending)
722 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
726 internal void SetScale(float scale)
728 Interop.ActorInternal.Actor_SetScale__SWIG_0(swigCPtr, scale);
729 if (NDalicPINVOKE.SWIGPendingException.Pending)
730 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733 internal void SetScale(float scaleX, float scaleY, float scaleZ)
735 Interop.ActorInternal.Actor_SetScale__SWIG_1(swigCPtr, scaleX, scaleY, scaleZ);
736 if (NDalicPINVOKE.SWIGPendingException.Pending)
737 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 internal void SetScale(Vector3 scale)
742 Interop.ActorInternal.Actor_SetScale__SWIG_2(swigCPtr, Vector3.getCPtr(scale));
743 if (NDalicPINVOKE.SWIGPendingException.Pending)
744 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 internal Vector3 GetCurrentScale()
749 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentScale(swigCPtr), true);
750 if (NDalicPINVOKE.SWIGPendingException.Pending)
751 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 internal Vector3 GetCurrentWorldScale()
757 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentWorldScale(swigCPtr), true);
758 if (NDalicPINVOKE.SWIGPendingException.Pending)
759 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 internal void SetInheritScale(bool inherit)
765 Interop.ActorInternal.Actor_SetInheritScale(swigCPtr, inherit);
766 if (NDalicPINVOKE.SWIGPendingException.Pending)
767 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 internal bool IsScaleInherited()
772 bool ret = Interop.ActorInternal.Actor_IsScaleInherited(swigCPtr);
773 if (NDalicPINVOKE.SWIGPendingException.Pending)
774 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778 internal Matrix GetCurrentWorldMatrix()
780 Matrix ret = new Matrix(Interop.ActorInternal.Actor_GetCurrentWorldMatrix(swigCPtr), true);
781 if (NDalicPINVOKE.SWIGPendingException.Pending)
782 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 internal void SetVisible(bool visible)
788 Interop.Actor.Actor_SetVisible(swigCPtr, visible);
789 if (NDalicPINVOKE.SWIGPendingException.Pending)
790 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 internal bool IsVisible()
795 bool ret = Interop.ActorInternal.Actor_IsVisible(swigCPtr);
796 if (NDalicPINVOKE.SWIGPendingException.Pending)
797 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
801 internal void SetOpacity(float opacity)
803 Interop.ActorInternal.Actor_SetOpacity(swigCPtr, opacity);
804 if (NDalicPINVOKE.SWIGPendingException.Pending)
805 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
808 internal float GetCurrentOpacity()
810 float ret = Interop.ActorInternal.Actor_GetCurrentOpacity(swigCPtr);
811 if (NDalicPINVOKE.SWIGPendingException.Pending)
812 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
816 internal void SetColor(Vector4 color)
818 Interop.ActorInternal.Actor_SetColor(swigCPtr, Vector4.getCPtr(color));
819 if (NDalicPINVOKE.SWIGPendingException.Pending)
820 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 internal Vector4 GetCurrentColor()
825 Vector4 ret = new Vector4(Interop.ActorInternal.Actor_GetCurrentColor(swigCPtr), true);
826 if (NDalicPINVOKE.SWIGPendingException.Pending)
827 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830 internal ColorMode GetColorMode()
832 ColorMode ret = (ColorMode)Interop.ActorInternal.Actor_GetColorMode(swigCPtr);
833 if (NDalicPINVOKE.SWIGPendingException.Pending)
834 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 internal Vector4 GetCurrentWorldColor()
840 Vector4 ret = new Vector4(Interop.ActorInternal.Actor_GetCurrentWorldColor(swigCPtr), true);
841 if (NDalicPINVOKE.SWIGPendingException.Pending)
842 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
846 internal void SetDrawMode(DrawModeType drawMode)
848 Interop.ActorInternal.Actor_SetDrawMode(swigCPtr, (int)drawMode);
849 if (NDalicPINVOKE.SWIGPendingException.Pending)
850 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
853 internal DrawModeType GetDrawMode()
855 DrawModeType ret = (DrawModeType)Interop.ActorInternal.Actor_GetDrawMode(swigCPtr);
856 if (NDalicPINVOKE.SWIGPendingException.Pending)
857 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
861 internal void SetKeyboardFocusable(bool focusable)
863 Interop.ActorInternal.Actor_SetKeyboardFocusable(swigCPtr, focusable);
864 if (NDalicPINVOKE.SWIGPendingException.Pending)
865 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
868 internal bool IsKeyboardFocusable()
870 bool ret = Interop.ActorInternal.Actor_IsKeyboardFocusable(swigCPtr);
871 if (NDalicPINVOKE.SWIGPendingException.Pending)
872 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
876 internal void SetKeyboardFocusableChildren(bool focusable)
878 Interop.ActorInternal.SetKeyboardFocusableChildren(SwigCPtr, focusable);
879 if (NDalicPINVOKE.SWIGPendingException.Pending)
880 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
883 internal bool AreChildrenKeyBoardFocusable()
885 bool ret = Interop.ActorInternal.AreChildrenKeyBoardFocusable(SwigCPtr);
886 if (NDalicPINVOKE.SWIGPendingException.Pending)
887 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
891 internal void SetFocusableInTouch(bool enabled)
893 Interop.ActorInternal.SetFocusableInTouch(SwigCPtr, enabled);
894 if (NDalicPINVOKE.SWIGPendingException.Pending)
895 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
898 internal bool IsFocusableInTouch()
900 bool ret = Interop.ActorInternal.IsFocusableInTouch(SwigCPtr);
901 if (NDalicPINVOKE.SWIGPendingException.Pending)
902 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
906 internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
908 Interop.Actor.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension);
909 if (NDalicPINVOKE.SWIGPendingException.Pending)
910 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913 internal ResizePolicyType GetResizePolicy(DimensionType dimension)
915 ResizePolicyType ret = (ResizePolicyType)Interop.Actor.Actor_GetResizePolicy(swigCPtr, (int)dimension);
916 if (NDalicPINVOKE.SWIGPendingException.Pending)
917 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921 internal Vector3 GetSizeModeFactor()
923 Vector3 ret = new Vector3(Interop.Actor.Actor_GetSizeModeFactor(swigCPtr), true);
924 if (NDalicPINVOKE.SWIGPendingException.Pending)
925 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
929 internal void SetMinimumSize(Vector2 size)
931 Interop.ActorInternal.Actor_SetMinimumSize(swigCPtr, Vector2.getCPtr(size));
932 if (NDalicPINVOKE.SWIGPendingException.Pending)
933 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
936 internal Vector2 GetMinimumSize()
938 Vector2 ret = new Vector2(Interop.ActorInternal.Actor_GetMinimumSize(swigCPtr), true);
939 if (NDalicPINVOKE.SWIGPendingException.Pending)
940 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
944 internal void SetMaximumSize(Vector2 size)
946 Interop.ActorInternal.Actor_SetMaximumSize(swigCPtr, Vector2.getCPtr(size));
947 if (NDalicPINVOKE.SWIGPendingException.Pending)
948 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
951 internal Vector2 GetMaximumSize()
953 Vector2 ret = new Vector2(Interop.ActorInternal.Actor_GetMaximumSize(swigCPtr), true);
954 if (NDalicPINVOKE.SWIGPendingException.Pending)
955 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
959 internal int GetHierarchyDepth()
961 int ret = Interop.Actor.Actor_GetHierarchyDepth(swigCPtr);
962 if (NDalicPINVOKE.SWIGPendingException.Pending)
963 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
967 internal uint GetRendererCount()
969 uint ret = Interop.Actor.Actor_GetRendererCount(swigCPtr);
970 if (NDalicPINVOKE.SWIGPendingException.Pending)
971 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
975 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
977 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
980 internal bool IsTopLevelView()
982 if (GetParent() is Layer)
989 internal void SetKeyInputFocus()
991 Interop.ViewInternal.View_SetKeyInputFocus(swigCPtr);
992 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
995 internal void ClearKeyInputFocus()
997 Interop.ViewInternal.View_ClearKeyInputFocus(swigCPtr);
998 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1001 internal PinchGestureDetector GetPinchGestureDetector()
1003 PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.View_GetPinchGestureDetector(swigCPtr), true);
1004 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1008 internal PanGestureDetector GetPanGestureDetector()
1010 PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.View_GetPanGestureDetector(swigCPtr), true);
1011 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1015 internal TapGestureDetector GetTapGestureDetector()
1017 TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.View_GetTapGestureDetector(swigCPtr), true);
1018 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1022 internal LongPressGestureDetector GetLongPressGestureDetector()
1024 LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.View_GetLongPressGestureDetector(swigCPtr), true);
1025 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1029 internal IntPtr GetPtrfromView()
1031 return (IntPtr)swigCPtr;
1034 internal void RemoveChild(View child)
1036 // Do actual child removal
1037 Interop.Actor.Actor_Remove(swigCPtr, View.getCPtr(child));
1038 if (NDalicPINVOKE.SWIGPendingException.Pending)
1039 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1041 Children.Remove(child);
1042 child.InternalParent = null;
1044 if (ChildRemoved != null)
1046 ChildRemovedEventArgs e = new ChildRemovedEventArgs
1050 ChildRemoved(this, e);
1055 /// Removes the layout from this View.
1057 internal void ResetLayout()
1062 internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1064 return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.BACKGROUND);
1067 internal virtual void UpdateCornerRadius(float value)
1071 (backgroundExtraData ?? (backgroundExtraData = new BackgroundExtraData())).CornerRadius = value;
1074 Tizen.NUI.PropertyMap backgroundMap = new Tizen.NUI.PropertyMap();
1075 Tizen.NUI.Object.GetProperty(swigCPtr, View.Property.BACKGROUND).Get(backgroundMap);
1077 if (!backgroundMap.Empty())
1079 backgroundMap[Visual.Property.CornerRadius] = new PropertyValue(value);
1080 Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(backgroundMap));
1083 UpdateShadowCornerRadius(value);
1086 internal void UpdateStyle()
1089 if (styleName == null) newStyle = ThemeManager.GetStyle(GetType());
1090 else newStyle = ThemeManager.GetStyle(styleName);
1092 if (newStyle != null && (viewStyle == null || viewStyle.GetType() == newStyle.GetType())) ApplyStyle(newStyle);
1096 /// you can override it to clean-up your own resources.
1098 /// <param name="type">DisposeTypes</param>
1099 /// <since_tizen> 3 </since_tizen>
1100 protected override void Dispose(DisposeTypes type)
1107 //_mergedStyle = null;
1109 if (type == DisposeTypes.Explicit)
1112 //Release your own managed resources here.
1113 //You should release all of your own disposable objects here.
1114 selectorData?.Reset(this);
1115 if (themeChangeSensitive)
1117 ThemeManager.ThemeChangedInternal -= OnThemeChanged;
1119 if (widthConstraint != null)
1121 widthConstraint.Remove();
1122 widthConstraint.Dispose();
1124 if (heightConstraint != null)
1126 heightConstraint.Remove();
1127 heightConstraint.Dispose();
1131 //Release your own unmanaged resources here.
1132 //You should not access any managed member here except static instance.
1133 //because the execution order of Finalizes is non-deterministic.
1136 DisConnectFromSignals();
1139 foreach (View view in Children)
1141 view.InternalParent = null;
1147 /// This will not be public opened.
1148 [EditorBrowsable(EditorBrowsableState.Never)]
1149 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1151 Interop.View.delete_View(swigCPtr);
1155 /// The touch event handler for ControlState.
1156 /// Please change ControlState value by touch state if needed.
1158 [EditorBrowsable(EditorBrowsableState.Never)]
1159 protected virtual bool HandleControlStateOnTouch(Touch touch)
1161 switch (touch.GetState(0))
1163 case PointStateType.Down:
1164 ControlState += ControlState.Pressed;
1166 case PointStateType.Interrupted:
1167 case PointStateType.Up:
1168 if (ControlState.Contains(ControlState.Pressed))
1170 ControlState -= ControlState.Pressed;
1180 private void DisConnectFromSignals()
1182 if (HasBody() == false)
1184 NUILog.Debug($"View.DisConnectFromSignals() No native body! No need to Disconnect Signals!");
1188 if (_onRelayoutEventCallback != null)
1190 ViewSignal signal = new ViewSignal(Interop.ActorSignal.Actor_OnRelayoutSignal(GetBaseHandleCPtrHandleRef), false);
1191 signal?.Disconnect(_onRelayoutEventCallback);
1193 _onRelayoutEventCallback = null;
1196 if (_offWindowEventCallback != null)
1198 ViewSignal signal = new ViewSignal(Interop.ActorSignal.Actor_OffSceneSignal(GetBaseHandleCPtrHandleRef), false);
1199 signal?.Disconnect(_offWindowEventCallback);
1201 _offWindowEventCallback = null;
1204 if (_onWindowEventCallback != null)
1206 ViewSignal signal = new ViewSignal(Interop.ActorSignal.Actor_OnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1207 signal?.Disconnect(_onWindowEventCallback);
1209 _onWindowEventCallback = null;
1212 if (_wheelEventCallback != null)
1214 WheelSignal signal = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(GetBaseHandleCPtrHandleRef), false);
1215 signal?.Disconnect(_wheelEventCallback);
1217 _wheelEventCallback = null;
1220 if (WindowWheelEventHandler != null)
1222 NUIApplication.GetDefaultWindow().WheelEvent -= OnWindowWheelEvent;
1225 if (_hoverEventCallback != null)
1227 HoverSignal signal = new HoverSignal(Interop.ActorSignal.Actor_HoveredSignal(GetBaseHandleCPtrHandleRef), false);
1228 signal?.Disconnect(_hoverEventCallback);
1230 _hoverEventCallback = null;
1233 if (_interceptTouchDataCallback != null)
1235 TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.Actor_InterceptTouchSignal(GetBaseHandleCPtrHandleRef), false);
1236 signal?.Disconnect(_interceptTouchDataCallback);
1238 _interceptTouchDataCallback = null;
1241 if (_touchDataCallback != null)
1243 TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(GetBaseHandleCPtrHandleRef), false);
1244 signal?.Disconnect(_touchDataCallback);
1246 _touchDataCallback = null;
1249 if (_ResourcesLoadedCallback != null)
1251 ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1252 signal?.Disconnect(_ResourcesLoadedCallback);
1254 _ResourcesLoadedCallback = null;
1257 if (_keyCallback != null)
1259 ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.View_KeyEventSignal(GetBaseHandleCPtrHandleRef), false);
1260 signal?.Disconnect(_keyCallback);
1262 _keyCallback = null;
1265 if (_keyInputFocusLostCallback != null)
1267 KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.View_KeyInputFocusLostSignal(GetBaseHandleCPtrHandleRef), false);
1268 signal?.Disconnect(_keyInputFocusLostCallback);
1270 _keyInputFocusLostCallback = null;
1273 if (_keyInputFocusGainedCallback != null)
1275 KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.View_KeyInputFocusGainedSignal(GetBaseHandleCPtrHandleRef), false);
1276 signal?.Disconnect(_keyInputFocusGainedCallback);
1278 _keyInputFocusGainedCallback = null;
1281 if (_backgroundResourceLoadedCallback != null)
1283 ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
1284 signal?.Disconnect(_backgroundResourceLoadedCallback);
1286 _backgroundResourceLoadedCallback = null;
1289 if (_onWindowSendEventCallback != null)
1291 ViewSignal signal = new ViewSignal(Interop.ActorSignal.Actor_OnSceneSignal(GetBaseHandleCPtrHandleRef), false);
1292 signal?.Disconnect(_onWindowSendEventCallback);
1294 _onWindowSendEventCallback = null;
1297 if (_visibilityChangedEventCallback != null)
1299 ViewVisibilityChangedSignal signal = new ViewVisibilityChangedSignal(Interop.NDalic.VisibilityChangedSignal(GetBaseHandleCPtrHandleRef), false);
1300 signal?.Disconnect(_visibilityChangedEventCallback);
1302 _visibilityChangedEventCallback = null;
1305 if (_layoutDirectionChangedEventCallback != null)
1307 ViewLayoutDirectionChangedSignal signal = new ViewLayoutDirectionChangedSignal(Interop.Layout.LayoutDirectionChangedSignal(GetBaseHandleCPtrHandleRef), false);
1308 signal?.Disconnect(_layoutDirectionChangedEventCallback);
1310 _layoutDirectionChangedEventCallback = null;
1314 private View ConvertIdToView(uint id)
1316 View view = GetParent()?.FindCurrentChildById(id);
1318 //If we can't find the parent's children, find in the top layer.
1321 Container parent = GetParent();
1322 while ((parent is View) && (parent != null))
1324 parent = parent.GetParent();
1325 if (parent is Layer)
1327 view = parent.FindCurrentChildById(id);
1336 private void LoadTransitions()
1338 foreach (string str in transitionNames)
1340 string resourceName = str + ".xaml";
1341 Transition trans = null;
1343 string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
1345 string likelyResourcePath = resource + "animation/" + resourceName;
1347 if (File.Exists(likelyResourcePath))
1349 trans = Xaml.Extensions.LoadObject<Transition>(likelyResourcePath);
1353 transDictionary.Add(trans.Name, trans);
1358 private void OnScaleChanged(float x, float y, float z)
1360 Scale = new Vector3(x, y, z);
1363 private void OnBackgroundColorChanged(float r, float g, float b, float a)
1365 BackgroundColor = new Color(r, g, b, a);
1368 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1370 Padding = new Extents(start, end, top, bottom);
1373 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1375 Margin = new Extents(start, end, top, bottom);
1378 private void OnColorChanged(float r, float g, float b, float a)
1380 Color = new Color(r, g, b, a);
1383 private void OnAnchorPointChanged(float x, float y, float z)
1385 AnchorPoint = new Position(x, y, z);
1388 private void OnCellIndexChanged(float x, float y)
1390 CellIndex = new Vector2(x, y);
1393 private void OnFlexMarginChanged(float x, float y, float z, float w)
1395 FlexMargin = new Vector4(x, y, z, w);
1398 private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1400 PaddingEX = new Extents(start, end, top, bottom);
1403 private void OnSizeModeFactorChanged(float x, float y, float z)
1405 SizeModeFactor = new Vector3(x, y, z);
1408 private void UpdateShadowCornerRadius(float value)
1410 // TODO Update corner radius property only whe DALi supports visual property update.
1411 PropertyMap map = new PropertyMap();
1413 if (Tizen.NUI.Object.GetProperty(swigCPtr, View.Property.SHADOW).Get(map) && !map.Empty())
1415 map[Visual.Property.CornerRadius] = new PropertyValue(value);
1417 Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SHADOW, new PropertyValue(map));
1421 private bool EmptyOnTouch(object target, TouchEventArgs args)