forked from CoppeliaRobotics/simUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
c.cpp
48 lines (39 loc) · 1.06 KB
/
c.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "stubs.h"
#include "v_repPlusPlus/Plugin.h"
VREP_DLLEXPORT int customUi_msgBox(int type, int buttons, const char *title, const char *message)
{
msgBox_in in;
in.type = type;
in.buttons = buttons;
in.title = title;
in.message = message;
msgBox_out out;
msgBox(nullptr, "", &in, &out);
return out.result;
}
VREP_DLLEXPORT char * customUi_fileDialog(int type, const char *title, const char *startPath, const char *initName, const char *extName, const char *ext, int native)
{
fileDialog_in in;
in.type = type;
in.title = title;
in.startPath = startPath;
in.initName = initName;
in.extName = extName;
in.ext = ext;
in.native = !!native;
fileDialog_out out;
fileDialog(nullptr, "", &in, &out);
int sz = 0;
for(auto &x : out.result) sz += x.length() + 1;
simChar *ret = simCreateBuffer(sz), *tmp = ret;
for(auto &x : out.result)
{
strcpy(tmp, x.c_str());
tmp += x.length();
*tmp = ';';
tmp++;
}
tmp--;
*tmp = '\0';
return ret;
}