Make the checkbox depressed state optional, and disabled in ra.
This commit is contained in:
@@ -19,6 +19,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
public Func<bool> IsChecked = () => false;
|
||||
public int BaseLine = 1;
|
||||
public bool HasPressedState = ChromeMetrics.GetBool("CheckboxPressedState");
|
||||
|
||||
public CheckboxWidget()
|
||||
: base()
|
||||
@@ -36,7 +37,7 @@ namespace OpenRA.Widgets
|
||||
var rect = RenderBounds;
|
||||
var check = new Rectangle(rect.Location, new Size(Bounds.Height, Bounds.Height));
|
||||
var state = IsDisabled() ? "checkbox-disabled" :
|
||||
Depressed ? "checkbox-pressed" :
|
||||
Depressed && HasPressedState ? "checkbox-pressed" :
|
||||
RenderBounds.Contains(Viewport.LastMousePos) ? "checkbox-hover" :
|
||||
"checkbox";
|
||||
|
||||
@@ -48,7 +49,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
if (IsChecked() || Depressed)
|
||||
WidgetUtils.DrawRGBA(
|
||||
ChromeProvider.GetImage("checkbox-bits", Depressed ? "pressed" : "checked"),
|
||||
ChromeProvider.GetImage("checkbox-bits", Depressed && HasPressedState ? "pressed" : "checked"),
|
||||
new float2(rect.Left + 2, rect.Top + 2));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,5 +39,10 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
return int.Parse(data[key]);
|
||||
}
|
||||
|
||||
public static bool GetBool(string key)
|
||||
{
|
||||
return bool.Parse(data[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
Metrics:
|
||||
ButtonDepth: 0
|
||||
ButtonFont: Bold
|
||||
CheckboxPressedState: true
|
||||
|
||||
@@ -431,7 +431,6 @@ checkbox: dialog.png
|
||||
|
||||
checkbox-bits: buttons.png
|
||||
checked: 0,112,16,16
|
||||
pressed: 0,128,16,16
|
||||
|
||||
# A copy of dialog3
|
||||
checkbox-hover: dialog.png
|
||||
@@ -456,18 +455,6 @@ checkbox-disabled: dialog.png
|
||||
corner-tr: 722,0,1,1
|
||||
corner-bl: 640,82,1,1
|
||||
corner-br: 722,82,1,1
|
||||
|
||||
# A copy of dialog3
|
||||
checkbox-pressed: 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
|
||||
|
||||
# A copy of dialog3
|
||||
scrollitem-selected: dialog.png
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
Metrics:
|
||||
ButtonDepth: 1
|
||||
ButtonFont: Regular
|
||||
CheckboxPressedState: false
|
||||
|
||||
Reference in New Issue
Block a user