ui/wpf/UIwrapper/UIwrapper/controls.cpp

changeset 101
1c943d43fa81
parent 88
04c81be1c5a0
child 104
3efe0210e27e
equal deleted inserted replaced
100:d276306d801f 101:1c943d43fa81
4 #include <stdio.h> 4 #include <stdio.h>
5 5
6 #include "controls.h" 6 #include "controls.h"
7 7
8 #using "UIcore.dll" 8 #using "UIcore.dll"
9
10 /* ------------------------------ Buttons ------------------------------ */
9 11
10 UI_EXPORT void* __stdcall UIbutton(gcroot<UI::Container^> *container, char *label, UIcallback f, void *eventdata) { 12 UI_EXPORT void* __stdcall UIbutton(gcroot<UI::Container^> *container, char *label, UIcallback f, void *eventdata) {
11 gcroot<Button^> *button = new gcroot<Button^>(); 13 gcroot<Button^> *button = new gcroot<Button^>();
12 14
13 EventWrapper ^evt = gcnew EventWrapper(f, eventdata); 15 EventWrapper ^evt = gcnew EventWrapper(f, eventdata);
15 17
16 *button = UI::Controls::Button(*container, gcnew String(label), handler); 18 *button = UI::Controls::Button(*container, gcnew String(label), handler);
17 return button; 19 return button;
18 } 20 }
19 21
22
23 /* ------------------------------ Labels ------------------------------ */
24
25 UI_EXPORT void* __stdcall UIlabel(gcroot<UI::Container^> *container, char *label, int alignment) {
26 gcroot<Label^> *control = new gcroot<Label^>();
27 *control = UI::Controls::Label(*container, gcnew String(label), alignment);
28 return control;
29 }
30
31 UI_EXPORT void* __stdcall UIspace(gcroot<UI::Container^> *container) {
32 gcroot<Label^> *control = new gcroot<Label^>();
33
34 *control = UI::Controls::Space(*container);
35 return control;
36 }
37
38 UI_EXPORT void* __stdcall UIseparator(gcroot<UI::Container^> *container) {
39 return NULL;
40 }
41
42
43
44 /* ------------------------------ Textarea ------------------------------ */
20 45
21 UI_EXPORT void* __stdcall UItextarea(gcroot<UI::Container^> *container, char *text) { 46 UI_EXPORT void* __stdcall UItextarea(gcroot<UI::Container^> *container, char *text) {
22 String ^str = nullptr; 47 String ^str = nullptr;
23 if (text) { 48 if (text) {
24 str = gcnew String(text); 49 str = gcnew String(text);
65 } 90 }
66 91
67 UI_EXPORT void __stdcall UIfreestr(char *str) { 92 UI_EXPORT void __stdcall UIfreestr(char *str) {
68 Marshal::FreeHGlobal((IntPtr)(void*)str); 93 Marshal::FreeHGlobal((IntPtr)(void*)str);
69 } 94 }
95
96
97 /* ------------------------------ Textfield ------------------------------ */
98
99 UI_EXPORT void* __stdcall UItextfield(gcroot<UI::Container^> *container, char *text) {
100 String ^str = nullptr;
101 if (text) {
102 str = gcnew String(text);
103 }
104
105 gcroot<UI::TextArea^> *textfield = new gcroot<UI::TextArea^>();
106 *textfield = UI::TextArea::CreateTextField(*container, str);
107
108 return textfield;
109 }

mercurial