Change color of labels that correspond to disabled inputs
- Add a new widget type for input and extend it from other input widgets - Add a new label type that can be linked to an input widget - Change the label color when the input's disabled state changes
This commit is contained in:
committed by
abcdefg30
parent
0203476da9
commit
eadc8ad689
@@ -18,7 +18,7 @@ using OpenRA.Widgets;
|
||||
namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
public enum TextFieldType { General, Filename, Integer }
|
||||
public class TextFieldWidget : Widget
|
||||
public class TextFieldWidget : InputWidget
|
||||
{
|
||||
string text = "";
|
||||
public string Text
|
||||
@@ -39,8 +39,6 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public int RightMargin = 5;
|
||||
public string Background = "textfield";
|
||||
|
||||
public bool Disabled = false;
|
||||
|
||||
TextFieldType type = TextFieldType.General;
|
||||
public TextFieldType Type
|
||||
{
|
||||
@@ -64,7 +62,6 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public Action OnTextEdited = () => { };
|
||||
public int CursorPosition { get; set; }
|
||||
|
||||
public Func<bool> IsDisabled;
|
||||
public Func<bool> IsValid = () => true;
|
||||
public string Font = ChromeMetrics.Get<string>("TextfieldFont");
|
||||
public Color TextColor = ChromeMetrics.Get<Color>("TextfieldColor");
|
||||
@@ -76,10 +73,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
protected int selectionEndIndex = -1;
|
||||
protected bool mouseSelectionActive = false;
|
||||
|
||||
public TextFieldWidget()
|
||||
{
|
||||
IsDisabled = () => Disabled;
|
||||
}
|
||||
public TextFieldWidget() { }
|
||||
|
||||
protected TextFieldWidget(TextFieldWidget widget)
|
||||
: base(widget)
|
||||
@@ -95,7 +89,6 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
TextColorInvalid = widget.TextColorInvalid;
|
||||
TextColorHighlight = widget.TextColorHighlight;
|
||||
VisualHeight = widget.VisualHeight;
|
||||
IsDisabled = widget.IsDisabled;
|
||||
}
|
||||
|
||||
public override bool YieldKeyboardFocus()
|
||||
|
||||
Reference in New Issue
Block a user