aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GUI
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-08-02 18:03:55 -0400
committerMichael <[email protected]>2017-08-02 18:03:55 -0400
commit957e7bfcd2b6a0b54c94d283ff6c6623e95a5953 (patch)
tree8206415da332c8b260d198da7a0649299fdcfb7e /ShiftOS.Frontend/GUI
parentf887a5ff8a284bf446ed4e66f6c27657c3ea6aff (diff)
downloadshiftos_thereturn-957e7bfcd2b6a0b54c94d283ff6c6623e95a5953.tar.gz
shiftos_thereturn-957e7bfcd2b6a0b54c94d283ff6c6623e95a5953.tar.bz2
shiftos_thereturn-957e7bfcd2b6a0b54c94d283ff6c6623e95a5953.zip
chat + ai
Diffstat (limited to 'ShiftOS.Frontend/GUI')
-rw-r--r--ShiftOS.Frontend/GUI/Control.cs2
-rw-r--r--ShiftOS.Frontend/GUI/TextInput.cs30
2 files changed, 23 insertions, 9 deletions
diff --git a/ShiftOS.Frontend/GUI/Control.cs b/ShiftOS.Frontend/GUI/Control.cs
index 4d05470..6941b7b 100644
--- a/ShiftOS.Frontend/GUI/Control.cs
+++ b/ShiftOS.Frontend/GUI/Control.cs
@@ -366,7 +366,7 @@ namespace ShiftOS.Frontend.GUI
public void ClearControls()
{
_children.Clear();
- Invalidate();
+ Invalidate();
}
public Point PointToLocal(int x, int y)
diff --git a/ShiftOS.Frontend/GUI/TextInput.cs b/ShiftOS.Frontend/GUI/TextInput.cs
index 73954ef..5f824a0 100644
--- a/ShiftOS.Frontend/GUI/TextInput.cs
+++ b/ShiftOS.Frontend/GUI/TextInput.cs
@@ -37,6 +37,16 @@ namespace ShiftOS.Frontend.GUI
}
}
+ public override void MouseStateChanged()
+ {
+ if (MouseLeftDown == true)
+ {
+ UIManager.FocusedControl = this;
+ Invalidate();
+ }
+ base.MouseStateChanged();
+ }
+
public string Text
{
get
@@ -51,7 +61,7 @@ namespace ShiftOS.Frontend.GUI
_text = value;
if(_index >= _text.Length)
{
- _index = _text.Length - 1;
+ _index = _text.Length;
}
Invalidate();
}
@@ -117,22 +127,26 @@ namespace ShiftOS.Frontend.GUI
protected override void OnPaint(GraphicsContext gfx)
{
- gfx.Clear(LoadedSkin.ControlColor.ToMonoColor());
- gfx.DrawString(_text, 2 - (int)Math.Floor(_textDrawOffset), 2, LoadedSkin.ControlTextColor.ToMonoColor(), _font);
+ gfx.DrawRectangle(0, 0, Width, Height, UIManager.SkinTextures["ControlTextColor"]);
+ gfx.DrawRectangle(1, 1, Width - 2, Height - 2, UIManager.SkinTextures["ControlColor"]);
+
+ if (!string.IsNullOrWhiteSpace(Text))
+ {
+ gfx.DrawString(Text, (int)(2 - _textDrawOffset), 2, LoadedSkin.ControlTextColor.ToMonoColor(), _font);
+ }
if (IsFocusedControl)
{
- //Draw caret.
-
-
- gfx.DrawRectangle((int)(Math.Floor(caretPos) - Math.Floor(_textDrawOffset)), 2, 2, Height - 4, LoadedSkin.ControlTextColor.ToMonoColor());
+ //draw caret
+ gfx.DrawRectangle((int)(caretPos - _textDrawOffset), 2, 2, Height - 4, UIManager.SkinTextures["ControlTextColor"]);
}
else
{
- if (string.IsNullOrEmpty(_text))
+ if(string.IsNullOrWhiteSpace(Text) && !string.IsNullOrWhiteSpace(_label))
{
gfx.DrawString(_label, 2, 2, Color.Gray, _font);
}
}
+
}
}
}