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 SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
878 Interop.Actor.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension);
879 if (NDalicPINVOKE.SWIGPendingException.Pending)
880 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
883 internal ResizePolicyType GetResizePolicy(DimensionType dimension)
885 ResizePolicyType ret = (ResizePolicyType)Interop.Actor.Actor_GetResizePolicy(swigCPtr, (int)dimension);
886 if (NDalicPINVOKE.SWIGPendingException.Pending)
887 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
891 internal Vector3 GetSizeModeFactor()
893 Vector3 ret = new Vector3(Interop.Actor.Actor_GetSizeModeFactor(swigCPtr), true);
894 if (NDalicPINVOKE.SWIGPendingException.Pending)
895 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
899 internal void SetMinimumSize(Vector2 size)
901 Interop.ActorInternal.Actor_SetMinimumSize(swigCPtr, Vector2.getCPtr(size));
902 if (NDalicPINVOKE.SWIGPendingException.Pending)
903 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
906 internal Vector2 GetMinimumSize()
908 Vector2 ret = new Vector2(Interop.ActorInternal.Actor_GetMinimumSize(swigCPtr), true);
909 if (NDalicPINVOKE.SWIGPendingException.Pending)
910 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
914 internal void SetMaximumSize(Vector2 size)
916 Interop.ActorInternal.Actor_SetMaximumSize(swigCPtr, Vector2.getCPtr(size));
917 if (NDalicPINVOKE.SWIGPendingException.Pending)
918 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921 internal Vector2 GetMaximumSize()
923 Vector2 ret = new Vector2(Interop.ActorInternal.Actor_GetMaximumSize(swigCPtr), true);
924 if (NDalicPINVOKE.SWIGPendingException.Pending)
925 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
929 internal int GetHierarchyDepth()
931 int ret = Interop.Actor.Actor_GetHierarchyDepth(swigCPtr);
932 if (NDalicPINVOKE.SWIGPendingException.Pending)
933 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
937 internal uint GetRendererCount()
939 uint ret = Interop.Actor.Actor_GetRendererCount(swigCPtr);
940 if (NDalicPINVOKE.SWIGPendingException.Pending)
941 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
945 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
947 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
950 internal bool IsTopLevelView()
952 if (GetParent() is Layer)
959 internal void SetKeyInputFocus()
961 Interop.ViewInternal.View_SetKeyInputFocus(swigCPtr);
962 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
965 internal void ClearKeyInputFocus()
967 Interop.ViewInternal.View_ClearKeyInputFocus(swigCPtr);
968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
971 internal PinchGestureDetector GetPinchGestureDetector()
973 PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.View_GetPinchGestureDetector(swigCPtr), true);
974 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
978 internal PanGestureDetector GetPanGestureDetector()
980 PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.View_GetPanGestureDetector(swigCPtr), true);
981 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
985 internal TapGestureDetector GetTapGestureDetector()
987 TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.View_GetTapGestureDetector(swigCPtr), true);
988 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
992 internal LongPressGestureDetector GetLongPressGestureDetector()
994 LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.View_GetLongPressGestureDetector(swigCPtr), true);
995 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
999 internal IntPtr GetPtrfromView()
1001 return (IntPtr)swigCPtr;
1004 internal void RemoveChild(View child)
1006 // Do actual child removal
1007 Interop.Actor.Actor_Remove(swigCPtr, View.getCPtr(child));
1008 if (NDalicPINVOKE.SWIGPendingException.Pending)
1009 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1011 Children.Remove(child);
1012 child.InternalParent = null;
1014 if (ChildRemoved != null)
1016 ChildRemovedEventArgs e = new ChildRemovedEventArgs
1020 ChildRemoved(this, e);
1025 /// Removes the layout from this View.
1027 internal void ResetLayout()
1032 internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1034 return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.BACKGROUND);
1037 internal virtual void UpdateCornerRadius(float value)
1041 (backgroundExtraData ?? (backgroundExtraData = new BackgroundExtraData())).CornerRadius = value;
1044 Tizen.NUI.PropertyMap backgroundMap = new Tizen.NUI.PropertyMap();
1045 Tizen.NUI.Object.GetProperty(swigCPtr, View.Property.BACKGROUND).Get(backgroundMap);
1047 if (!backgroundMap.Empty())
1049 backgroundMap[Visual.Property.CornerRadius] = new PropertyValue(value);
1050 Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(backgroundMap));
1053 UpdateShadowCornerRadius(value);
1056 internal void UpdateStyle()
1059 if (styleName == null) newStyle = ThemeManager.GetStyle(GetType());
1060 else newStyle = ThemeManager.GetStyle(styleName);
1062 if (newStyle != null && (viewStyle == null || viewStyle.GetType() == newStyle.GetType())) ApplyStyle(newStyle);
1066 /// you can override it to clean-up your own resources.
1068 /// <param name="type">DisposeTypes</param>
1069 /// <since_tizen> 3 </since_tizen>
1070 protected override void Dispose(DisposeTypes type)
1077 //_mergedStyle = null;
1079 if (type == DisposeTypes.Explicit)
1082 //Release your own managed resources here.
1083 //You should release all of your own disposable objects here.
1084 selectorData?.Reset(this);
1085 if (themeChangeSensitive)
1087 ThemeManager.ThemeChangedInternal -= OnThemeChanged;
1091 //Release your own unmanaged resources here.
1092 //You should not access any managed member here except static instance.
1093 //because the execution order of Finalizes is non-deterministic.
1096 DisConnectFromSignals();
1099 foreach (View view in Children)
1101 view.InternalParent = null;
1107 /// This will not be public opened.
1108 [EditorBrowsable(EditorBrowsableState.Never)]
1109 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1111 Interop.View.delete_View(swigCPtr);
1115 /// The touch event handler for ControlState.
1116 /// Please change ControlState value by touch state if needed.
1118 [EditorBrowsable(EditorBrowsableState.Never)]
1119 protected virtual bool HandleControlStateOnTouch(Touch touch)
1121 switch(touch.GetState(0))
1123 case PointStateType.Down:
1124 ControlState += ControlState.Pressed;
1126 case PointStateType.Interrupted:
1127 case PointStateType.Up:
1128 if (ControlState.Contains(ControlState.Pressed))
1130 ControlState -= ControlState.Pressed;
1140 private void DisConnectFromSignals()
1142 // Save current CPtr.
1143 global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr;
1145 // Use BaseHandle CPtr as current might have been deleted already in derived classes.
1146 swigCPtr = GetBaseHandleCPtrHandleRef;
1148 if (_onRelayoutEventCallback != null)
1150 this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback);
1151 _onRelayoutEventCallback = null;
1154 if (_offWindowEventCallback != null)
1156 this.OffWindowSignal().Disconnect(_offWindowEventCallback);
1157 _offWindowEventCallback = null;
1160 if (_onWindowEventCallback != null)
1162 this.OnWindowSignal().Disconnect(_onWindowEventCallback);
1163 _onWindowEventCallback = null;
1166 if (_wheelEventCallback != null)
1168 this.WheelEventSignal().Disconnect(_wheelEventCallback);
1171 if (WindowWheelEventHandler != null)
1173 NUIApplication.GetDefaultWindow().WheelEvent -= OnWindowWheelEvent;
1176 if (_hoverEventCallback != null)
1178 this.HoveredSignal().Disconnect(_hoverEventCallback);
1181 if (_interceptTouchDataCallback != null)
1183 this.InterceptTouchSignal().Disconnect(_interceptTouchDataCallback);
1186 if (_touchDataCallback != null)
1188 this.TouchSignal().Disconnect(_touchDataCallback);
1191 if (_ResourcesLoadedCallback != null)
1193 this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback);
1194 _ResourcesLoadedCallback = null;
1197 if (_keyCallback != null)
1199 this.KeyEventSignal().Disconnect(_keyCallback);
1202 if (_keyInputFocusLostCallback != null)
1204 this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback);
1207 if (_keyInputFocusGainedCallback != null)
1209 this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback);
1212 if (_backgroundResourceLoadedCallback != null)
1214 this.ResourcesLoadedSignal().Disconnect(_backgroundResourceLoadedCallback);
1215 _backgroundResourceLoadedCallback = null;
1218 if (_onWindowSendEventCallback != null)
1220 this.OnWindowSignal().Disconnect(_onWindowSendEventCallback);
1221 _onWindowSendEventCallback = null;
1224 // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here.
1225 // Restore current CPtr.
1226 swigCPtr = currentCPtr;
1229 private View ConvertIdToView(uint id)
1231 View view = GetParent()?.FindCurrentChildById(id);
1233 //If we can't find the parent's children, find in the top layer.
1236 Container parent = GetParent();
1237 while ((parent is View) && (parent != null))
1239 parent = parent.GetParent();
1240 if (parent is Layer)
1242 view = parent.FindCurrentChildById(id);
1251 private void LoadTransitions()
1253 foreach (string str in transitionNames)
1255 string resourceName = str + ".xaml";
1256 Transition trans = null;
1258 string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
1260 string likelyResourcePath = resource + "animation/" + resourceName;
1262 if (File.Exists(likelyResourcePath))
1264 trans = Xaml.Extensions.LoadObject<Transition>(likelyResourcePath);
1268 transDictionary.Add(trans.Name, trans);
1273 private void OnScaleChanged(float x, float y, float z)
1275 Scale = new Vector3(x, y, z);
1278 private void OnBackgroundColorChanged(float r, float g, float b, float a)
1280 BackgroundColor = new Color(r, g, b, a);
1283 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1285 Padding = new Extents(start, end, top, bottom);
1288 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1290 Margin = new Extents(start, end, top, bottom);
1293 private void OnColorChanged(float r, float g, float b, float a)
1295 Color = new Color(r, g, b, a);
1298 private void OnAnchorPointChanged(float x, float y, float z)
1300 AnchorPoint = new Position(x, y, z);
1303 private void OnCellIndexChanged(float x, float y)
1305 CellIndex = new Vector2(x, y);
1308 private void OnFlexMarginChanged(float x, float y, float z, float w)
1310 FlexMargin = new Vector4(x, y, z, w);
1313 private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1315 PaddingEX = new Extents(start, end, top, bottom);
1318 private void OnSizeModeFactorChanged(float x, float y, float z)
1320 SizeModeFactor = new Vector3(x, y, z);
1323 private void UpdateShadowCornerRadius(float value)
1325 // TODO Update corner radius property only whe DALi supports visual property update.
1326 PropertyMap map = new PropertyMap();
1328 if (Tizen.NUI.Object.GetProperty(swigCPtr, View.Property.SHADOW).Get(map) && !map.Empty())
1330 map[Visual.Property.CornerRadius] = new PropertyValue(value);
1332 Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SHADOW, new PropertyValue(map));
1336 private bool EmptyOnTouch(object target, TouchEventArgs args)