[NUI] Hide UIState
authorJiyun Yang <ji.yang@samsung.com>
Fri, 25 Apr 2025 07:21:58 +0000 (16:21 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 29 Apr 2025 08:55:44 +0000 (17:55 +0900)
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
src/Tizen.NUI/src/devel/Lite/UIState.cs [deleted file]
src/Tizen.NUI/src/internal/Common/ControlStateImpl.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs
src/Tizen.NUI/src/public/BaseComponents/ControlState.cs
src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs

diff --git a/src/Tizen.NUI/src/devel/Lite/UIState.cs b/src/Tizen.NUI/src/devel/Lite/UIState.cs
deleted file mode 100755 (executable)
index 489fc6c..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright(c) 2025 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;
-using System.Text;
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI
-{
-    /// <summary>
-    /// Defines a value type of view state.
-    /// </summary>
-    [EditorBrowsable(EditorBrowsableState.Never)]
-    public readonly struct UIState : IEquatable<UIState>
-    {
-        /// <summary>
-        /// The All state is used in a selector class. It represents all states, so if this state is defined in a selector, the other states are ignored.
-        /// </summary>
-        public static readonly UIState All = new (ControlStateUtility.FullMask);
-
-        /// <summary>
-        /// Normal State.
-        /// </summary>
-        public static readonly UIState Normal = new (0UL);
-
-        /// <summary>
-        /// Focused State.
-        /// </summary>
-        public static readonly UIState Focused =  new (nameof(Focused));
-
-        /// <summary>
-        /// Pressed State.
-        /// </summary>
-        public static readonly UIState Pressed = new (nameof(Pressed));
-
-        /// <summary>
-        /// Disabled State.
-        /// </summary>
-        public static readonly UIState Disabled = new (nameof(Disabled));
-
-        /// <summary>
-        /// Selected State.
-        /// </summary>
-        public static readonly UIState Selected = new (nameof(Selected));
-
-        /// <summary>
-        /// Pressed caused by key state.
-        /// </summary>
-        public static readonly UIState PressedByKey = Pressed + new UIState(nameof(PressedByKey));
-
-        /// <summary>
-        /// Pressed caused by touch state.
-        /// </summary>
-        public static readonly UIState PressedByTouch = Pressed + new UIState(nameof(PressedByTouch));
-
-        /// <summary>
-        /// SelectedPressed State.
-        /// </summary>
-        public static readonly UIState SelectedPressed = Selected + Pressed;
-
-        /// <summary>
-        /// DisabledSelected State.
-        /// </summary>
-        public static readonly UIState DisabledSelected = Disabled + Selected;
-
-        /// <summary>
-        /// DisabledFocused State.
-        /// </summary>
-        public static readonly UIState DisabledFocused = Disabled + Focused;
-
-        /// <summary>
-        /// SelectedFocused State.
-        /// </summary>
-        public static readonly UIState SelectedFocused = Selected + Focused;
-
-        /// <summary>
-        /// This is used in a selector class. It represents all other states except for states that are already defined in a selector.
-        /// </summary>
-        public static readonly UIState Other = new UIState(nameof(Other));
-
-        private readonly ulong bitFlags;
-
-        private UIState(ulong bitMask)
-        {
-            bitFlags = bitMask;
-        }
-
-        private UIState(string name) : this(ControlStateUtility.Register(name))
-        {
-        }
-
-        /// <summary>
-        /// Gets or sets a value indicating whether it has combined states.
-        /// </summary>
-        internal bool IsCombined => (bitFlags != 0UL) && ((bitFlags & (bitFlags - 1UL)) != 0UL);
-
-        /// <summary>
-        /// Create an instance of the <see cref="UIState"/> with state name.
-        /// </summary>
-        /// <param name="name">The state name.</param>
-        /// <returns>The <see cref="UIState"/> instance which has single state.</returns>
-        /// <exception cref="ArgumentNullException">Thrown when the given name is null.</exception>
-        /// <exception cref="ArgumentException">Thrown when the given name is invalid.</exception>
-        public static UIState Create(string name)
-        {
-            return new UIState(name);
-        }
-
-        /// <summary>
-        /// Determines whether a state contains a specified state.
-        /// </summary>
-        /// <param name="state">The state to search for</param>
-        /// <returns>true if the state contain a specified state, otherwise, false.</returns>
-        public bool Contains(UIState state) => (bitFlags & state.bitFlags) == state.bitFlags;
-
-        /// <summary>
-        /// Checks if there is a intersection part between this and the other.
-        /// </summary>
-        /// <param name="other">The other state to check.</param>
-        /// <returns>True if an intersection exists, otherwise false.</returns>
-        public bool HasIntersectionWith(UIState other) => (bitFlags & other.bitFlags) != 0L;
-
-        ///  <inheritdoc/>
-        public override string ToString()
-        {
-            var sbuilder = new StringBuilder();
-            var states = ControlStateUtility.RegisteredStates();
-
-            if (bitFlags == 0UL)
-            {
-                return nameof(Normal);
-            }
-            else if (bitFlags == ControlStateUtility.FullMask)
-            {
-                return nameof(All);
-            }
-
-            foreach (var (name, bitMask) in states)
-            {
-                if ((bitFlags & bitMask) > 0)
-                {
-                    if (sbuilder.Length != 0) sbuilder.Append(", ");
-                    sbuilder.Append(name);
-                }
-            }
-
-            return sbuilder.ToString();
-        }
-
-        /// <summary>
-        /// Compares whether the two ControlStates are same or not.
-        /// </summary>
-        /// <param name="lhs">A <see cref="UIState"/> on the left hand side.</param>
-        /// <param name="rhs">A <see cref="UIState"/> on the right hand side.</param>
-        /// <returns>true if the ControlStates are equal; otherwise, false.</returns>
-        public static bool operator ==(UIState lhs, UIState rhs) => lhs.Equals(rhs);
-
-        /// <summary>
-        /// Compares whether the two ControlStates are different or not.
-        /// </summary>
-        /// <param name="lhs">A <see cref="UIState"/> on the left hand side.</param>
-        /// <param name="rhs">A <see cref="UIState"/> on the right hand side.</param>
-        /// <returns>true if the ControlStates are not equal; otherwise, false.</returns>
-        public static bool operator !=(UIState lhs, UIState rhs) => !lhs.Equals(rhs);
-
-        /// <summary>
-        /// The addition operator.
-        /// </summary>
-        /// <param name="lhs">A <see cref="UIState"/> on the left hand side.</param>
-        /// <param name="rhs">A <see cref="UIState"/> on the right hand side.</param>
-        /// <returns>The <see cref="UIState"/> containing the result of the addition.</returns>
-        public static UIState operator +(UIState lhs, UIState rhs) => new (lhs.bitFlags | rhs.bitFlags);
-
-        /// <summary>
-        /// The substraction operator.
-        /// </summary>
-        /// <param name="lhs">A <see cref="UIState"/> on the left hand side.</param>
-        /// <param name="rhs">A <see cref="UIState"/> on the right hand side.</param>
-        /// <returns>The <see cref="UIState"/> containing the result of the substraction.</returns>
-        public static UIState operator -(UIState lhs, UIState rhs) => new (lhs.bitFlags & ~(rhs.bitFlags));
-
-        public bool Equals(UIState other) => bitFlags == other.bitFlags;
-
-        ///  <inheritdoc/>
-        public override bool Equals(object obj)
-        {
-            if (obj is UIState otherState)
-            {
-                return Equals(otherState);
-            }
-            return base.Equals(obj);
-        }
-
-        ///  <inheritdoc/>
-        public override int GetHashCode() => bitFlags.GetHashCode();
-
-        internal ControlState ToReferenceType() => new ControlState(this);
-    }
-}
diff --git a/src/Tizen.NUI/src/internal/Common/ControlStateImpl.cs b/src/Tizen.NUI/src/internal/Common/ControlStateImpl.cs
new file mode 100755 (executable)
index 0000000..06af70e
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright(c) 2025 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;
+using System.Text;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// Defines a value type of view state.
+    /// </summary>
+    internal readonly struct ControlStateImpl : IEquatable<ControlStateImpl>
+    {
+        /// <summary>
+        /// The All state is used in a selector class. It represents all states, so if this state is defined in a selector, the other states are ignored.
+        /// </summary>
+        public static readonly ControlStateImpl All = new (ControlStateUtility.FullMask);
+
+        /// <summary>
+        /// Normal State.
+        /// </summary>
+        public static readonly ControlStateImpl Normal = new (0UL);
+
+        /// <summary>
+        /// Focused State.
+        /// </summary>
+        public static readonly ControlStateImpl Focused = new (nameof(Focused));
+
+        /// <summary>
+        /// Pressed State.
+        /// </summary>
+        public static readonly ControlStateImpl Pressed = new (nameof(Pressed));
+
+        /// <summary>
+        /// Disabled State.
+        /// </summary>
+        public static readonly ControlStateImpl Disabled = new (nameof(Disabled));
+
+        /// <summary>
+        /// Selected State.
+        /// </summary>
+        public static readonly ControlStateImpl Selected = new (nameof(Selected));
+
+        /// <summary>
+        /// Pressed caused by key state.
+        /// </summary>
+        public static readonly ControlStateImpl PressedByKey = Pressed + new ControlStateImpl(nameof(PressedByKey));
+
+        /// <summary>
+        /// Pressed caused by touch state.
+        /// </summary>
+        public static readonly ControlStateImpl PressedByTouch = Pressed + new ControlStateImpl(nameof(PressedByTouch));
+
+        /// <summary>
+        /// SelectedPressed State.
+        /// </summary>
+        public static readonly ControlStateImpl SelectedPressed = Selected + Pressed;
+
+        /// <summary>
+        /// DisabledSelected State.
+        /// </summary>
+        public static readonly ControlStateImpl DisabledSelected = Disabled + Selected;
+
+        /// <summary>
+        /// DisabledFocused State.
+        /// </summary>
+        public static readonly ControlStateImpl DisabledFocused = Disabled + Focused;
+
+        /// <summary>
+        /// SelectedFocused State.
+        /// </summary>
+        public static readonly ControlStateImpl SelectedFocused = Selected + Focused;
+
+        /// <summary>
+        /// This is used in a selector class. It represents all other states except for states that are already defined in a selector.
+        /// </summary>
+        public static readonly ControlStateImpl Other = new ControlStateImpl(nameof(Other));
+
+        private readonly ulong bitFlags;
+
+        private ControlStateImpl(ulong bitMask)
+        {
+            bitFlags = bitMask;
+        }
+
+        private ControlStateImpl(string name) : this(ControlStateUtility.Register(name))
+        {
+        }
+
+        /// <summary>
+        /// Gets or sets a value indicating whether it has combined states.
+        /// </summary>
+        internal bool IsCombined => (bitFlags != 0UL) && ((bitFlags & (bitFlags - 1UL)) != 0UL);
+
+        /// <summary>
+        /// Create an instance of the <see cref="ControlStateImpl"/> with state name.
+        /// </summary>
+        /// <param name="name">The state name.</param>
+        /// <returns>The <see cref="ControlStateImpl"/> instance which has single state.</returns>
+        /// <exception cref="ArgumentNullException">Thrown when the given name is null.</exception>
+        /// <exception cref="ArgumentException">Thrown when the given name is invalid.</exception>
+        public static ControlStateImpl Create(string name)
+        {
+            return new ControlStateImpl(name);
+        }
+
+        /// <summary>
+        /// Determines whether a state contains a specified state.
+        /// </summary>
+        /// <param name="state">The state to search for</param>
+        /// <returns>true if the state contain a specified state, otherwise, false.</returns>
+        public bool Contains(ControlStateImpl state) => (bitFlags & state.bitFlags) == state.bitFlags;
+
+        /// <summary>
+        /// Checks if there is a intersection part between this and the other.
+        /// </summary>
+        /// <param name="other">The other state to check.</param>
+        /// <returns>True if an intersection exists, otherwise false.</returns>
+        public bool HasIntersectionWith(ControlStateImpl other) => (bitFlags & other.bitFlags) != 0L;
+
+        ///  <inheritdoc/>
+        public override string ToString()
+        {
+            var sbuilder = new StringBuilder();
+            var states = ControlStateUtility.RegisteredStates();
+
+            if (bitFlags == 0UL)
+            {
+                return nameof(Normal);
+            }
+            else if (bitFlags == ControlStateUtility.FullMask)
+            {
+                return nameof(All);
+            }
+
+            foreach (var (name, bitMask) in states)
+            {
+                if ((bitFlags & bitMask) > 0)
+                {
+                    if (sbuilder.Length != 0)
+                    {
+                        sbuilder.Append(", ");
+                    }
+                    sbuilder.Append(name);
+                }
+            }
+
+            return sbuilder.ToString();
+        }
+
+        /// <summary>
+        /// Compares whether the two ControlStates are same or not.
+        /// </summary>
+        /// <param name="lhs">A <see cref="ControlStateImpl"/> on the left hand side.</param>
+        /// <param name="rhs">A <see cref="ControlStateImpl"/> on the right hand side.</param>
+        /// <returns>true if the ControlStates are equal; otherwise, false.</returns>
+        public static bool operator ==(ControlStateImpl lhs, ControlStateImpl rhs) => lhs.Equals(rhs);
+
+        /// <summary>
+        /// Compares whether the two ControlStates are different or not.
+        /// </summary>
+        /// <param name="lhs">A <see cref="ControlStateImpl"/> on the left hand side.</param>
+        /// <param name="rhs">A <see cref="ControlStateImpl"/> on the right hand side.</param>
+        /// <returns>true if the ControlStates are not equal; otherwise, false.</returns>
+        public static bool operator !=(ControlStateImpl lhs, ControlStateImpl rhs) => !lhs.Equals(rhs);
+
+        /// <summary>
+        /// The addition operator.
+        /// </summary>
+        /// <param name="lhs">A <see cref="ControlStateImpl"/> on the left hand side.</param>
+        /// <param name="rhs">A <see cref="ControlStateImpl"/> on the right hand side.</param>
+        /// <returns>The <see cref="ControlStateImpl"/> containing the result of the addition.</returns>
+        public static ControlStateImpl operator +(ControlStateImpl lhs, ControlStateImpl rhs) => new (lhs.bitFlags | rhs.bitFlags);
+
+        /// <summary>
+        /// The substraction operator.
+        /// </summary>
+        /// <param name="lhs">A <see cref="ControlStateImpl"/> on the left hand side.</param>
+        /// <param name="rhs">A <see cref="ControlStateImpl"/> on the right hand side.</param>
+        /// <returns>The <see cref="ControlStateImpl"/> containing the result of the substraction.</returns>
+        public static ControlStateImpl operator -(ControlStateImpl lhs, ControlStateImpl rhs) => new (lhs.bitFlags & ~(rhs.bitFlags));
+
+        /// <summary>
+        /// Indicates whether this instance and another specified <see cref="ControlStateImpl"/> structure are equal.
+        /// </summary>
+        /// <param name="other">The <see cref="ControlStateImpl"/> structure to compare with the current instance.</param>
+        /// <returns>true if <paramref name="other"/> and this instance are equal; otherwise, false.</returns>
+        public bool Equals(ControlStateImpl other) => bitFlags == other.bitFlags;
+
+        ///  <inheritdoc/>
+        public override bool Equals(object obj)
+        {
+            if (obj is ControlStateImpl otherState)
+            {
+                return Equals(otherState);
+            }
+            return base.Equals(obj);
+        }
+
+        ///  <inheritdoc/>
+        public override int GetHashCode() => bitFlags.GetHashCode();
+    }
+}
index 669c306a339b5014e0067c04ccf456b7e214a9f5..b847a5b2eab2124d0a9f9953532ff6c74911f91e 100755 (executable)
@@ -722,12 +722,12 @@ namespace Tizen.NUI.BaseComponents
         public enum RepeatModes
         {
             /// <summary>
-            /// When the animation reaches the end and RepeatCount is nonZero, the animation restarts from the beginning. 
+            /// When the animation reaches the end and RepeatCount is nonZero, the animation restarts from the beginning.
             /// </summary>
             [EditorBrowsable(EditorBrowsableState.Never)]
             Restart = LoopingModeType.Restart,
             /// <summary>
-            /// When the animation reaches the end and RepeatCount nonZero, the animation reverses direction on every animation cycle. 
+            /// When the animation reaches the end and RepeatCount nonZero, the animation reverses direction on every animation cycle.
             /// </summary>
             [EditorBrowsable(EditorBrowsableState.Never)]
             Reverse = LoopingModeType.AutoReverse
index 2ea88d3518c6072ecb4c23ace2bb7ab070907a3f..3447464da25638c0161ab4f0cbe8f76d2846240f 100755 (executable)
@@ -35,59 +35,59 @@ namespace Tizen.NUI.BaseComponents
         /// The All state is used in a selector class. It represents all states, so if this state is defined in a selector, the other states are ignored.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly ControlState All = new ControlState(UIState.All);
+        public static readonly ControlState All = new ControlState(ControlStateImpl.All);
         /// <summary>
         /// Normal State.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly ControlState Normal = new ControlState(UIState.Normal);
+        public static readonly ControlState Normal = new ControlState(ControlStateImpl.Normal);
         /// <summary>
         /// Focused State.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly ControlState Focused =  new ControlState(UIState.Focused);
+        public static readonly ControlState Focused =  new ControlState(ControlStateImpl.Focused);
         /// <summary>
         /// Pressed State.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly ControlState Pressed = new ControlState(UIState.Pressed);
+        public static readonly ControlState Pressed = new ControlState(ControlStateImpl.Pressed);
         /// <summary>
         /// Disabled State.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly ControlState Disabled = new ControlState(UIState.Disabled);
+        public static readonly ControlState Disabled = new ControlState(ControlStateImpl.Disabled);
         /// <summary>
         /// Selected State.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly ControlState Selected = new ControlState(UIState.Selected);
+        public static readonly ControlState Selected = new ControlState(ControlStateImpl.Selected);
         /// <summary>
         /// SelectedPressed State.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly ControlState SelectedPressed = new ControlState(UIState.SelectedPressed);
+        public static readonly ControlState SelectedPressed = new ControlState(ControlStateImpl.SelectedPressed);
         /// <summary>
         /// DisabledSelected State.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly ControlState DisabledSelected = new ControlState(UIState.DisabledSelected);
+        public static readonly ControlState DisabledSelected = new ControlState(ControlStateImpl.DisabledSelected);
         /// <summary>
         /// DisabledFocused State.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly ControlState DisabledFocused = new ControlState(UIState.DisabledFocused);
+        public static readonly ControlState DisabledFocused = new ControlState(ControlStateImpl.DisabledFocused);
         /// <summary>
         /// SelectedFocused State.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly ControlState SelectedFocused = new ControlState(UIState.SelectedFocused);
+        public static readonly ControlState SelectedFocused = new ControlState(ControlStateImpl.SelectedFocused);
         /// <summary>
         /// This is used in a selector class. It represents all other states except for states that are already defined in a selector.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
-        public static readonly ControlState Other = new ControlState(UIState.Other);
+        public static readonly ControlState Other = new ControlState(ControlStateImpl.Other);
 
-        readonly UIState value;
+        readonly ControlStateImpl value;
 
 
         /// <summary>
@@ -96,7 +96,7 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public bool IsCombined => value.IsCombined;
 
-        internal ControlState(UIState value)
+        internal ControlState(ControlStateImpl value)
         {
             this.value = value;
         }
@@ -111,7 +111,7 @@ namespace Tizen.NUI.BaseComponents
         /// <since_tizen> 9 </since_tizen>
         public static ControlState Create(string name)
         {
-            return new ControlState(UIState.Create(name));
+            return new ControlState(ControlStateImpl.Create(name));
         }
 
         /// <summary>
@@ -122,7 +122,7 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static ControlState Create(params ControlState[] states)
         {
-            UIState result = UIState.Normal;
+            ControlStateImpl result = ControlStateImpl.Normal;
 
             for (int i = 0; i < states.Length; i++)
             {
index e84f7a64faa39c6f63801926817a2431ade72ab1..8c5079eb545167c5e021e629bc823602c6c56d02 100755 (executable)
@@ -550,7 +550,7 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Sets or gets the stop behavior of the LottieAnimationView. 
+        /// Sets or gets the stop behavior of the LottieAnimationView.
         /// This property determines how the animation behaves when it stops.
         /// </summary>
         /// <since_tizen> 7 </since_tizen>