Files
OpenRA/OpenRA.Mods.RA/Widgets/SidebarButtonWidget.cs
2011-03-12 18:58:42 +13:00

46 lines
1.1 KiB
C#

#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Drawing;
using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA
{
public class SidebarButtonWidget : ButtonWidget
{
public string Image = "";
readonly World world;
[ObjectCreator.UseCtor]
public SidebarButtonWidget( [ObjectCreator.Param] World world )
: base()
{
this.world = world;
}
protected SidebarButtonWidget(SidebarButtonWidget widget)
: base(widget)
{
this.world = widget.world;
}
public override void DrawInner()
{
var state = Depressed ? "pressed" :
RenderBounds.Contains(Viewport.LastMousePos) ? "hover" : "normal";
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(Image + "-" + world.LocalPlayer.Country.Race, state), RenderOrigin);
}
}
}