Allow custom dropdown group background. Fixes #3584.

This commit is contained in:
Paul Chote
2013-08-11 22:39:19 +12:00
parent 9ccf2014b0
commit 4b51b0c205
5 changed files with 44 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ namespace OpenRA.Widgets
public class ScrollItemWidget : ButtonWidget
{
public string ItemKey;
public string BaseName = "scrollitem";
public ScrollItemWidget()
: base()
@@ -31,14 +32,15 @@ namespace OpenRA.Widgets
VisualHeight = 0;
IgnoreChildMouseOver = true;
Key = other.Key;
BaseName = other.BaseName;
}
public Func<bool> IsSelected = () => false;
public override void Draw()
{
var state = IsSelected() ? "scrollitem-selected" :
Ui.MouseOverWidget == this ? "scrollitem-hover" :
var state = IsSelected() ? BaseName+"-selected" :
Ui.MouseOverWidget == this ? BaseName+"-hover" :
null;
if (state != null)

View File

@@ -527,3 +527,16 @@ scrollitem-hover: dialog.png
corner-tr: 594,0,1,1
corner-bl: 512,82,1,1
corner-br: 594,82,1,1
# A copy of dialog3
scrollheader-selected: dialog.png
background: 641,1,126,126
border-r: 767,1,1,126
border-l: 640,1,1,126
border-b: 641,127,126,1
border-t: 641,0,126,1
corner-tl: 640,0,1,1
corner-tr: 722,0,1,1
corner-bl: 640,82,1,1
corner-br: 722,82,1,1

View File

@@ -521,7 +521,19 @@ scrollitem-hover: dialog.png
corner-tr: 594,0,1,1
corner-bl: 512,82,1,1
corner-br: 594,82,1,1
# A copy of dialog2
scrollheader-selected: dialog.png
background: 513,1,126,126
border-r: 639,1,1,126
border-l: 512,1,1,126
border-b: 513,127,126,1
border-t: 513,0,126,1
corner-tl: 512,0,1,1
corner-tr: 594,0,1,1
corner-bl: 512,82,1,1
corner-br: 594,82,1,1
logos: loadscreen.png
logo: 0,0,256,256

View File

@@ -2,6 +2,7 @@ ScrollPanel@LABEL_DROPDOWN_TEMPLATE:
Width:DROPDOWN_WIDTH
Children:
ScrollItem@HEADER:
BaseName:scrollheader
Width:PARENT_RIGHT-27
Height:13
X:2

View File

@@ -515,7 +515,19 @@ scrollitem-hover: dialog.png
corner-tr: 594,0,1,1
corner-bl: 512,82,1,1
corner-br: 594,82,1,1
# A copy of dialog3
scrollheader-selected: dialog.png
background: 641,1,126,126
border-r: 767,1,1,126
border-l: 640,1,1,126
border-b: 641,127,126,1
border-t: 641,0,126,1
corner-tl: 640,0,1,1
corner-tr: 722,0,1,1
corner-bl: 640,82,1,1
corner-br: 722,82,1,1
logos: loadscreen.png
logo: 0,0,256,256