Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use TextColorOverride #2044

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading