integrated (clickable) labels in checkboxes
This commit is contained in:
@@ -24,7 +24,9 @@ using System.Drawing;
|
|||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
class CheckboxWidget : Widget
|
class CheckboxWidget : Widget
|
||||||
{
|
{
|
||||||
|
public string Text = "";
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
if (!Visible)
|
if (!Visible)
|
||||||
@@ -35,7 +37,13 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
var selected = InputHandler.Value != null ? InputHandler.Value.GetState(this) : false;
|
var selected = InputHandler.Value != null ? InputHandler.Value.GetState(this) : false;
|
||||||
|
|
||||||
WidgetUtils.DrawPanel("dialog3", Bounds, () => { });
|
WidgetUtils.DrawPanel("dialog3",
|
||||||
|
new Rectangle(Bounds.Location,
|
||||||
|
new Size(Bounds.Height, Bounds.Height)),
|
||||||
|
() => { });
|
||||||
|
|
||||||
|
Game.chrome.renderer.BoldFont.DrawText(Game.chrome.rgbaRenderer, Text,
|
||||||
|
new float2(Bounds.Left + Bounds.Height * 2, Bounds.Top), Color.White);
|
||||||
|
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
@@ -43,7 +51,7 @@ namespace OpenRA.Widgets
|
|||||||
new RectangleF(
|
new RectangleF(
|
||||||
Game.viewport.Location.X + Bounds.Left + 4,
|
Game.viewport.Location.X + Bounds.Left + 4,
|
||||||
Game.viewport.Location.Y + Bounds.Top + 5,
|
Game.viewport.Location.Y + Bounds.Top + 5,
|
||||||
Bounds.Width - 9,
|
Bounds.Height - 9,
|
||||||
Bounds.Height - 9),
|
Bounds.Height - 9),
|
||||||
Color.White);
|
Color.White);
|
||||||
Game.chrome.lineRenderer.Flush();
|
Game.chrome.lineRenderer.Flush();
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ namespace OpenRA.Widgets
|
|||||||
Rectangle r = Bounds;
|
Rectangle r = Bounds;
|
||||||
Game.chrome.renderer.Device.EnableScissor(r.Left, r.Top, r.Width, r.Height);
|
Game.chrome.renderer.Device.EnableScissor(r.Left, r.Top, r.Width, r.Height);
|
||||||
|
|
||||||
int2 bounds = Game.chrome.renderer.BoldFont.Measure(Text);
|
int2 textSize = Game.chrome.renderer.BoldFont.Measure(Text);
|
||||||
int2 position = new int2(Bounds.X,Bounds.Y);
|
int2 position = new int2(Bounds.X,Bounds.Y);
|
||||||
|
|
||||||
if (Align == "Center")
|
if (Align == "Center")
|
||||||
position = new int2(Bounds.X+Bounds.Width/2, Bounds.Y+Bounds.Height/2) - new int2(bounds.X / 2, bounds.Y/2);
|
position = new int2(Bounds.X+Bounds.Width/2, Bounds.Y+Bounds.Height/2)
|
||||||
|
- new int2(textSize.X / 2, textSize.Y/2);
|
||||||
|
|
||||||
Game.chrome.renderer.BoldFont.DrawText(Game.chrome.rgbaRenderer, Text, position, Color.White);
|
Game.chrome.renderer.BoldFont.DrawText(Game.chrome.rgbaRenderer, Text, position, Color.White);
|
||||||
Game.chrome.renderer.Device.DisableScissor();
|
Game.chrome.renderer.Device.DisableScissor();
|
||||||
|
|||||||
@@ -67,16 +67,10 @@ Container:
|
|||||||
Id:CREATESERVER_CHECKBOX_ONLINE
|
Id:CREATESERVER_CHECKBOX_ONLINE
|
||||||
X:100
|
X:100
|
||||||
Y:60
|
Y:60
|
||||||
Width:20
|
|
||||||
Height:20
|
|
||||||
Delegate:CreateServerMenuDelegate
|
|
||||||
Label@CREATESERVER_LABEL_ONLINE:
|
|
||||||
Id:CREATESERVER_LABEL_ONLINE
|
|
||||||
X:135
|
|
||||||
Y:60
|
|
||||||
Width:300
|
Width:300
|
||||||
Height:25
|
Height:20
|
||||||
Text:Advertise game Online
|
Text:Advertise game Online
|
||||||
|
Delegate:CreateServerMenuDelegate
|
||||||
Button@CREATESERVER_BUTTON_START:
|
Button@CREATESERVER_BUTTON_START:
|
||||||
Id:CREATESERVER_BUTTON_START
|
Id:CREATESERVER_BUTTON_START
|
||||||
X:100
|
X:100
|
||||||
@@ -113,72 +107,42 @@ Container:
|
|||||||
Id:SETTINGS_CHECKBOX_UNITDEBUG
|
Id:SETTINGS_CHECKBOX_UNITDEBUG
|
||||||
X:100
|
X:100
|
||||||
Y:60
|
Y:60
|
||||||
Width:20
|
|
||||||
Height:20
|
|
||||||
Delegate:SettingsMenuDelegate
|
|
||||||
Label@SETTINGS_LABEL_UNITDEBUG:
|
|
||||||
Id:SETTINGS_LABEL_UNITDEBUG
|
|
||||||
X:135
|
|
||||||
Y:60
|
|
||||||
Width:300
|
Width:300
|
||||||
Height:25
|
Height:20
|
||||||
Text:Show Occupied Cells
|
Text:Show Occupied Cells
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
Checkbox@SETTINGS_CHECKBOX_PATHDEBUG:
|
Checkbox@SETTINGS_CHECKBOX_PATHDEBUG:
|
||||||
Id:SETTINGS_CHECKBOX_PATHDEBUG
|
Id:SETTINGS_CHECKBOX_PATHDEBUG
|
||||||
X:100
|
X:100
|
||||||
Y:90
|
Y:90
|
||||||
Width:20
|
|
||||||
Height:20
|
|
||||||
Delegate:SettingsMenuDelegate
|
|
||||||
Label@SETTINGS_LABEL_PATHDEBUG:
|
|
||||||
Id:SETTINGS_LABEL_PATHDEBUG
|
|
||||||
X:135
|
|
||||||
Y:90
|
|
||||||
Width:300
|
Width:300
|
||||||
Height:25
|
Height:20
|
||||||
Text:Show Unit Paths
|
Text:Show Unit Paths
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
Checkbox@SETTINGS_CHECKBOX_INDEXDEBUG:
|
Checkbox@SETTINGS_CHECKBOX_INDEXDEBUG:
|
||||||
Id:SETTINGS_CHECKBOX_INDEXDEBUG
|
Id:SETTINGS_CHECKBOX_INDEXDEBUG
|
||||||
X:100
|
X:100
|
||||||
Y:120
|
Y:120
|
||||||
Width:20
|
|
||||||
Height:20
|
|
||||||
Delegate:SettingsMenuDelegate
|
|
||||||
Label@SETTINGS_LABEL_INDEXDEBUG:
|
|
||||||
Id:SETTINGS_LABEL_INDEXDEBUG
|
|
||||||
X:135
|
|
||||||
Y:120
|
|
||||||
Width:300
|
Width:300
|
||||||
Height:25
|
Height:20
|
||||||
Text:Show Spatial Index Debug
|
Text:Show Spatial Index Debug
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
Checkbox@SETTINGS_CHECKBOX_PERFGRAPH:
|
Checkbox@SETTINGS_CHECKBOX_PERFGRAPH:
|
||||||
Id:SETTINGS_CHECKBOX_PERFGRAPH
|
Id:SETTINGS_CHECKBOX_PERFGRAPH
|
||||||
X:100
|
X:100
|
||||||
Y:150
|
Y:150
|
||||||
Width:20
|
|
||||||
Height:20
|
|
||||||
Delegate:SettingsMenuDelegate
|
|
||||||
Label@SETTINGS_LABEL_PERFGRAPH:
|
|
||||||
Id:SETTINGS_LABEL_PERFGRAPH
|
|
||||||
X:135
|
|
||||||
Y:150
|
|
||||||
Width:300
|
Width:300
|
||||||
Height:25
|
Height:20
|
||||||
Text:Show Performance Graph
|
Text:Show Performance Graph
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
Checkbox@SETTINGS_CHECKBOX_PERFTEXT:
|
Checkbox@SETTINGS_CHECKBOX_PERFTEXT:
|
||||||
Id:SETTINGS_CHECKBOX_PERFTEXT
|
Id:SETTINGS_CHECKBOX_PERFTEXT
|
||||||
X:100
|
X:100
|
||||||
Y:180
|
Y:180
|
||||||
Width:20
|
|
||||||
Height:20
|
|
||||||
Delegate:SettingsMenuDelegate
|
|
||||||
Label@SETTINGS_LABEL_PERFTEXT:
|
|
||||||
Id:SETTINGS_LABEL_PERFTEXT
|
|
||||||
X:135
|
|
||||||
Y:180
|
|
||||||
Width:300
|
Width:300
|
||||||
Height:25
|
Height:20
|
||||||
Text:Show Performance Text
|
Text:Show Performance Text
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
Button@SETTINGS_BUTTON_OK:
|
Button@SETTINGS_BUTTON_OK:
|
||||||
Id:SETTINGS_BUTTON_OK
|
Id:SETTINGS_BUTTON_OK
|
||||||
X:PARENT_RIGHT - 180
|
X:PARENT_RIGHT - 180
|
||||||
|
|||||||
Reference in New Issue
Block a user