1 module webkit2webextension.DOMKeyboardEvent; 2 3 private import glib.Str; 4 private import webkit2webextension.DOMDOMWindow; 5 private import webkit2webextension.DOMUIEvent; 6 private import webkit2webextension.c.functions; 7 public import webkit2webextension.c.types; 8 9 10 /** */ 11 public class DOMKeyboardEvent : DOMUIEvent 12 { 13 /** the main Gtk struct */ 14 protected WebKitDOMKeyboardEvent* webKitDOMKeyboardEvent; 15 16 /** Get the main Gtk struct */ 17 public WebKitDOMKeyboardEvent* getDOMKeyboardEventStruct(bool transferOwnership = false) 18 { 19 if (transferOwnership) 20 ownedRef = false; 21 return webKitDOMKeyboardEvent; 22 } 23 24 /** the main Gtk struct as a void* */ 25 protected override void* getStruct() 26 { 27 return cast(void*)webKitDOMKeyboardEvent; 28 } 29 30 /** 31 * Sets our main struct and passes it to the parent class. 32 */ 33 public this (WebKitDOMKeyboardEvent* webKitDOMKeyboardEvent, bool ownedRef = false) 34 { 35 this.webKitDOMKeyboardEvent = webKitDOMKeyboardEvent; 36 super(cast(WebKitDOMUIEvent*)webKitDOMKeyboardEvent, ownedRef); 37 } 38 39 40 /** */ 41 public static GType getType() 42 { 43 return webkit_dom_keyboard_event_get_type(); 44 } 45 46 /** 47 * 48 * 49 * Deprecated: Use JavaScriptCore API instead 50 * 51 * Returns: A #gboolean 52 */ 53 public bool getAltGraphKey() 54 { 55 return webkit_dom_keyboard_event_get_alt_graph_key(webKitDOMKeyboardEvent) != 0; 56 } 57 58 /** 59 * 60 * 61 * Deprecated: Use JavaScriptCore API instead 62 * 63 * Returns: A #gboolean 64 */ 65 public bool getAltKey() 66 { 67 return webkit_dom_keyboard_event_get_alt_key(webKitDOMKeyboardEvent) != 0; 68 } 69 70 /** 71 * 72 * 73 * Deprecated: Use JavaScriptCore API instead 74 * 75 * Returns: A #gboolean 76 */ 77 public bool getCtrlKey() 78 { 79 return webkit_dom_keyboard_event_get_ctrl_key(webKitDOMKeyboardEvent) != 0; 80 } 81 82 /** 83 * 84 * 85 * Deprecated: Use JavaScriptCore API instead 86 * 87 * Returns: A #gchar 88 */ 89 public string getKeyIdentifier() 90 { 91 auto retStr = webkit_dom_keyboard_event_get_key_identifier(webKitDOMKeyboardEvent); 92 93 scope(exit) Str.freeString(retStr); 94 return Str.toString(retStr); 95 } 96 97 /** 98 * 99 * 100 * Deprecated: Use JavaScriptCore API instead 101 * 102 * Returns: A #gulong 103 */ 104 public gulong getKeyLocation() 105 { 106 return webkit_dom_keyboard_event_get_key_location(webKitDOMKeyboardEvent); 107 } 108 109 /** 110 * 111 * 112 * Deprecated: Use JavaScriptCore API instead 113 * 114 * Returns: A #gboolean 115 */ 116 public bool getMetaKey() 117 { 118 return webkit_dom_keyboard_event_get_meta_key(webKitDOMKeyboardEvent) != 0; 119 } 120 121 /** 122 * 123 * 124 * Deprecated: Use JavaScriptCore API instead 125 * 126 * Params: 127 * keyIdentifierArg = A #gchar 128 * 129 * Returns: A #gboolean 130 */ 131 public bool getModifierState(string keyIdentifierArg) 132 { 133 return webkit_dom_keyboard_event_get_modifier_state(webKitDOMKeyboardEvent, Str.toStringz(keyIdentifierArg)) != 0; 134 } 135 136 /** 137 * 138 * 139 * Deprecated: Use JavaScriptCore API instead 140 * 141 * Returns: A #gboolean 142 */ 143 public bool getShiftKey() 144 { 145 return webkit_dom_keyboard_event_get_shift_key(webKitDOMKeyboardEvent) != 0; 146 } 147 148 /** 149 * 150 * 151 * Deprecated: Use JavaScriptCore API instead 152 * 153 * Params: 154 * type = A #gchar 155 * canBubble = A #gboolean 156 * cancelable = A #gboolean 157 * view = A #WebKitDOMDOMWindow 158 * keyIdentifier = A #gchar 159 * location = A #gulong 160 * ctrlKey = A #gboolean 161 * altKey = A #gboolean 162 * shiftKey = A #gboolean 163 * metaKey = A #gboolean 164 * altGraphKey = A #gboolean 165 */ 166 public void initKeyboardEvent(string type, bool canBubble, bool cancelable, DOMDOMWindow view, string keyIdentifier, gulong location, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) 167 { 168 webkit_dom_keyboard_event_init_keyboard_event(webKitDOMKeyboardEvent, Str.toStringz(type), canBubble, cancelable, (view is null) ? null : view.getDOMDOMWindowStruct(), Str.toStringz(keyIdentifier), location, ctrlKey, altKey, shiftKey, metaKey, altGraphKey); 169 } 170 }