Unify widget state image suffixes (disabled, pressed, hover, focus)

- Add a property for arrows image collection (in drop-downs, scrollbars
and production tabs)
- Add a property for separators image collection (in drop-downs)
- Add hover and disable states to the drop-down separator
- Unify button, textfield and checkbox state suffixes
This commit is contained in:
Ivaylo Draganov
2020-05-12 00:11:45 +03:00
committed by Paul Chote
parent 2dda2d7689
commit 7943f4deb6
15 changed files with 194 additions and 94 deletions

View File

@@ -44,7 +44,6 @@ namespace OpenRA.Mods.Common.Widgets
public override void Draw()
{
var disabled = IsDisabled();
var highlighted = IsHighlighted();
var font = Game.Renderer.Fonts[Font];
var color = GetColor();
var colordisabled = GetColorDisabled();
@@ -54,11 +53,8 @@ namespace OpenRA.Mods.Common.Widgets
var text = GetText();
var textSize = font.Measure(text);
var check = new Rectangle(rect.Location, new Size(Bounds.Height, Bounds.Height));
var state = disabled ? "checkbox-disabled" :
highlighted ? "checkbox-highlighted" :
Depressed && HasPressedState ? "checkbox-pressed" :
Ui.MouseOverWidget == this ? "checkbox-hover" :
"checkbox";
var baseName = IsHighlighted() ? "checkbox-highlighted" : "checkbox";
var state = WidgetUtils.GetStatefulImageName(baseName, disabled, Depressed && HasPressedState, Ui.MouseOverWidget == this);
WidgetUtils.DrawPanel(state, check);