Sun, 15 Feb 2015 15:44:24 +0100
added toolbar (WPF)
78
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | // UIwrapper.h |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | #pragma once |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
5 | #include <vcclr.h> |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
6 | |
78
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | using namespace System; |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | using namespace System::Runtime::InteropServices; |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | using namespace System::Threading; |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | using namespace System::Windows; |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | using namespace System::Windows::Controls; |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | #define UI_EXPORT extern "C" __declspec(dllexport) |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | |
81
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
15 | extern "C" typedef void(*UIcallback)(void*, void*); |
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
16 | |
78
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | void* ObjectToPtr(Object ^obj); |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
18 | Object^ PtrToObject(void *ptr); |
81
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
19 | |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
20 | public ref class ObjEventWrapper { |
81
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
21 | UIcallback callback = NULL; |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
22 | void *eventdata = NULL; |
82
0cdb8089a29f
added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
23 | Action<IntPtr> ^action; |
81
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
24 | |
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
25 | public: |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
26 | ObjEventWrapper(UIcallback callback, void *eventdata); |
81
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
27 | |
82
0cdb8089a29f
added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
28 | Action<IntPtr>^ GetAction(); |
81
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
29 | |
82
0cdb8089a29f
added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
30 | void Callback(IntPtr uiobj); |
81
5eb765a7a793
added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
31 | }; |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
32 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
33 | public ref class EventWrapper { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
34 | UIcallback callback = NULL; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
35 | void *eventdata = NULL; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
36 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
37 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
38 | public: |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
39 | EventWrapper(UIcallback callback, void *eventdata); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
40 | void Callback(Object ^sender, RoutedEventArgs ^e); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
41 | }; |