UNIXworkcode

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace UI 8 { 9 public class TextArea : System.Windows.Controls.TextBox 10 { 11 public TextArea(Container container, String text, bool textarea) : base() 12 { 13 bool fill = false; 14 if (textarea) 15 { 16 AcceptsReturn = true; 17 IsUndoEnabled = false; // we need our own undo stack 18 VerticalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto; 19 HorizontalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto; 20 fill = true; 21 } 22 else 23 { 24 HorizontalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto; 25 MinWidth = 15; 26 } 27 28 if (text != null) 29 { 30 Text = text; 31 } 32 33 container.Add(this, fill); 34 } 35 36 37 // ------------------ UiText methods ------------------ 38 39 public void SetText(String str) 40 { 41 Text = str; 42 } 43 44 public String GetText() 45 { 46 return Text; 47 } 48 49 public String GetSubString(int begin, int end) 50 { 51 return null; 52 } 53 54 public void Insert(int pos, String str) 55 { 56 57 } 58 59 public int Position() 60 { 61 return CaretIndex; 62 } 63 64 public int Selection() 65 { 66 return 0; 67 } 68 69 public int Length() 70 { 71 return Text.Length; 72 } 73 74 public void Remove(int begin, int end) 75 { 76 77 } 78 } 79 } 80