Better listbox rows

This commit is contained in:
Paul Chote
2010-07-12 21:10:00 +12:00
parent e23ee6d892
commit 7d2a5d6f42
6 changed files with 41 additions and 34 deletions

View File

@@ -32,15 +32,18 @@ namespace OpenRA.Widgets
Right
}
public string Text = "";
public string Text = null;
public string Background = null;
public TextAlign Align = TextAlign.Left;
public bool Bold = false;
public Func<string> GetText;
public Func<string> GetBackground;
public LabelWidget()
: base()
{
GetText = () => { return Text; };
GetBackground = () => { return Background; };
}
public LabelWidget(Widget other)
@@ -50,10 +53,16 @@ namespace OpenRA.Widgets
Align = (other as LabelWidget).Align;
Bold = (other as LabelWidget).Bold;
GetText = (other as LabelWidget).GetText;
GetBackground = (other as LabelWidget).GetBackground;
}
public override void DrawInner(World world)
{
var bg = GetBackground();
if (bg != null)
WidgetUtils.DrawPanel(bg, RenderBounds );
var font = (Bold) ? Game.chrome.renderer.BoldFont : Game.chrome.renderer.RegularFont;
var text = GetText();
if (text == null)