1
#region Event #{DelegateName}
3
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
4
private static extern void Export#{ThisName}Event_Advise#{DelegateName}(IntPtr _native, bool _advise);
6
public delegate void Handle#{DelegateName}(
7
#{ValueTypePrefix1}#{TypeName1} #{ValueName1},
8
#{ValueTypePrefix2}#{TypeName2} #{ValueName2},
9
#{ValueTypePrefix3}#{TypeName3} #{ValueName3},
10
#{ValueTypePrefix4}#{TypeName4} #{ValueName4});
12
private Handle#{DelegateName} mEvent#{DelegateName};
13
public event Handle#{DelegateName} Event#{DelegateName}
17
if (ExportEvent#{DelegateName}.mDelegate == null)
19
ExportEvent#{DelegateName}.mDelegate = new ExportEvent#{DelegateName}.ExportHandle(OnExport#{DelegateName});
20
ExportEvent#{DelegateName}.Export#{ThisName}Event_Delegate#{DelegateName}(ExportEvent#{DelegateName}.mDelegate);
23
if (mEvent#{DelegateName} == null)
24
Export#{ThisName}Event_Advise#{DelegateName}(Native, true);
25
mEvent#{DelegateName} += value;
29
mEvent#{DelegateName} -= value;
30
if (mEvent#{DelegateName} == null)
31
Export#{ThisName}Event_Advise#{DelegateName}(Native, false);
35
private struct ExportEvent#{DelegateName}
37
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
38
public static extern void Export#{ThisName}Event_Delegate#{DelegateName}(ExportHandle _delegate);
39
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
40
public delegate void ExportHandle(
41
#{ValueMarshalAs1}#{ValueTypePrefix1}#{ValueTypeName1} #{ValueName1},
42
#{ValueMarshalAs2}#{ValueTypePrefix2}#{ValueTypeName2} #{ValueName2},
43
#{ValueMarshalAs3}#{ValueTypePrefix3}#{ValueTypeName3} #{ValueName3},
44
#{ValueMarshalAs4}#{ValueTypePrefix4}#{ValueTypeName4} #{ValueName4});
46
public static ExportHandle mDelegate;
49
private static void OnExport#{DelegateName}(
50
#{ValueTypePrefix1}#{ValueTypeName1} #{ValueName1},
51
#{ValueTypePrefix2}#{ValueTypeName2} #{ValueName2},
52
#{ValueTypePrefix3}#{ValueTypeName3} #{ValueName3},
53
#{ValueTypePrefix4}#{ValueTypeName4} #{ValueName4})
55
#{ValueTypePrefix1}#{TypeName1} sender = (#{ValueTypePrefix1}#{TypeName1})BaseWidget.GetByNative(#{ValueName1});
57
if (sender.mEvent#{DelegateName} != null)
58
sender.mEvent#{DelegateName}(
60
#{ValueConvertBefore2}#{ValueTypePrefix2}#{ValueName2}#{ValueConvertPost2},
61
#{ValueConvertBefore3}#{ValueTypePrefix3}#{ValueName3}#{ValueConvertPost3},
62
#{ValueConvertBefore4}#{ValueTypePrefix4}#{ValueName4}#{ValueConvertPost4});