|
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) : base() |
|
12 { |
|
13 AcceptsReturn = true; |
|
14 IsUndoEnabled = false; // we need our own undo stack |
|
15 if (text != null) |
|
16 { |
|
17 Text = text; |
|
18 } |
|
19 VerticalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto; |
|
20 HorizontalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Auto; |
|
21 |
|
22 container.Add(this, true); |
|
23 } |
|
24 |
|
25 public static TextArea CreateTextArea(Container container, String text) |
|
26 { |
|
27 return Application.GetInstance().Exec<TextArea>(() => new TextArea(container, text)); |
|
28 } |
|
29 |
|
30 |
|
31 // ------------------ UiText methods ------------------ |
|
32 |
|
33 public void SetText(String str) |
|
34 { |
|
35 Application.GetInstance().Exec(() => Text = str); |
|
36 } |
|
37 |
|
38 public String GetText() |
|
39 { |
|
40 return Application.GetInstance().Exec<String>(() => Text); |
|
41 } |
|
42 |
|
43 public String GetSubString(int begin, int end) |
|
44 { |
|
45 return null; |
|
46 } |
|
47 |
|
48 public void Insert(int pos, String str) |
|
49 { |
|
50 |
|
51 } |
|
52 |
|
53 public int Position() |
|
54 { |
|
55 return Application.GetInstance().Exec<int>(() => CaretIndex); |
|
56 } |
|
57 |
|
58 public int Selection() |
|
59 { |
|
60 return 0; |
|
61 } |
|
62 |
|
63 public int Length() |
|
64 { |
|
65 return Application.GetInstance().Exec<int>(() => Text.Length); |
|
66 } |
|
67 |
|
68 public void Remove(int begin, int end) |
|
69 { |
|
70 |
|
71 } |
|
72 } |
|
73 } |