-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXFrames.cs
70 lines (55 loc) · 2.99 KB
/
XFrames.cs
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System.Runtime.InteropServices;
class XFrames
{
public delegate void OnInitCb();
public delegate void OnTextChangedCb(int id, string value);
public delegate void OnComboChangedCb(int id, int index);
public delegate void OnNumericValueChangedCb(int id, float value);
public delegate void OnBooleanValueChangedCb(int id, bool value);
public delegate void OnMultipleNumericValuesChangedCb(int id, IntPtr values, int numValues);
public delegate void OnClickCb(int id);
public static float[] MarshalFloatArray(IntPtr ptr, int length)
{
float[] array = new float[length];
Marshal.Copy(ptr, array, 0, length);
return array;
}
// Importing the functions from the C DLL
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void resizeWindow(int width, int height);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void setElement(string elementJson);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void patchElement(int id, string elementJson);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void elementInternalOp(int id, string elementJson);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void setChildren(int id, string childrenIds);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void appendChild(int parentId, int childId);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr getChildren(int id);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void appendTextToClippedMultiLineTextRenderer(int id, string data);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr getStyle();
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void patchStyle(string styleDef);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void setDebug(bool debug);
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void showDebugWindow();
[DllImport("xframesshared.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void init(
string assetsBasePath,
string rawFontDefinitions,
string rawStyleOverrideDefinitions,
OnInitCb onInit,
OnTextChangedCb onTextChanged,
OnComboChangedCb onComboChanged,
OnNumericValueChangedCb onNumericValueChanged,
OnBooleanValueChangedCb onBooleanValueChanged,
OnMultipleNumericValuesChangedCb onMultipleNumericValuesChanged,
OnClickCb onClick
);
}