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;
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.Binding;
25 namespace Tizen.NUI.BaseComponents
28 /// View is the base class for all views.
30 /// <since_tizen> 3 </since_tizen>
31 public partial class View
33 private MergedStyle mergedStyle = null;
34 internal MergedStyle _mergedStyle
38 if (null == mergedStyle)
40 mergedStyle = new MergedStyle(GetType(), this);
48 /// The color mode of View.
49 /// This specifies whether the View uses its own color, or inherits its parent color.
50 /// The default is ColorMode.UseOwnMultiplyParentColor.
52 internal ColorMode ColorMode
60 return GetColorMode();
64 internal float WorldPositionX
69 GetProperty(View.Property.WORLD_POSITION_X).Get(out temp);
74 internal float WorldPositionY
79 GetProperty(View.Property.WORLD_POSITION_Y).Get(out temp);
84 internal float WorldPositionZ
89 GetProperty(View.Property.WORLD_POSITION_Z).Get(out temp);
94 internal bool FocusState
98 return IsKeyboardFocusable();
102 SetKeyboardFocusable(value);
106 internal void SetLayout(LayoutItem layout)
109 _layout?.AttachToOwner(this);
110 _layout?.RequestLayout();
114 /// Stores the calculated width value and its ModeType. Width component.
116 internal MeasureSpecification MeasureSpecificationWidth
120 _measureSpecificationWidth = value;
121 _layout?.RequestLayout();
125 return _measureSpecificationWidth;
130 /// Stores the calculated width value and its ModeType. Height component.
132 internal MeasureSpecification MeasureSpecificationHeight
136 _measureSpecificationHeight = value;
137 _layout?.RequestLayout();
141 return _measureSpecificationHeight;
145 internal void AttachTransitionsToChildren(LayoutTransition transition)
147 // Iterate children, adding the transition unless a transition
148 // for the same condition and property has already been
150 foreach (View view in Children)
152 LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
156 internal float ParentOriginX
161 GetProperty(View.Property.PARENT_ORIGIN_X).Get(out temp);
166 SetProperty(View.Property.PARENT_ORIGIN_X, new Tizen.NUI.PropertyValue(value));
167 NotifyPropertyChanged();
171 internal float ParentOriginY
176 GetProperty(View.Property.PARENT_ORIGIN_Y).Get(out temp);
181 SetProperty(View.Property.PARENT_ORIGIN_Y, new Tizen.NUI.PropertyValue(value));
182 NotifyPropertyChanged();
186 internal float ParentOriginZ
191 GetProperty(View.Property.PARENT_ORIGIN_Z).Get(out temp);
196 SetProperty(View.Property.PARENT_ORIGIN_Z, new Tizen.NUI.PropertyValue(value));
197 NotifyPropertyChanged();
201 internal float PivotPointX
206 GetProperty(View.Property.ANCHOR_POINT_X).Get(out temp);
211 SetProperty(View.Property.ANCHOR_POINT_X, new Tizen.NUI.PropertyValue(value));
215 internal float PivotPointY
220 GetProperty(View.Property.ANCHOR_POINT_Y).Get(out temp);
225 SetProperty(View.Property.ANCHOR_POINT_Y, new Tizen.NUI.PropertyValue(value));
229 internal float PivotPointZ
234 GetProperty(View.Property.ANCHOR_POINT_Z).Get(out temp);
239 SetProperty(View.Property.ANCHOR_POINT_Z, new Tizen.NUI.PropertyValue(value));
243 internal Matrix WorldMatrix
247 Matrix temp = new Matrix();
248 GetProperty(View.Property.WORLD_MATRIX).Get(temp);
253 private int LeftFocusableViewId
258 GetProperty(View.Property.LEFT_FOCUSABLE_VIEW_ID).Get(out temp);
263 SetProperty(View.Property.LEFT_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
267 private int RightFocusableViewId
272 GetProperty(View.Property.RIGHT_FOCUSABLE_VIEW_ID).Get(out temp);
277 SetProperty(View.Property.RIGHT_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
281 private int UpFocusableViewId
286 GetProperty(View.Property.UP_FOCUSABLE_VIEW_ID).Get(out temp);
291 SetProperty(View.Property.UP_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
295 private int DownFocusableViewId
300 GetProperty(View.Property.DOWN_FOCUSABLE_VIEW_ID).Get(out temp);
305 SetProperty(View.Property.DOWN_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value));
309 internal void Raise()
311 var parentChildren = GetParent()?.Children;
313 if (parentChildren != null)
315 int currentIndex = parentChildren.IndexOf(this);
317 // If the view is not already the last item in the list.
318 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
320 View temp = parentChildren[currentIndex + 1];
321 parentChildren[currentIndex + 1] = this;
322 parentChildren[currentIndex] = temp;
324 Interop.NDalic.Raise(swigCPtr);
325 if (NDalicPINVOKE.SWIGPendingException.Pending)
326 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331 internal void Lower()
333 var parentChildren = GetParent()?.Children;
335 if (parentChildren != null)
337 int currentIndex = parentChildren.IndexOf(this);
339 // If the view is not already the first item in the list.
340 if (currentIndex > 0 && currentIndex < parentChildren.Count)
342 View temp = parentChildren[currentIndex - 1];
343 parentChildren[currentIndex - 1] = this;
344 parentChildren[currentIndex] = temp;
346 Interop.NDalic.Lower(swigCPtr);
347 if (NDalicPINVOKE.SWIGPendingException.Pending)
348 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354 /// Raises the view to above the target view.
356 /// <remarks>The sibling order of views within the parent will be updated automatically.
357 /// Views on the level above the target view will still be shown above this view.
358 /// Raising this view above views with the same sibling order as each other will raise this view above them.
359 /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
361 /// <param name="target">Will be raised above this view.</param>
362 internal void RaiseAbove(View target)
364 var parentChildren = GetParent()?.Children;
366 if (parentChildren != null)
368 int currentIndex = parentChildren.IndexOf(this);
369 int targetIndex = parentChildren.IndexOf(target);
371 if (currentIndex < 0 || targetIndex < 0 ||
372 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
374 NUILog.Error("index should be bigger than 0 and less than children of layer count");
377 // If the currentIndex is less than the target index and the target has the same parent.
378 if (currentIndex < targetIndex)
380 parentChildren.Remove(this);
381 parentChildren.Insert(targetIndex, this);
383 Interop.NDalic.RaiseAbove(swigCPtr, View.getCPtr(target));
384 if (NDalicPINVOKE.SWIGPendingException.Pending)
385 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 /// Lowers the view to below the target view.
394 /// <remarks>The sibling order of views within the parent will be updated automatically.
395 /// Lowering this view below views with the same sibling order as each other will lower this view above them.
396 /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
398 /// <param name="target">Will be lowered below this view.</param>
399 internal void LowerBelow(View target)
401 var parentChildren = GetParent()?.Children;
403 if (parentChildren != null)
405 int currentIndex = parentChildren.IndexOf(this);
406 int targetIndex = parentChildren.IndexOf(target);
407 if (currentIndex < 0 || targetIndex < 0 ||
408 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
410 NUILog.Error("index should be bigger than 0 and less than children of layer count");
414 // If the currentIndex is not already the 0th index and the target has the same parent.
415 if ((currentIndex != 0) && (targetIndex != -1) &&
416 (currentIndex > targetIndex))
418 parentChildren.Remove(this);
419 parentChildren.Insert(targetIndex, this);
421 Interop.NDalic.LowerBelow(swigCPtr, View.getCPtr(target));
422 if (NDalicPINVOKE.SWIGPendingException.Pending)
423 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429 internal string GetName()
431 string ret = Interop.Actor.Actor_GetName(swigCPtr);
432 if (NDalicPINVOKE.SWIGPendingException.Pending)
433 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
437 internal void SetName(string name)
439 Interop.Actor.Actor_SetName(swigCPtr, name);
440 if (NDalicPINVOKE.SWIGPendingException.Pending)
441 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
444 internal uint GetId()
446 uint ret = Interop.Actor.Actor_GetId(swigCPtr);
447 if (NDalicPINVOKE.SWIGPendingException.Pending)
448 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
452 internal bool IsRoot()
454 bool ret = Interop.ActorInternal.Actor_IsRoot(swigCPtr);
455 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
459 internal bool OnWindow()
461 bool ret = Interop.Actor.Actor_OnStage(swigCPtr);
462 if (NDalicPINVOKE.SWIGPendingException.Pending)
463 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
467 internal View FindChildById(uint id)
469 //to fix memory leak issue, match the handle count with native side.
470 IntPtr cPtr = Interop.Actor.Actor_FindChildById(swigCPtr, id);
471 View ret = this.GetInstanceSafely<View>(cPtr);
472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476 internal override View FindCurrentChildById(uint id)
478 return FindChildById(id);
481 internal void SetParentOrigin(Vector3 origin)
483 Interop.ActorInternal.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin));
484 if (NDalicPINVOKE.SWIGPendingException.Pending)
485 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
488 internal Vector3 GetCurrentParentOrigin()
490 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentParentOrigin(swigCPtr), true);
491 if (NDalicPINVOKE.SWIGPendingException.Pending)
492 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496 internal void SetAnchorPoint(Vector3 anchorPoint)
498 Interop.Actor.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint));
499 if (NDalicPINVOKE.SWIGPendingException.Pending)
500 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
503 internal Vector3 GetCurrentAnchorPoint()
505 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentAnchorPoint(swigCPtr), true);
506 if (NDalicPINVOKE.SWIGPendingException.Pending)
507 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
511 internal void SetSize(float width, float height)
513 Interop.ActorInternal.Actor_SetSize__SWIG_0(swigCPtr, width, height);
514 if (NDalicPINVOKE.SWIGPendingException.Pending)
515 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518 internal void SetSize(float width, float height, float depth)
520 Interop.ActorInternal.Actor_SetSize__SWIG_1(swigCPtr, width, height, depth);
521 if (NDalicPINVOKE.SWIGPendingException.Pending)
522 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
525 internal void SetSize(Vector2 size)
527 Interop.ActorInternal.Actor_SetSize__SWIG_2(swigCPtr, Vector2.getCPtr(size));
528 if (NDalicPINVOKE.SWIGPendingException.Pending)
529 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 internal void SetSize(Vector3 size)
534 Interop.ActorInternal.Actor_SetSize__SWIG_3(swigCPtr, Vector3.getCPtr(size));
535 if (NDalicPINVOKE.SWIGPendingException.Pending)
536 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539 internal Vector3 GetTargetSize()
541 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetTargetSize(swigCPtr), true);
542 if (NDalicPINVOKE.SWIGPendingException.Pending)
543 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 internal Size2D GetCurrentSize()
549 Size ret = new Size(Interop.Actor.Actor_GetCurrentSize(swigCPtr), true);
550 if (NDalicPINVOKE.SWIGPendingException.Pending)
551 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552 Size2D size = new Size2D((int)ret.Width, (int)ret.Height);
556 internal Vector3 GetNaturalSize()
558 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
559 if (NDalicPINVOKE.SWIGPendingException.Pending)
560 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 internal void SetPosition(float x, float y)
566 Interop.ActorInternal.Actor_SetPosition__SWIG_0(swigCPtr, x, y);
567 if (NDalicPINVOKE.SWIGPendingException.Pending)
568 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
571 internal void SetPosition(float x, float y, float z)
573 Interop.ActorInternal.Actor_SetPosition__SWIG_1(swigCPtr, x, y, z);
574 if (NDalicPINVOKE.SWIGPendingException.Pending)
575 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
578 internal void SetPosition(Vector3 position)
580 Interop.ActorInternal.Actor_SetPosition__SWIG_2(swigCPtr, Vector3.getCPtr(position));
581 if (NDalicPINVOKE.SWIGPendingException.Pending)
582 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585 internal void SetX(float x)
587 Interop.ActorInternal.Actor_SetX(swigCPtr, x);
588 if (NDalicPINVOKE.SWIGPendingException.Pending)
589 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
592 internal void SetY(float y)
594 Interop.ActorInternal.Actor_SetY(swigCPtr, y);
595 if (NDalicPINVOKE.SWIGPendingException.Pending)
596 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
599 internal void SetZ(float z)
601 Interop.ActorInternal.Actor_SetZ(swigCPtr, z);
602 if (NDalicPINVOKE.SWIGPendingException.Pending)
603 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606 internal void TranslateBy(Vector3 distance)
608 Interop.ActorInternal.Actor_TranslateBy(swigCPtr, Vector3.getCPtr(distance));
609 if (NDalicPINVOKE.SWIGPendingException.Pending)
610 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
613 internal Position GetCurrentPosition()
615 Position ret = new Position(Interop.Actor.Actor_GetCurrentPosition(swigCPtr), true);
616 if (NDalicPINVOKE.SWIGPendingException.Pending)
617 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
621 internal Vector3 GetCurrentWorldPosition()
623 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentWorldPosition(swigCPtr), true);
624 if (NDalicPINVOKE.SWIGPendingException.Pending)
625 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
629 internal void SetInheritPosition(bool inherit)
631 Interop.ActorInternal.Actor_SetInheritPosition(swigCPtr, inherit);
632 if (NDalicPINVOKE.SWIGPendingException.Pending)
633 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636 internal bool IsPositionInherited()
638 bool ret = Interop.ActorInternal.Actor_IsPositionInherited(swigCPtr);
639 if (NDalicPINVOKE.SWIGPendingException.Pending)
640 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
644 internal void SetOrientation(Degree angle, Vector3 axis)
646 Interop.ActorInternal.Actor_SetOrientation__SWIG_0(swigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
647 if (NDalicPINVOKE.SWIGPendingException.Pending)
648 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651 internal void SetOrientation(Radian angle, Vector3 axis)
653 Interop.ActorInternal.Actor_SetOrientation__SWIG_1(swigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
654 if (NDalicPINVOKE.SWIGPendingException.Pending)
655 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658 internal void SetOrientation(Rotation orientation)
660 Interop.ActorInternal.Actor_SetOrientation__SWIG_2(swigCPtr, Rotation.getCPtr(orientation));
661 if (NDalicPINVOKE.SWIGPendingException.Pending)
662 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 internal Rotation GetCurrentOrientation()
667 Rotation ret = new Rotation(Interop.ActorInternal.Actor_GetCurrentOrientation(swigCPtr), true);
668 if (NDalicPINVOKE.SWIGPendingException.Pending)
669 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673 internal void SetInheritOrientation(bool inherit)
675 Interop.ActorInternal.Actor_SetInheritOrientation(swigCPtr, inherit);
676 if (NDalicPINVOKE.SWIGPendingException.Pending)
677 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
680 internal bool IsOrientationInherited()
682 bool ret = Interop.ActorInternal.Actor_IsOrientationInherited(swigCPtr);
683 if (NDalicPINVOKE.SWIGPendingException.Pending)
684 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 internal Rotation GetCurrentWorldOrientation()
690 Rotation ret = new Rotation(Interop.ActorInternal.Actor_GetCurrentWorldOrientation(swigCPtr), true);
691 if (NDalicPINVOKE.SWIGPendingException.Pending)
692 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
696 internal void SetScale(float scale)
698 Interop.ActorInternal.Actor_SetScale__SWIG_0(swigCPtr, scale);
699 if (NDalicPINVOKE.SWIGPendingException.Pending)
700 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703 internal void SetScale(float scaleX, float scaleY, float scaleZ)
705 Interop.ActorInternal.Actor_SetScale__SWIG_1(swigCPtr, scaleX, scaleY, scaleZ);
706 if (NDalicPINVOKE.SWIGPendingException.Pending)
707 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710 internal void SetScale(Vector3 scale)
712 Interop.ActorInternal.Actor_SetScale__SWIG_2(swigCPtr, Vector3.getCPtr(scale));
713 if (NDalicPINVOKE.SWIGPendingException.Pending)
714 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
717 internal Vector3 GetCurrentScale()
719 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentScale(swigCPtr), true);
720 if (NDalicPINVOKE.SWIGPendingException.Pending)
721 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725 internal Vector3 GetCurrentWorldScale()
727 Vector3 ret = new Vector3(Interop.ActorInternal.Actor_GetCurrentWorldScale(swigCPtr), true);
728 if (NDalicPINVOKE.SWIGPendingException.Pending)
729 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733 internal void SetInheritScale(bool inherit)
735 Interop.ActorInternal.Actor_SetInheritScale(swigCPtr, inherit);
736 if (NDalicPINVOKE.SWIGPendingException.Pending)
737 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 internal bool IsScaleInherited()
742 bool ret = Interop.ActorInternal.Actor_IsScaleInherited(swigCPtr);
743 if (NDalicPINVOKE.SWIGPendingException.Pending)
744 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
748 internal Matrix GetCurrentWorldMatrix()
750 Matrix ret = new Matrix(Interop.ActorInternal.Actor_GetCurrentWorldMatrix(swigCPtr), true);
751 if (NDalicPINVOKE.SWIGPendingException.Pending)
752 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
756 internal void SetVisible(bool visible)
758 Interop.Actor.Actor_SetVisible(swigCPtr, visible);
759 if (NDalicPINVOKE.SWIGPendingException.Pending)
760 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 internal bool IsVisible()
765 bool ret = Interop.ActorInternal.Actor_IsVisible(swigCPtr);
766 if (NDalicPINVOKE.SWIGPendingException.Pending)
767 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
771 internal void SetOpacity(float opacity)
773 Interop.ActorInternal.Actor_SetOpacity(swigCPtr, opacity);
774 if (NDalicPINVOKE.SWIGPendingException.Pending)
775 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778 internal float GetCurrentOpacity()
780 float ret = Interop.ActorInternal.Actor_GetCurrentOpacity(swigCPtr);
781 if (NDalicPINVOKE.SWIGPendingException.Pending)
782 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 internal void SetColor(Vector4 color)
788 Interop.ActorInternal.Actor_SetColor(swigCPtr, Vector4.getCPtr(color));
789 if (NDalicPINVOKE.SWIGPendingException.Pending)
790 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 internal Vector4 GetCurrentColor()
795 Vector4 ret = new Vector4(Interop.ActorInternal.Actor_GetCurrentColor(swigCPtr), true);
796 if (NDalicPINVOKE.SWIGPendingException.Pending)
797 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 internal ColorMode GetColorMode()
802 ColorMode ret = (ColorMode)Interop.ActorInternal.Actor_GetColorMode(swigCPtr);
803 if (NDalicPINVOKE.SWIGPendingException.Pending)
804 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
808 internal Vector4 GetCurrentWorldColor()
810 Vector4 ret = new Vector4(Interop.ActorInternal.Actor_GetCurrentWorldColor(swigCPtr), true);
811 if (NDalicPINVOKE.SWIGPendingException.Pending)
812 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
816 internal void SetDrawMode(DrawModeType drawMode)
818 Interop.ActorInternal.Actor_SetDrawMode(swigCPtr, (int)drawMode);
819 if (NDalicPINVOKE.SWIGPendingException.Pending)
820 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 internal DrawModeType GetDrawMode()
825 DrawModeType ret = (DrawModeType)Interop.ActorInternal.Actor_GetDrawMode(swigCPtr);
826 if (NDalicPINVOKE.SWIGPendingException.Pending)
827 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
831 internal void SetKeyboardFocusable(bool focusable)
833 Interop.ActorInternal.Actor_SetKeyboardFocusable(swigCPtr, focusable);
834 if (NDalicPINVOKE.SWIGPendingException.Pending)
835 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 internal bool IsKeyboardFocusable()
840 bool ret = Interop.ActorInternal.Actor_IsKeyboardFocusable(swigCPtr);
841 if (NDalicPINVOKE.SWIGPendingException.Pending)
842 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
846 internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
848 Interop.Actor.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension);
849 if (NDalicPINVOKE.SWIGPendingException.Pending)
850 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
853 internal ResizePolicyType GetResizePolicy(DimensionType dimension)
855 ResizePolicyType ret = (ResizePolicyType)Interop.Actor.Actor_GetResizePolicy(swigCPtr, (int)dimension);
856 if (NDalicPINVOKE.SWIGPendingException.Pending)
857 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
861 internal Vector3 GetSizeModeFactor()
863 Vector3 ret = new Vector3(Interop.Actor.Actor_GetSizeModeFactor(swigCPtr), true);
864 if (NDalicPINVOKE.SWIGPendingException.Pending)
865 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 internal void SetMinimumSize(Vector2 size)
871 Interop.ActorInternal.Actor_SetMinimumSize(swigCPtr, Vector2.getCPtr(size));
872 if (NDalicPINVOKE.SWIGPendingException.Pending)
873 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
876 internal Vector2 GetMinimumSize()
878 Vector2 ret = new Vector2(Interop.ActorInternal.Actor_GetMinimumSize(swigCPtr), true);
879 if (NDalicPINVOKE.SWIGPendingException.Pending)
880 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
884 internal void SetMaximumSize(Vector2 size)
886 Interop.ActorInternal.Actor_SetMaximumSize(swigCPtr, Vector2.getCPtr(size));
887 if (NDalicPINVOKE.SWIGPendingException.Pending)
888 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
891 internal Vector2 GetMaximumSize()
893 Vector2 ret = new Vector2(Interop.ActorInternal.Actor_GetMaximumSize(swigCPtr), true);
894 if (NDalicPINVOKE.SWIGPendingException.Pending)
895 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
899 internal int GetHierarchyDepth()
901 int ret = Interop.Actor.Actor_GetHierarchyDepth(swigCPtr);
902 if (NDalicPINVOKE.SWIGPendingException.Pending)
903 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
907 internal uint GetRendererCount()
909 uint ret = Interop.Actor.Actor_GetRendererCount(swigCPtr);
910 if (NDalicPINVOKE.SWIGPendingException.Pending)
911 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
915 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
917 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
920 internal bool IsTopLevelView()
922 if (GetParent() is Layer)
929 internal void SetKeyInputFocus()
931 Interop.ViewInternal.View_SetKeyInputFocus(swigCPtr);
932 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935 internal void ClearKeyInputFocus()
937 Interop.ViewInternal.View_ClearKeyInputFocus(swigCPtr);
938 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
941 internal PinchGestureDetector GetPinchGestureDetector()
943 PinchGestureDetector ret = new PinchGestureDetector(Interop.ViewInternal.View_GetPinchGestureDetector(swigCPtr), true);
944 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948 internal PanGestureDetector GetPanGestureDetector()
950 PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.View_GetPanGestureDetector(swigCPtr), true);
951 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
955 internal TapGestureDetector GetTapGestureDetector()
957 TapGestureDetector ret = new TapGestureDetector(Interop.ViewInternal.View_GetTapGestureDetector(swigCPtr), true);
958 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
962 internal LongPressGestureDetector GetLongPressGestureDetector()
964 LongPressGestureDetector ret = new LongPressGestureDetector(Interop.ViewInternal.View_GetLongPressGestureDetector(swigCPtr), true);
965 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969 internal IntPtr GetPtrfromView()
971 return (IntPtr)swigCPtr;
974 internal void RemoveChild(View child)
976 // Do actual child removal
977 Interop.Actor.Actor_Remove(swigCPtr, View.getCPtr(child));
978 if (NDalicPINVOKE.SWIGPendingException.Pending)
979 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
981 Children.Remove(child);
982 child.InternalParent = null;
984 if (ChildRemoved != null)
986 ChildRemovedEventArgs e = new ChildRemovedEventArgs
990 ChildRemoved(this, e);
995 /// Removes the layout from this View.
997 internal void ResetLayout()
1002 internal ResourceLoadingStatusType GetBackgroundResourceStatus()
1004 return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.BACKGROUND);
1008 /// you can override it to clean-up your own resources.
1010 /// <param name="type">DisposeTypes</param>
1011 /// <since_tizen> 3 </since_tizen>
1012 protected override void Dispose(DisposeTypes type)
1019 //_mergedStyle = null;
1021 //Release your own unmanaged resources here.
1022 //You should not access any managed member here except static instance.
1023 //because the execution order of Finalizes is non-deterministic.
1026 DisConnectFromSignals();
1029 foreach (View view in Children)
1031 view.InternalParent = null;
1037 /// This will not be public opened.
1038 [EditorBrowsable(EditorBrowsableState.Never)]
1039 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1041 Interop.View.delete_View(swigCPtr);
1044 private void DisConnectFromSignals()
1046 // Save current CPtr.
1047 global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr;
1049 // Use BaseHandle CPtr as current might have been deleted already in derived classes.
1050 swigCPtr = GetBaseHandleCPtrHandleRef;
1052 if (_onRelayoutEventCallback != null)
1054 this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback);
1057 if (_offWindowEventCallback != null)
1059 this.OffWindowSignal().Disconnect(_offWindowEventCallback);
1062 if (_onWindowEventCallback != null)
1064 this.OnWindowSignal().Disconnect(_onWindowEventCallback);
1067 if (_wheelEventCallback != null)
1069 this.WheelEventSignal().Disconnect(_wheelEventCallback);
1072 if (_hoverEventCallback != null)
1074 this.HoveredSignal().Disconnect(_hoverEventCallback);
1077 if (_touchDataCallback != null)
1079 this.TouchSignal().Disconnect(_touchDataCallback);
1082 if (_ResourcesLoadedCallback != null)
1084 this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback);
1087 if (_offWindowEventCallback != null)
1089 this.OffWindowSignal().Disconnect(_offWindowEventCallback);
1092 if (_onWindowEventCallback != null)
1094 this.OnWindowSignal().Disconnect(_onWindowEventCallback);
1097 if (_wheelEventCallback != null)
1099 this.WheelEventSignal().Disconnect(_wheelEventCallback);
1102 if (_hoverEventCallback != null)
1104 this.HoveredSignal().Disconnect(_hoverEventCallback);
1107 if (_touchDataCallback != null)
1109 this.TouchSignal().Disconnect(_touchDataCallback);
1112 if (_onRelayoutEventCallback != null)
1114 this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback);
1117 if (_keyCallback != null)
1119 this.KeyEventSignal().Disconnect(_keyCallback);
1122 if (_keyInputFocusLostCallback != null)
1124 this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback);
1127 if (_keyInputFocusGainedCallback != null)
1129 this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback);
1132 if (_backgroundResourceLoadedCallback != null)
1134 this.ResourcesLoadedSignal().Disconnect(_backgroundResourceLoadedCallback);
1137 if (_onWindowSendEventCallback != null)
1139 this.OnWindowSignal().Disconnect(_onWindowSendEventCallback);
1142 // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here.
1143 // Restore current CPtr.
1144 swigCPtr = currentCPtr;
1147 private View ConvertIdToView(uint id)
1149 View view = GetParent()?.FindCurrentChildById(id);
1151 //If we can't find the parent's children, find in the top layer.
1154 Container parent = GetParent();
1155 while ((parent is View) && (parent != null))
1157 parent = parent.GetParent();
1158 if (parent is Layer)
1160 view = parent.FindCurrentChildById(id);
1169 private void LoadTransitions()
1171 foreach (string str in transitionNames)
1173 string resourceName = str + ".xaml";
1174 Transition trans = null;
1176 string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
1178 string likelyResourcePath = resource + "animation/" + resourceName;
1180 if (File.Exists(likelyResourcePath))
1182 trans = Xaml.Extensions.LoadObject<Transition>(likelyResourcePath);
1186 transDictionary.Add(trans.Name, trans);
1192 private void OnScaleChanged(float x, float y, float z)
1194 Scale = new Vector3(x, y, z);
1197 private void OnBackgroundColorChanged(float r, float g, float b, float a)
1199 BackgroundColor = new Color(r, g, b, a);
1202 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
1204 Padding = new Extents(start, end, top, bottom);
1207 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
1209 Margin = new Extents(start, end, top, bottom);
1212 private void OnColorChanged(float r, float g, float b, float a)
1214 Color = new Color(r, g, b, a);
1217 private void OnAnchorPointChanged(float x, float y, float z)
1219 AnchorPoint = new Position(x, y, z);
1222 private void OnCellIndexChanged(float x, float y)
1224 CellIndex = new Vector2(x, y);
1227 private void OnFlexMarginChanged(float x, float y, float z, float w)
1229 FlexMargin = new Vector4(x, y, z, w);
1232 private void OnPaddingEXChanged(ushort start, ushort end, ushort top, ushort bottom)
1234 PaddingEX = new Extents(start, end, top, bottom);
1237 private void OnSizeModeFactorChanged(float x, float y, float z)
1239 SizeModeFactor = new Vector3(x, y, z);