ui/wpf/UIcore/TextArea.cs

changeset 88
04c81be1c5a0
child 101
1c943d43fa81
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/wpf/UIcore/TextArea.cs	Sat Feb 14 13:26:00 2015 +0100
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace UI
+{
+    public class TextArea : System.Windows.Controls.TextBox
+    {
+        public TextArea(Container container, String text) : base()
+        {
+            AcceptsReturn = true;
+            IsUndoEnabled = false; // we need our own undo stack
+            if (text != null)
+            {
+                Text = text;
+            }
+            VerticalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto;
+            HorizontalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto;
+            
+            container.Add(this, true);
+        }
+
+        public static TextArea CreateTextArea(Container container, String text)
+        {
+            return Application.GetInstance().Exec<TextArea>(() => new TextArea(container, text));
+        }
+
+
+        // ------------------ UiText methods ------------------
+
+        public void SetText(String str)
+        {
+            Application.GetInstance().Exec(() => Text = str);
+        }
+
+        public String GetText()
+        {
+            return Application.GetInstance().Exec<String>(() => Text);
+        }
+
+        public String GetSubString(int begin, int end)
+        {
+            return null;
+        }
+
+        public void Insert(int pos, String str)
+        {
+
+        }
+
+        public int Position()
+        {
+            return Application.GetInstance().Exec<int>(() => CaretIndex);
+        }
+
+        public int Selection()
+        {
+            return 0;
+        }
+
+        public int Length()
+        {
+            return Application.GetInstance().Exec<int>(() => Text.Length);
+        }
+
+        public void Remove(int begin, int end)
+        {
+
+        }
+    }
+}

mercurial