From: Jiyun Yang Date: Fri, 25 Apr 2025 07:21:58 +0000 (+0900) Subject: [NUI] Hide UIState X-Git-Tag: submit/tizen/20250429.085946~1^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c509ffb943a7f291174cd4097763d52152bcb93;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Hide UIState Signed-off-by: Jiyun Yang --- diff --git a/src/Tizen.NUI/src/devel/Lite/UIState.cs b/src/Tizen.NUI/src/devel/Lite/UIState.cs deleted file mode 100755 index 489fc6cf7..000000000 --- a/src/Tizen.NUI/src/devel/Lite/UIState.cs +++ /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 -{ - /// - /// Defines a value type of view state. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public readonly struct UIState : IEquatable - { - /// - /// 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. - /// - public static readonly UIState All = new (ControlStateUtility.FullMask); - - /// - /// Normal State. - /// - public static readonly UIState Normal = new (0UL); - - /// - /// Focused State. - /// - public static readonly UIState Focused = new (nameof(Focused)); - - /// - /// Pressed State. - /// - public static readonly UIState Pressed = new (nameof(Pressed)); - - /// - /// Disabled State. - /// - public static readonly UIState Disabled = new (nameof(Disabled)); - - /// - /// Selected State. - /// - public static readonly UIState Selected = new (nameof(Selected)); - - /// - /// Pressed caused by key state. - /// - public static readonly UIState PressedByKey = Pressed + new UIState(nameof(PressedByKey)); - - /// - /// Pressed caused by touch state. - /// - public static readonly UIState PressedByTouch = Pressed + new UIState(nameof(PressedByTouch)); - - /// - /// SelectedPressed State. - /// - public static readonly UIState SelectedPressed = Selected + Pressed; - - /// - /// DisabledSelected State. - /// - public static readonly UIState DisabledSelected = Disabled + Selected; - - /// - /// DisabledFocused State. - /// - public static readonly UIState DisabledFocused = Disabled + Focused; - - /// - /// SelectedFocused State. - /// - public static readonly UIState SelectedFocused = Selected + Focused; - - /// - /// This is used in a selector class. It represents all other states except for states that are already defined in a selector. - /// - 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)) - { - } - - /// - /// Gets or sets a value indicating whether it has combined states. - /// - internal bool IsCombined => (bitFlags != 0UL) && ((bitFlags & (bitFlags - 1UL)) != 0UL); - - /// - /// Create an instance of the with state name. - /// - /// The state name. - /// The instance which has single state. - /// Thrown when the given name is null. - /// Thrown when the given name is invalid. - public static UIState Create(string name) - { - return new UIState(name); - } - - /// - /// Determines whether a state contains a specified state. - /// - /// The state to search for - /// true if the state contain a specified state, otherwise, false. - public bool Contains(UIState state) => (bitFlags & state.bitFlags) == state.bitFlags; - - /// - /// Checks if there is a intersection part between this and the other. - /// - /// The other state to check. - /// True if an intersection exists, otherwise false. - public bool HasIntersectionWith(UIState other) => (bitFlags & other.bitFlags) != 0L; - - /// - 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(); - } - - /// - /// Compares whether the two ControlStates are same or not. - /// - /// A on the left hand side. - /// A on the right hand side. - /// true if the ControlStates are equal; otherwise, false. - public static bool operator ==(UIState lhs, UIState rhs) => lhs.Equals(rhs); - - /// - /// Compares whether the two ControlStates are different or not. - /// - /// A on the left hand side. - /// A on the right hand side. - /// true if the ControlStates are not equal; otherwise, false. - public static bool operator !=(UIState lhs, UIState rhs) => !lhs.Equals(rhs); - - /// - /// The addition operator. - /// - /// A on the left hand side. - /// A on the right hand side. - /// The containing the result of the addition. - public static UIState operator +(UIState lhs, UIState rhs) => new (lhs.bitFlags | rhs.bitFlags); - - /// - /// The substraction operator. - /// - /// A on the left hand side. - /// A on the right hand side. - /// The containing the result of the substraction. - public static UIState operator -(UIState lhs, UIState rhs) => new (lhs.bitFlags & ~(rhs.bitFlags)); - - public bool Equals(UIState other) => bitFlags == other.bitFlags; - - /// - public override bool Equals(object obj) - { - if (obj is UIState otherState) - { - return Equals(otherState); - } - return base.Equals(obj); - } - - /// - 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 index 000000000..06af70e6b --- /dev/null +++ b/src/Tizen.NUI/src/internal/Common/ControlStateImpl.cs @@ -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 +{ + /// + /// Defines a value type of view state. + /// + internal readonly struct ControlStateImpl : IEquatable + { + /// + /// 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. + /// + public static readonly ControlStateImpl All = new (ControlStateUtility.FullMask); + + /// + /// Normal State. + /// + public static readonly ControlStateImpl Normal = new (0UL); + + /// + /// Focused State. + /// + public static readonly ControlStateImpl Focused = new (nameof(Focused)); + + /// + /// Pressed State. + /// + public static readonly ControlStateImpl Pressed = new (nameof(Pressed)); + + /// + /// Disabled State. + /// + public static readonly ControlStateImpl Disabled = new (nameof(Disabled)); + + /// + /// Selected State. + /// + public static readonly ControlStateImpl Selected = new (nameof(Selected)); + + /// + /// Pressed caused by key state. + /// + public static readonly ControlStateImpl PressedByKey = Pressed + new ControlStateImpl(nameof(PressedByKey)); + + /// + /// Pressed caused by touch state. + /// + public static readonly ControlStateImpl PressedByTouch = Pressed + new ControlStateImpl(nameof(PressedByTouch)); + + /// + /// SelectedPressed State. + /// + public static readonly ControlStateImpl SelectedPressed = Selected + Pressed; + + /// + /// DisabledSelected State. + /// + public static readonly ControlStateImpl DisabledSelected = Disabled + Selected; + + /// + /// DisabledFocused State. + /// + public static readonly ControlStateImpl DisabledFocused = Disabled + Focused; + + /// + /// SelectedFocused State. + /// + public static readonly ControlStateImpl SelectedFocused = Selected + Focused; + + /// + /// This is used in a selector class. It represents all other states except for states that are already defined in a selector. + /// + 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)) + { + } + + /// + /// Gets or sets a value indicating whether it has combined states. + /// + internal bool IsCombined => (bitFlags != 0UL) && ((bitFlags & (bitFlags - 1UL)) != 0UL); + + /// + /// Create an instance of the with state name. + /// + /// The state name. + /// The instance which has single state. + /// Thrown when the given name is null. + /// Thrown when the given name is invalid. + public static ControlStateImpl Create(string name) + { + return new ControlStateImpl(name); + } + + /// + /// Determines whether a state contains a specified state. + /// + /// The state to search for + /// true if the state contain a specified state, otherwise, false. + public bool Contains(ControlStateImpl state) => (bitFlags & state.bitFlags) == state.bitFlags; + + /// + /// Checks if there is a intersection part between this and the other. + /// + /// The other state to check. + /// True if an intersection exists, otherwise false. + public bool HasIntersectionWith(ControlStateImpl other) => (bitFlags & other.bitFlags) != 0L; + + /// + 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(); + } + + /// + /// Compares whether the two ControlStates are same or not. + /// + /// A on the left hand side. + /// A on the right hand side. + /// true if the ControlStates are equal; otherwise, false. + public static bool operator ==(ControlStateImpl lhs, ControlStateImpl rhs) => lhs.Equals(rhs); + + /// + /// Compares whether the two ControlStates are different or not. + /// + /// A on the left hand side. + /// A on the right hand side. + /// true if the ControlStates are not equal; otherwise, false. + public static bool operator !=(ControlStateImpl lhs, ControlStateImpl rhs) => !lhs.Equals(rhs); + + /// + /// The addition operator. + /// + /// A on the left hand side. + /// A on the right hand side. + /// The containing the result of the addition. + public static ControlStateImpl operator +(ControlStateImpl lhs, ControlStateImpl rhs) => new (lhs.bitFlags | rhs.bitFlags); + + /// + /// The substraction operator. + /// + /// A on the left hand side. + /// A on the right hand side. + /// The containing the result of the substraction. + public static ControlStateImpl operator -(ControlStateImpl lhs, ControlStateImpl rhs) => new (lhs.bitFlags & ~(rhs.bitFlags)); + + /// + /// Indicates whether this instance and another specified structure are equal. + /// + /// The structure to compare with the current instance. + /// true if and this instance are equal; otherwise, false. + public bool Equals(ControlStateImpl other) => bitFlags == other.bitFlags; + + /// + public override bool Equals(object obj) + { + if (obj is ControlStateImpl otherState) + { + return Equals(otherState); + } + return base.Equals(obj); + } + + /// + public override int GetHashCode() => bitFlags.GetHashCode(); + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs index 669c306a3..b847a5b2e 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/AnimatedVectorImageView.cs @@ -722,12 +722,12 @@ namespace Tizen.NUI.BaseComponents public enum RepeatModes { /// - /// 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. /// [EditorBrowsable(EditorBrowsableState.Never)] Restart = LoopingModeType.Restart, /// - /// 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. /// [EditorBrowsable(EditorBrowsableState.Never)] Reverse = LoopingModeType.AutoReverse diff --git a/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs b/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs index 2ea88d351..3447464da 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ControlState.cs @@ -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. /// /// 9 - public static readonly ControlState All = new ControlState(UIState.All); + public static readonly ControlState All = new ControlState(ControlStateImpl.All); /// /// Normal State. /// /// 9 - public static readonly ControlState Normal = new ControlState(UIState.Normal); + public static readonly ControlState Normal = new ControlState(ControlStateImpl.Normal); /// /// Focused State. /// /// 9 - public static readonly ControlState Focused = new ControlState(UIState.Focused); + public static readonly ControlState Focused = new ControlState(ControlStateImpl.Focused); /// /// Pressed State. /// /// 9 - public static readonly ControlState Pressed = new ControlState(UIState.Pressed); + public static readonly ControlState Pressed = new ControlState(ControlStateImpl.Pressed); /// /// Disabled State. /// /// 9 - public static readonly ControlState Disabled = new ControlState(UIState.Disabled); + public static readonly ControlState Disabled = new ControlState(ControlStateImpl.Disabled); /// /// Selected State. /// /// 9 - public static readonly ControlState Selected = new ControlState(UIState.Selected); + public static readonly ControlState Selected = new ControlState(ControlStateImpl.Selected); /// /// SelectedPressed State. /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly ControlState SelectedPressed = new ControlState(UIState.SelectedPressed); + public static readonly ControlState SelectedPressed = new ControlState(ControlStateImpl.SelectedPressed); /// /// DisabledSelected State. /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly ControlState DisabledSelected = new ControlState(UIState.DisabledSelected); + public static readonly ControlState DisabledSelected = new ControlState(ControlStateImpl.DisabledSelected); /// /// DisabledFocused State. /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly ControlState DisabledFocused = new ControlState(UIState.DisabledFocused); + public static readonly ControlState DisabledFocused = new ControlState(ControlStateImpl.DisabledFocused); /// /// SelectedFocused State. /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly ControlState SelectedFocused = new ControlState(UIState.SelectedFocused); + public static readonly ControlState SelectedFocused = new ControlState(ControlStateImpl.SelectedFocused); /// /// This is used in a selector class. It represents all other states except for states that are already defined in a selector. /// /// 9 - public static readonly ControlState Other = new ControlState(UIState.Other); + public static readonly ControlState Other = new ControlState(ControlStateImpl.Other); - readonly UIState value; + readonly ControlStateImpl value; /// @@ -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 /// 9 public static ControlState Create(string name) { - return new ControlState(UIState.Create(name)); + return new ControlState(ControlStateImpl.Create(name)); } /// @@ -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++) { diff --git a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs index e84f7a64f..8c5079eb5 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs @@ -550,7 +550,7 @@ namespace Tizen.NUI.BaseComponents } /// - /// 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. /// /// 7