1 module webkit2webextension.DOMEvent; 2 3 private import glib.Str; 4 private import gobject.ObjectG; 5 private import webkit2webextension.DOMEventTargetIF; 6 private import webkit2webextension.DOMObject; 7 private import webkit2webextension.c.functions; 8 public import webkit2webextension.c.types; 9 10 11 /** */ 12 public class DOMEvent : DOMObject 13 { 14 /** the main Gtk struct */ 15 protected WebKitDOMEvent* webKitDOMEvent; 16 17 /** Get the main Gtk struct */ 18 public WebKitDOMEvent* getDOMEventStruct(bool transferOwnership = false) 19 { 20 if (transferOwnership) 21 ownedRef = false; 22 return webKitDOMEvent; 23 } 24 25 /** the main Gtk struct as a void* */ 26 protected override void* getStruct() 27 { 28 return cast(void*)webKitDOMEvent; 29 } 30 31 /** 32 * Sets our main struct and passes it to the parent class. 33 */ 34 public this (WebKitDOMEvent* webKitDOMEvent, bool ownedRef = false) 35 { 36 this.webKitDOMEvent = webKitDOMEvent; 37 super(cast(WebKitDOMObject*)webKitDOMEvent, ownedRef); 38 } 39 40 41 /** */ 42 public static GType getType() 43 { 44 return webkit_dom_event_get_type(); 45 } 46 47 /** 48 * 49 * 50 * Deprecated: Use JavaScriptCore API instead 51 * 52 * Returns: A #gboolean 53 */ 54 public bool getBubbles() 55 { 56 return webkit_dom_event_get_bubbles(webKitDOMEvent) != 0; 57 } 58 59 /** 60 * 61 * 62 * Deprecated: Use JavaScriptCore API instead 63 * 64 * Returns: A #gboolean 65 */ 66 public bool getCancelBubble() 67 { 68 return webkit_dom_event_get_cancel_bubble(webKitDOMEvent) != 0; 69 } 70 71 /** 72 * 73 * 74 * Deprecated: Use JavaScriptCore API instead 75 * 76 * Returns: A #gboolean 77 */ 78 public bool getCancelable() 79 { 80 return webkit_dom_event_get_cancelable(webKitDOMEvent) != 0; 81 } 82 83 /** 84 * 85 * 86 * Deprecated: Use JavaScriptCore API instead 87 * 88 * Returns: A #WebKitDOMEventTarget 89 */ 90 public DOMEventTargetIF getCurrentTarget() 91 { 92 auto __p = webkit_dom_event_get_current_target(webKitDOMEvent); 93 94 if(__p is null) 95 { 96 return null; 97 } 98 99 return ObjectG.getDObject!(DOMEventTargetIF)(cast(WebKitDOMEventTarget*) __p, true); 100 } 101 102 /** 103 * 104 * 105 * Deprecated: Use JavaScriptCore API instead 106 * 107 * Returns: A #gushort 108 */ 109 public ushort getEventPhase() 110 { 111 return webkit_dom_event_get_event_phase(webKitDOMEvent); 112 } 113 114 /** 115 * 116 * 117 * Deprecated: Use JavaScriptCore API instead 118 * 119 * Returns: A #gchar 120 */ 121 public string getEventType() 122 { 123 auto retStr = webkit_dom_event_get_event_type(webKitDOMEvent); 124 125 scope(exit) Str.freeString(retStr); 126 return Str.toString(retStr); 127 } 128 129 /** 130 * 131 * 132 * Deprecated: Use JavaScriptCore API instead 133 * 134 * Returns: A #gboolean 135 */ 136 public bool getReturnValue() 137 { 138 return webkit_dom_event_get_return_value(webKitDOMEvent) != 0; 139 } 140 141 /** 142 * 143 * 144 * Deprecated: Use JavaScriptCore API instead 145 * 146 * Returns: A #WebKitDOMEventTarget 147 */ 148 public DOMEventTargetIF getSrcElement() 149 { 150 auto __p = webkit_dom_event_get_src_element(webKitDOMEvent); 151 152 if(__p is null) 153 { 154 return null; 155 } 156 157 return ObjectG.getDObject!(DOMEventTargetIF)(cast(WebKitDOMEventTarget*) __p, true); 158 } 159 160 /** 161 * 162 * 163 * Deprecated: Use JavaScriptCore API instead 164 * 165 * Returns: A #WebKitDOMEventTarget 166 */ 167 public DOMEventTargetIF getTarget() 168 { 169 auto __p = webkit_dom_event_get_target(webKitDOMEvent); 170 171 if(__p is null) 172 { 173 return null; 174 } 175 176 return ObjectG.getDObject!(DOMEventTargetIF)(cast(WebKitDOMEventTarget*) __p, true); 177 } 178 179 /** 180 * 181 * 182 * Deprecated: Use JavaScriptCore API instead 183 * 184 * Returns: A #guint32 185 */ 186 public uint getTimeStamp() 187 { 188 return webkit_dom_event_get_time_stamp(webKitDOMEvent); 189 } 190 191 /** 192 * 193 * 194 * Deprecated: Use JavaScriptCore API instead 195 * 196 * Params: 197 * eventTypeArg = A #gchar 198 * canBubbleArg = A #gboolean 199 * cancelableArg = A #gboolean 200 */ 201 public void initEvent(string eventTypeArg, bool canBubbleArg, bool cancelableArg) 202 { 203 webkit_dom_event_init_event(webKitDOMEvent, Str.toStringz(eventTypeArg), canBubbleArg, cancelableArg); 204 } 205 206 /** 207 * 208 * 209 * Deprecated: Use JavaScriptCore API instead 210 */ 211 public void preventDefault() 212 { 213 webkit_dom_event_prevent_default(webKitDOMEvent); 214 } 215 216 /** 217 * 218 * 219 * Deprecated: Use JavaScriptCore API instead 220 * 221 * Params: 222 * value = A #gboolean 223 */ 224 public void setCancelBubble(bool value) 225 { 226 webkit_dom_event_set_cancel_bubble(webKitDOMEvent, value); 227 } 228 229 /** 230 * 231 * 232 * Deprecated: Use JavaScriptCore API instead 233 * 234 * Params: 235 * value = A #gboolean 236 */ 237 public void setReturnValue(bool value) 238 { 239 webkit_dom_event_set_return_value(webKitDOMEvent, value); 240 } 241 242 /** 243 * 244 * 245 * Deprecated: Use JavaScriptCore API instead 246 */ 247 public void stopPropagation() 248 { 249 webkit_dom_event_stop_propagation(webKitDOMEvent); 250 } 251 }