Remove duplication between ButtonWidget and ToggleButtonWidget.

This commit is contained in:
Paul Chote
2013-04-08 22:55:01 +12:00
parent 71999bdc52
commit eddc1fc0cf
8 changed files with 15 additions and 23 deletions

View File

@@ -20,7 +20,6 @@ namespace OpenRA.Mods.Cnc.Widgets
public readonly string TooltipTemplate = "BUTTON_TOOLTIP";
public readonly string TooltipText;
public readonly string TooltipContainer;
public Func<bool> IsToggled = () => false;
Lazy<TooltipContainerWidget> tooltipContainer;
public ToggleButtonWidget()
@@ -52,11 +51,5 @@ namespace OpenRA.Mods.Cnc.Widgets
if (TooltipContainer == null) return;
tooltipContainer.Value.RemoveTooltip();
}
public override void DrawBackground(Rectangle rect, bool disabled, bool pressed, bool hover, bool highlighted)
{
var baseName = IsToggled() ? "button-toggled" : "button";
ButtonWidget.DrawBackground(baseName, rect, disabled, pressed, hover, highlighted);
}
}
}