Skip to content

Commit

Permalink
fix: don't use TextColorOverride (#2044)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodicolo authored Nov 7, 2023
1 parent d892e79 commit f159f8a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 32 deletions.
49 changes: 18 additions & 31 deletions Intersect.Client.Framework/Gwen/Control/WindowControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ public enum ControlState

private readonly Dragger mTitleBar;

private Color mActiveColor;
private Color? mActiveColor;

private GameTexture mActiveImage;
private Color? mInactiveColor;

private string mActiveImageFilename;
private GameTexture? mActiveImage;

private bool mDeleteOnClose;
private GameTexture? mInactiveImage;

private Color mInactiveColor;
private string? mActiveImageFilename;

private GameTexture mInactiveImage;
private string? mInactiveImageFilename;

private string mInactiveImageFilename;
private bool mDeleteOnClose;

private Modal mModal;

Expand Down Expand Up @@ -315,23 +315,15 @@ public void RemoveModal()
protected override void Render(Skin.Base skin)
{
var hasFocus = IsOnTop;
var clr = GetTextColor(ControlState.Active);
if (clr == null && !hasFocus)
var textColor = GetTextColor(ControlState.Active);
if (textColor == null && !hasFocus)
{
clr = GetTextColor(ControlState.Inactive);
textColor = GetTextColor(ControlState.Inactive);
}

//if (clr == null && hasFocus)
//{
// clr = Skin.Colors.Window.TitleActive;
//}
textColor ??= Skin.Colors.Window.TitleInactive;

if (clr == null)
{
clr = Skin.Colors.Window.TitleInactive;
}

mTitle.TextColor = clr;
mTitle.TextColor = textColor;

skin.DrawWindow(this, mTitleBar.Bottom, hasFocus);
}
Expand Down Expand Up @@ -404,19 +396,14 @@ public void SetTextColor(Color clr, ControlState state)
}
}

public Color GetTextColor(ControlState state)
public Color? GetTextColor(ControlState state)
{
switch (state)
return state switch
{
case ControlState.Active:
return mActiveColor;

case ControlState.Inactive:
return mInactiveColor;

default:
throw new ArgumentOutOfRangeException(nameof(state), state, null);
}
ControlState.Active => mActiveColor,
ControlState.Inactive => mInactiveColor,
_ => throw new ArgumentOutOfRangeException(nameof(state), state, $"Invalid {nameof(ControlState)}"),
};
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion Intersect.Client/Interface/Menu/MainMenuWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f159f8a

Please sign in to comment.