Kill the static widget interface

This commit is contained in:
Paul Chote
2010-04-09 18:13:11 +12:00
parent 64a6ca2ef9
commit 2fa93c74e4
9 changed files with 112 additions and 193 deletions

View File

@@ -19,13 +19,15 @@
#endregion
using System.Drawing;
using System;
namespace OpenRA.Widgets
{
class CheckboxWidget : Widget
{
public string Text = "";
public Func<bool> Checked = () => {return false;};
public override void Draw()
{
if (!Visible)
@@ -34,8 +36,6 @@ namespace OpenRA.Widgets
return;
}
var selected = InputHandler.Value != null ? InputHandler.Value.GetState(this) : false;
WidgetUtils.DrawPanel("dialog3",
new Rectangle(Bounds.Location,
new Size(Bounds.Height, Bounds.Height)),
@@ -44,7 +44,7 @@ namespace OpenRA.Widgets
Game.chrome.renderer.BoldFont.DrawText(Game.chrome.rgbaRenderer, Text,
new float2(Bounds.Left + Bounds.Height * 2, Bounds.Top), Color.White);
if (selected)
if (Checked())
{
Game.chrome.lineRenderer.FillRect(
new RectangleF(