aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GUI/TextInput.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-07-02 21:48:10 -0400
committerMichael <[email protected]>2017-07-02 21:48:10 -0400
commit6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604 (patch)
tree9f138619a1cf4ebe7a7ece6c6a411adbe64843d6 /ShiftOS.Frontend/GUI/TextInput.cs
parent5d5f351138b55b27fe92690d824257b6b6e1a469 (diff)
downloadshiftos_thereturn-6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604.tar.gz
shiftos_thereturn-6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604.tar.bz2
shiftos_thereturn-6f3a5cba2ea08ea6f442e2336b74f32f4bbc0604.zip
A day's worth of hell... which is turning into heaven.
Diffstat (limited to 'ShiftOS.Frontend/GUI/TextInput.cs')
-rw-r--r--ShiftOS.Frontend/GUI/TextInput.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/ShiftOS.Frontend/GUI/TextInput.cs b/ShiftOS.Frontend/GUI/TextInput.cs
new file mode 100644
index 0000000..fc142a0
--- /dev/null
+++ b/ShiftOS.Frontend/GUI/TextInput.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ShiftOS.Frontend.GraphicsSubsystem;
+using static ShiftOS.Engine.SkinEngine;
+
+namespace ShiftOS.Frontend.GUI
+{
+ public class TextInput : Control
+ {
+ private string _label = "Type here!";
+ private string _text = "";
+ private int _index = 0;
+
+ protected override void OnKeyEvent(KeyEvent e)
+ {
+ if(e.Key == Microsoft.Xna.Framework.Input.Keys.Left)
+ {
+ if (_index > 0)
+ _index--;
+ }
+ if (e.Key == Microsoft.Xna.Framework.Input.Keys.Right)
+ if (_index < _text.Length)
+ _index++;
+ if (e.KeyChar != '\0')
+ _text.Insert(_index, e.KeyChar.ToString());
+ base.OnKeyEvent(e);
+ }
+
+ protected override void OnLayout()
+ {
+ base.OnLayout();
+ }
+
+ private int _textOffset = 0;
+
+ public override void Paint(Graphics gfx)
+ {
+ gfx.Clear(LoadedSkin.ControlColor);
+
+ }
+ }
+}