X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FBaseComponents%2FView.cs;h=dd4ac211da4cfac90a52a59b5c38ed8b9399354b;hb=8556b965939d98a121ff87a7203dce5fb02f05b5;hp=6a27657d83dc2b6bc3051d5c919dea12ff0c222a;hpb=f355f837f7ccb76d3beaef220c841b114792faac;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 6a27657..dd4ac21 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -63,21 +63,6 @@ namespace Tizen.NUI.BaseComponents public const int WrapContent = -2; } - /// - /// [Draft] Replaced by LayoutParamPolicies, will be removed once occurrences replaced. - /// - internal enum ChildLayoutData - { - /// - /// Constant which indicates child size should match parent size - /// - MatchParent = LayoutParamPolicies.MatchParent, - /// - /// Constant which indicates parent should take the smallest size possible to wrap it's children with their desired size - /// - WrapContent = LayoutParamPolicies.WrapContent, - } - internal enum ResourceLoadingStatusType { Invalid = -1, @@ -1309,6 +1294,9 @@ namespace Tizen.NUI.BaseComponents private global::System.Runtime.InteropServices.HandleRef swigCPtr; private LayoutItem _layout; // Exclusive layout assigned to this View. + + // List of transitions paired with the condition that uses the transition. + private Dictionary _layoutTransitions; private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy private float _weight = 0.0f; // Weighting of child View in a Layout @@ -2278,7 +2266,7 @@ namespace Tizen.NUI.BaseComponents /// This means by default others are impossible so it is recommended that NUI object typed properties are configured by their constructor with parameters.
/// For example, this code is working fine : view.Scale = new Vector3( 2.0f, 1.5f, 0.0f);
/// but this will not work! : view.Scale.X = 2.0f; view.Scale.Y = 1.5f;
- /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimu size is set.
+ /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimum size is set.
/// /// 3 public Size2D Size2D @@ -2295,6 +2283,9 @@ namespace Tizen.NUI.BaseComponents // All Views are currently Layouts. MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly); MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly); + _widthPolicy = value.Width; + _heightPolicy = value.Height; + _layout?.RequestLayout(); NotifyPropertyChanged(); } } @@ -3411,9 +3402,12 @@ namespace Tizen.NUI.BaseComponents } /// - /// The required policy for this dimension, ChildLayoutData enum or exact value. + /// The required policy for this dimension, LayoutParamPolicies enum or exact value. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// + /// Previously named LayoutWidthSpecification + /// [EditorBrowsable(EditorBrowsableState.Never)] public int WidthSpecification { @@ -3427,6 +3421,7 @@ namespace Tizen.NUI.BaseComponents if (_widthPolicy >= 0) { _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly ); + //Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SIZE_WIDTH, new Tizen.NUI.PropertyValue(value)); Size2D.Width = _widthPolicy; } _layout?.RequestLayout(); @@ -3434,9 +3429,12 @@ namespace Tizen.NUI.BaseComponents } /// - /// The required policy for this dimension, ChildLayoutData enum or exact value. + /// The required policy for this dimension, LayoutParamPolicies enum or exact value. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// + /// Previously named LayoutHeightSpecification + /// [EditorBrowsable(EditorBrowsableState.Never)] public int HeightSpecification { @@ -3450,12 +3448,43 @@ namespace Tizen.NUI.BaseComponents if (_heightPolicy >= 0) { _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly ); + //Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SIZE_HEIGHT, new Tizen.NUI.PropertyValue(value)); Size2D.Height = _heightPolicy; } _layout?.RequestLayout(); } } + /// + /// Gets the List of transitions for this View. + /// + /// Hidden-API which is usually used as Inhouse-API. If required to be opened as Public-API, ACR process is needed. + [EditorBrowsable(EditorBrowsableState.Never)] + public Dictionary LayoutTransitions + { + get + { + if (_layoutTransitions == null) + { + _layoutTransitions = new Dictionary(); + } + return _layoutTransitions; + } + } + + internal LayoutTransition LayoutTransition + { + set + { + if (_layoutTransitions == null) + { + _layoutTransitions = new Dictionary(); + } + LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true); + + AttachTransitionsToChildren(value); + } + } /// /// [Obsolete("Please do not use! this will be deprecated")] @@ -3530,72 +3559,6 @@ namespace Tizen.NUI.BaseComponents } } - /// - /// Child property to specify desired width - /// - internal int LayoutWidthSpecificationFixed - { - get - { - return _widthPolicy; - } - set - { - _widthPolicy = value; - _measureSpecificationWidth = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly); - Size2D.Width = value; - _layout?.RequestLayout(); - } - } - - /// - /// Child property to specify desired height - /// - internal int LayoutHeightSpecificationFixed - { - get - { - return _heightPolicy; - } - set - { - _heightPolicy = value; - _measureSpecificationHeight = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly); - Size2D.Height = value; - _layout?.RequestLayout(); - } - } - - /// - /// Child property to specify desired width, use MatchParent/WrapContent) - /// - internal ChildLayoutData LayoutWidthSpecification - { - get - { - return (ChildLayoutData)_widthPolicy; - } - set - { - _widthPolicy = (int)value; - } - } - - /// - /// Child property to specify desired height, use MatchParent/WrapContent) - /// - internal ChildLayoutData LayoutHeightSpecification - { - get - { - return (ChildLayoutData)_heightPolicy; - } - set - { - _heightPolicy = (int)value; - } - } - internal float Weight { get @@ -3605,7 +3568,7 @@ namespace Tizen.NUI.BaseComponents set { _weight = value; - _layout.RequestLayout(); + _layout?.RequestLayout(); } } @@ -3689,8 +3652,6 @@ namespace Tizen.NUI.BaseComponents /// /// Set the layout on this View. Replaces any existing Layout. /// - /// - /// internal LayoutItem Layout { get @@ -3813,6 +3774,17 @@ namespace Tizen.NUI.BaseComponents } } + internal void AttachTransitionsToChildren(LayoutTransition transition) + { + // Iterate children, adding the transition unless a transition + // for the same condition and property has already been + // explicitly added. + foreach (View view in Children) + { + LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions,transition.Condition, transition, false); + } + } + internal float ParentOriginX { get @@ -4053,7 +4025,7 @@ namespace Tizen.NUI.BaseComponents public override void Add(View child) { bool hasLayout = (_layout != null); - Log.Info("NUI", "Add:" + child.Name + " to View:" + Name + "which has layout[" + hasLayout + "] + \n"); + Log.Info("NUI", "Add:" + child.Name + " to View:" + Name + " which has layout[" + hasLayout + "] + \n"); if (null == child) { @@ -4096,23 +4068,22 @@ namespace Tizen.NUI.BaseComponents /// 4 public override void Remove(View child) { - bool hasLayout = (_layout != null); - Log.Info("NUI","Removing View:" + child.Name + "layout[" + hasLayout.ToString() +"]\n"); - - Interop.Actor.Actor_Remove(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (!child || child.GetParent()==null) // Early out if child null. + return; - Children.Remove(child); - child.InternalParent = null; + bool hasLayout = (_layout != null); + Log.Info("NUI","Removing View:" + child.Name + " layout[" + hasLayout.ToString() +"]\n"); - if (ChildRemoved != null) + // If View has a layout then do a deferred child removal + // Actual child removal is performed by the layouting system so + // transitions can be completed. + if (hasLayout) { - ChildRemovedEventArgs e = new ChildRemovedEventArgs - { - Removed = child - }; - ChildRemoved(this, e); + (_layout as LayoutGroup)?.RemoveChildFromLayoutGroup( child ); + } + else + { + RemoveChild(child); } } @@ -5267,25 +5238,6 @@ namespace Tizen.NUI.BaseComponents return ret; } - internal void SetBackgroundColor(Vector4 color) - { - Interop.ViewInternal.View_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal Vector4 GetBackgroundColor() - { - Vector4 ret = new Vector4(Interop.ViewInternal.View_GetBackgroundColor(swigCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal void SetBackgroundImage(Image image) - { - Interop.ViewInternal.View_SetBackgroundImage(swigCPtr, Image.getCPtr(image)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - internal ControlKeySignal KeyEventSignal() { ControlKeySignal ret = new ControlKeySignal(Interop.ViewSignal.View_KeyEventSignal(swigCPtr), false); @@ -5312,6 +5264,26 @@ namespace Tizen.NUI.BaseComponents return (IntPtr)swigCPtr; } + internal void RemoveChild(View child) + { + // Do actual child removal + Interop.Actor.Actor_Remove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + Children.Remove(child); + child.InternalParent = null; + + if (ChildRemoved != null) + { + ChildRemovedEventArgs e = new ChildRemovedEventArgs + { + Removed = child + }; + ChildRemoved(this, e); + } + } + /// /// Removes the layout from this View. ///