1 module awebview.wrapper.cpp.webkeyboardevent;
2 
3 mixin template Awesomium()
4 {
5     final class WebKeyboardEvent
6     {
7         enum Type { keyDown, keyUp, char_ }
8         enum Modifiers
9         {
10             shiftKey = 1 << 0,
11             controlKey = 1 << 1,
12             altKey = 1 << 2,
13             metaKey = 1 << 3,
14             isKeypad = 1 << 4,
15             isAutorepeat = 1 << 5,
16         }
17 
18         static struct Field
19         {
20             Type type;
21             int modifiers;
22             int virtual_key_code;
23             int native_key_code;
24             char[20] key_identifier;
25             wchar[4] text;
26             wchar[4] unmodified_text;
27             bool is_system_key;
28 
29             WebKeyboardEvent cppObj() { return cast(WebKeyboardEvent)cast(void*)&this; }
30         }
31     }
32 
33 
34     void GetKeyIdentifierFromVirtualKeyCode(int virtual_key_code, char** dst);
35 }
36 
37 
38 mixin template Awesomium4D()
39 {
40     extern(C++, WebKeyboardEventMember)
41     {
42         size_t sizeOfInstance();
43         void ctor(WebKeyboardEvent p);
44         WebKeyboardEvent newCtor();
45         void deleteDtor(WebKeyboardEvent);
46 
47       version(Windows)
48       {
49         void ctor(WebKeyboardEvent, UINT, WPARAM, LPARAM);
50         void newCtor(UINT, WPARAM, LPARAM);
51       }
52       else version(OSX)
53       {
54         void ctor(WebKeyboardEvent, NSEvent *);
55         WebKeyboardEvent newCtor(NSEvent *);
56       }
57     }
58 
59     unittest
60     {
61         assert(WebKeyboardEventMember.sizeOfInstance()
62                     == Awesomium.WebKeyboardEvent.Field.sizeof);
63     }
64 }