Remove some duplication from widgets that draw fake buttons.

This commit is contained in:
Paul Chote
2011-05-17 13:14:48 +12:00
parent b3f9725872
commit 14af766427
4 changed files with 21 additions and 35 deletions

View File

@@ -28,14 +28,10 @@ namespace OpenRA.Mods.Cnc.Widgets
public override void DrawInner()
{
var state = IsDisabled() ? "button-disabled" :
Depressed ? "button-pressed" :
RenderBounds.Contains(Viewport.LastMousePos) ? "button-hover" :
"button";
var font = Game.Renderer.Fonts[Font];
var rect = RenderBounds;
WidgetUtils.DrawPanel(state, new Rectangle(rect.Location, new Size(Bounds.Height, Bounds.Height)));
ButtonWidget.DrawBackground(new Rectangle(rect.Location, new Size(Bounds.Height, Bounds.Height)),
IsDisabled(), Depressed, RenderBounds.Contains(Viewport.LastMousePos));
var textSize = font.Measure(Text);
font.DrawText(Text,