49 using namespace Microsoft::UI::Xaml::Markup; |
49 using namespace Microsoft::UI::Xaml::Markup; |
50 using namespace Microsoft::UI::Xaml::Media; |
50 using namespace Microsoft::UI::Xaml::Media; |
51 using namespace winrt::Microsoft::UI::Xaml::Controls::Primitives; |
51 using namespace winrt::Microsoft::UI::Xaml::Controls::Primitives; |
52 using namespace winrt::Windows::UI::Xaml::Input; |
52 using namespace winrt::Windows::UI::Xaml::Input; |
53 |
53 |
|
54 |
|
55 UIEXPORT UIWIDGET ui_textarea_create(UiObject *obj, UiTextAreaArgs args) { |
|
56 UiObject* current = uic_current_obj(obj); |
|
57 |
|
58 // create textarea and toolkit wrapper |
|
59 RichEditBox textarea = RichEditBox(); |
|
60 UIElement elm = textarea; |
|
61 UiWidget* widget = new UiWidget(elm); |
|
62 ui_context_add_widget_destructor(current->ctx, widget); |
|
63 |
|
64 UiVar* var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_TEXT); |
|
65 if (var) { |
|
66 UiText* value = (UiText*)var->value; |
|
67 value->obj = widget; |
|
68 value->undomgr = NULL; |
|
69 value->set = ui_textarea_set; |
|
70 value->get = ui_textarea_get; |
|
71 value->getsubstr = ui_textarea_getsubstr; |
|
72 value->insert = ui_textarea_insert; |
|
73 value->setposition = ui_textarea_setposition; |
|
74 value->position = ui_textarea_position; |
|
75 value->selection = ui_textarea_selection; |
|
76 value->length = ui_textarea_length; |
|
77 value->remove = ui_textarea_remove; |
|
78 } |
|
79 |
|
80 // add textarea to current container |
|
81 UI_APPLY_LAYOUT1(current, args); |
|
82 |
|
83 current->container->Add(textarea, true); |
|
84 |
|
85 return widget; |
|
86 } |
|
87 |
|
88 UIEXPORT UIWIDGET ui_textarea_gettextwidget(UIWIDGET textarea) { |
|
89 return textarea; |
|
90 } |
|
91 |
|
92 UIEXPORT void ui_text_undo(UiText *value) { |
|
93 |
|
94 } |
|
95 |
|
96 UIEXPORT void ui_text_redo(UiText *value) { |
|
97 |
|
98 } |
|
99 |
|
100 |
|
101 |
|
102 extern "C" char* ui_textarea_get(UiText *text) { |
|
103 return NULL; |
|
104 } |
|
105 |
|
106 extern "C" void ui_textarea_set(UiText *text, const char *newvalue) { |
|
107 |
|
108 } |
|
109 |
|
110 extern "C" char* ui_textarea_getsubstr(UiText *text, int begin, int end) { |
|
111 return NULL; |
|
112 } |
|
113 |
|
114 extern "C" void ui_textarea_insert(UiText *text, int pos, char *str) { |
|
115 |
|
116 } |
|
117 |
|
118 extern "C" void ui_textarea_setposition(UiText *text, int pos) { |
|
119 |
|
120 } |
|
121 |
|
122 extern "C" int ui_textarea_position(UiText *text) { |
|
123 return 0; |
|
124 } |
|
125 |
|
126 extern "C" void ui_textarea_selection(UiText *text, int *begin, int *end) { |
|
127 |
|
128 } |
|
129 |
|
130 extern "C" int ui_textarea_length(UiText *text) { |
|
131 return 0; |
|
132 } |
|
133 |
|
134 extern "C" void ui_textarea_remove(UiText *text, int begin, int end) { |
|
135 |
|
136 } |
|
137 |
|
138 |
|
139 |
|
140 |
54 UIWIDGET ui_textfield_create(UiObject* obj, UiTextFieldArgs args) { |
141 UIWIDGET ui_textfield_create(UiObject* obj, UiTextFieldArgs args) { |
55 UiObject* current = uic_current_obj(obj); |
142 UiObject* current = uic_current_obj(obj); |
56 |
143 |
57 // create textbox and toolkit wrapper |
144 // create textbox and toolkit wrapper |
58 TextBox textfield = TextBox(); |
145 TextBox textfield = TextBox(); |