Skip to content

Commit

Permalink
[NUI] Fix exceptional All state case
Browse files Browse the repository at this point in the history
  • Loading branch information
everLEEst committed Jan 8, 2025
1 parent 26739b8 commit 8e706d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Tizen.NUI/src/internal/Common/ControlStateUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public static ulong Register(string stateName)
string trimmed = stateName.Trim();
ulong bitMask = 0UL;

if (trimmed == "All") return FullMask;

if (trimmed != "Normal" && !registeredStates.TryGetValue(trimmed, out bitMask))
{
if (nextBitPosition + 1 > MaxBitWidth)
Expand Down
9 changes: 9 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/ControlState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ private ControlState(string name) : this(ControlStateUtility.Register(name))
/// <since_tizen> 9 </since_tizen>
public static ControlState Create(string name)
{
if (name == null)
throw new ArgumentNullException(nameof(name));
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException($"{nameof(name)} cannot be whitespace.", nameof(name));

return new ControlState(name);
}

Expand Down Expand Up @@ -176,6 +181,10 @@ public override string ToString()
{
return nameof(Normal);
}
else if (bitFlags == ControlStateUtility.FullMask)
{
return nameof(All);
}

foreach (var (name, bitMask) in states)
{
Expand Down

0 comments on commit 8e706d5

Please sign in to comment.