--- /dev/null
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System.ComponentModel;
+namespace Tizen.NUI
+{
+ using global::System;
+ using global::System.Runtime.InteropServices;
+
+ /// <summary>
+ /// An abstract base class for Constraints.
+ /// This class only use for inhouse currently.
+ ///
+ /// This can be used to constrain a property of an object, after animations have been applied.
+ /// Constraints are applied in the following order:
+ /// - Constraints are applied to on-stage views in a depth-first traversal.
+ /// - For each view, the constraints are applied in the same order as the calls to Apply().
+ /// - Constraints are not applied to off-stage views.
+ ///
+ /// Create a constraint using one of the New method depending on the type of callback functions used.
+ ///
+ /// Note : This function will called every frame. Maybe reduce performance if you applyed too many constraints.
+ ///
+ /// TODO : AddSource(ConstraintSource); API need to be implemented.
+ /// To implement this, we have to bind ConstraintSource.
+ /// TODO : Currently We don't support custom functions.
+ /// To implement this, we have to bind PropertyInputContainer
+ /// </summary>
+ internal class Constraint : BaseHandle
+ {
+ internal Constraint(IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ /// <summary>
+ /// Apply current constraint.
+ /// Constraint will work until Remove called.
+ /// </summary>
+ internal void Apply()
+ {
+ Interop.Constraint.Apply(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ /// <summary>
+ /// Remove current constraint.
+ /// </summary>
+ internal void Remove()
+ {
+ Interop.Constraint.Remove(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+
+ /// <summary>
+ /// Remove action. Determine the target values action after remove current constriant.
+ /// Default is RemoveActionType.Bake
+ /// </summary>
+ internal RemoveActionType RemoveAction
+ {
+ set => Interop.Constraint.SetRemoveAction(SwigCPtr, (int)value);
+ get => (RemoveActionType) Interop.Constraint.GetRemoveAction(SwigCPtr);
+ }
+
+ /// <summary>
+ /// Tag number. It will be useful when you want to seperate constraints
+ /// </summary>
+ internal uint Tag
+ {
+ set => Interop.Constraint.SetTag(SwigCPtr, value);
+ get => Interop.Constraint.GetTag(SwigCPtr);
+ }
+
+ /// <summary>
+ /// Get constrainted target object
+ /// </summary>
+ internal BaseHandle GetTargetObject()
+ {
+ BaseHandle handle = new BaseHandle(Interop.Constraint.GetTargetObject(SwigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return handle;
+ }
+ /// <summary>
+ /// Get constrainted target property index
+ /// </summary>
+ internal int GetTargetPropert()
+ {
+ int index = Interop.Constraint.GetTargetProperty(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return index;
+ }
+
+ /// <summary>
+ /// Dispose
+ /// </summary>
+ /// <param name="type"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if(disposed)
+ {
+ return;
+ }
+ if(type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+ base.Dispose(type);
+ }
+
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(HandleRef swigCPtr)
+ {
+ Interop.Constraint.DeleteConstraint(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Determinate how objects property will be when constraint removed.
+ /// Default is Bake.
+ /// </summary>
+ internal enum RemoveActionType
+ {
+ /// <summary>
+ /// Target objects property will bake when constraint removed.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Bake,
+ /// <summary>
+ /// Target objects property will be original value when constraint removed.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Discard,
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI
+{
+ using global::System.Runtime.InteropServices;
+
+ /// <summary>
+ /// Specialized Constraint.
+ /// Make handle's targetIndex value always equal with handle's parent's parentIndex value
+ /// </summary>
+ internal class EqualConstraintWithParentFloat : Constraint
+ {
+ internal EqualConstraintWithParentFloat(HandleRef handle, int targetIndex, int parentIndex)
+ : base(Interop.Constraint.NewEqualConstraintWithParentFloat(handle, targetIndex, parentIndex), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI
+{
+ using global::System.Runtime.InteropServices;
+
+ /// <summary>
+ /// Specialized Constraint.
+ /// Make handle's targetIndex value always equal with handle's parent's parentIndex value
+ /// </summary>
+ internal class RelativeConstraintWithParentFloat : Constraint
+ {
+ internal RelativeConstraintWithParentFloat(HandleRef handle, int targetIndex, int parentIndex, float rate)
+ : base(Interop.Constraint.NewRelativeConstraintWithParentFloat(handle, targetIndex, parentIndex, rate), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI
+{
+ internal static partial class Interop
+ {
+ internal static partial class Constraint
+ {
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_Constraint")]
+ public static extern global::System.IntPtr NewConstraint(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_Constraint")]
+ public static extern global::System.IntPtr DeleteConstraint(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_Apply")]
+ public static extern void Apply(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_Remove")]
+ public static extern void Remove(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_SetRemoveAction")]
+ public static extern void SetRemoveAction(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_GetRemoveAction")]
+ public static extern int GetRemoveAction(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_SetTag")]
+ public static extern void SetTag(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_GetTag")]
+ public static extern uint GetTag(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_GetTargetObject")]
+ public static extern global::System.IntPtr GetTargetObject(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_GetTargetProperty")]
+ public static extern int GetTargetProperty(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ // Constant values
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_REMOVE_ACTION_BAKE_get")]
+ public static extern int ConstraintRemoveActionBakeGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_REMOVE_ACTION_DISCARD_get")]
+ public static extern int ConstraintRemoveActionDiscardGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Constraint_DEFAULT_REMOVE_ACTION_get")]
+ public static extern int ConstraintDefaultRemoveActionGet();
+
+ // Special Constraint
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_EqualConstraintWithParentFloat_New")]
+ public static extern global::System.IntPtr NewEqualConstraintWithParentFloat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_RelativeConstraintWithParentFloat_New")]
+ public static extern global::System.IntPtr NewRelativeConstraintWithParentFloat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3, float jarg4);
+ }
+ }
+}
+++ /dev/null
-//------------------------------------------------------------------------------
-// <auto-generated />
-//
-// This file was automatically generated by SWIG (http://www.swig.org).
-// Version 3.0.9
-//
-// Do not make changes to this file unless you know what you are doing--modify
-// the SWIG interface file instead.
-//------------------------------------------------------------------------------
-
-namespace Tizen.NUI
-{
- internal class SWIGTYPE_p_Dali__Constraint
- {
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
-
- internal SWIGTYPE_p_Dali__Constraint(global::System.IntPtr cPtr)
- {
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
- }
-
- protected SWIGTYPE_p_Dali__Constraint()
- {
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
-
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Constraint obj)
- {
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
- }
- }
-}
private TransitionOptions transitionOptions = null;
private ThemeData themeData;
+ // List of constraints
+ private Constraint widthConstraint = null;
+ private Constraint heightConstraint = null;
static View()
{
RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
var view = (View)bindable;
if (newValue != null)
{
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.WidthResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ if((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
+ {
+ if(view.widthConstraint == null)
+ {
+ view.widthConstraint = new EqualConstraintWithParentFloat((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeWidth, View.Property.SizeWidth);
+ view.widthConstraint.Apply();
+ }
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.WidthResizePolicy, new Tizen.NUI.PropertyValue((int)ResizePolicyType.FillToParent));
+ }
+ else
+ {
+ view.widthConstraint?.Remove();
+ view.widthConstraint?.Dispose();
+ view.widthConstraint = null;
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.WidthResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ }
// Match ResizePolicy to new Layouting.
// Parent relative policies can not be mapped at this point as parent size unknown.
switch ((ResizePolicyType)newValue)
var view = (View)bindable;
if (newValue != null)
{
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.HeightResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ if((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
+ {
+ if(view.heightConstraint == null)
+ {
+ view.heightConstraint = new EqualConstraintWithParentFloat((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeHeight, View.Property.SizeHeight);
+ view.heightConstraint.Apply();
+ }
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.HeightResizePolicy, new Tizen.NUI.PropertyValue((int)ResizePolicyType.FillToParent));
+ }
+ else
+ {
+ view.heightConstraint?.Remove();
+ view.heightConstraint?.Dispose();
+ view.heightConstraint = null;
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.HeightResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ }
// Match ResizePolicy to new Layouting.
// Parent relative policies can not be mapped at this point as parent size unknown.
switch ((ResizePolicyType)newValue)
ThemeManager.ThemeChangedInternal.Remove(OnThemeChanged);
}
}
+ if(widthConstraint != null)
+ {
+ widthConstraint.Remove();
+ widthConstraint.Dispose();
+ }
+ if(heightConstraint != null)
+ {
+ heightConstraint.Remove();
+ heightConstraint.Dispose();
+ }
}
//Release your own unmanaged resources here.
/// The size will be assigned to the actor.
/// </summary>
[Description("USE_ASSIGNED_SIZE")]
- UseAssignedSize
+ UseAssignedSize,
+
+ /// <summary>
+ /// The size always equal with parent even parent has size animation.
+ /// Note : This Property only working without layout. If layout is setup, Undefined Behavior
+ /// </summary>
+ /// <remarks>Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime.</remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ KeepSizeFollowingParent
}
/// <summary>
Interop.ScrollView.SetRulerY(SwigCPtr, RulerPtr.getCPtr(ruler));
}
- internal void ApplyConstraintToChildren(SWIGTYPE_p_Dali__Constraint constraint)
+ internal void ApplyConstraintToChildren(Constraint constraint)
{
- Interop.ScrollView.ApplyConstraintToChildren(SwigCPtr, SWIGTYPE_p_Dali__Constraint.getCPtr(constraint));
+ Interop.ScrollView.ApplyConstraintToChildren(SwigCPtr, constraint.SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}