1 module webkit2.NavigationAction; 2 3 private import gobject.ObjectG; 4 private import webkit2.URIRequest; 5 private import webkit2.c.functions; 6 public import webkit2.c.types; 7 8 9 /** */ 10 public class NavigationAction 11 { 12 /** the main Gtk struct */ 13 protected WebKitNavigationAction* webKitNavigationAction; 14 protected bool ownedRef; 15 16 /** Get the main Gtk struct */ 17 public WebKitNavigationAction* getNavigationActionStruct(bool transferOwnership = false) 18 { 19 if (transferOwnership) 20 ownedRef = false; 21 return webKitNavigationAction; 22 } 23 24 /** the main Gtk struct as a void* */ 25 protected void* getStruct() 26 { 27 return cast(void*)webKitNavigationAction; 28 } 29 30 /** 31 * Sets our main struct and passes it to the parent class. 32 */ 33 public this (WebKitNavigationAction* webKitNavigationAction, bool ownedRef = false) 34 { 35 this.webKitNavigationAction = webKitNavigationAction; 36 this.ownedRef = ownedRef; 37 } 38 39 ~this () 40 { 41 if ( ownedRef ) 42 webkit_navigation_action_free(webKitNavigationAction); 43 } 44 45 46 /** */ 47 public static GType getType() 48 { 49 return webkit_navigation_action_get_type(); 50 } 51 52 /** 53 * Make a copy of @navigation. 54 * 55 * Returns: A copy of passed in #WebKitNavigationAction 56 * 57 * Since: 2.6 58 */ 59 public NavigationAction copy() 60 { 61 auto __p = webkit_navigation_action_copy(webKitNavigationAction); 62 63 if(__p is null) 64 { 65 return null; 66 } 67 68 return ObjectG.getDObject!(NavigationAction)(cast(WebKitNavigationAction*) __p, true); 69 } 70 71 /** 72 * Free the #WebKitNavigationAction 73 * 74 * Since: 2.6 75 */ 76 public void free() 77 { 78 webkit_navigation_action_free(webKitNavigationAction); 79 ownedRef = false; 80 } 81 82 /** 83 * Return a bitmask of #GdkModifierType values describing the modifier keys that were in effect 84 * when the navigation was requested 85 * 86 * Returns: the modifier keys 87 * 88 * Since: 2.6 89 */ 90 public uint getModifiers() 91 { 92 return webkit_navigation_action_get_modifiers(webKitNavigationAction); 93 } 94 95 /** 96 * Return the number of the mouse button that triggered the navigation, or 0 if 97 * the navigation was not started by a mouse event. 98 * 99 * Returns: the mouse button number or 0 100 * 101 * Since: 2.6 102 */ 103 public uint getMouseButton() 104 { 105 return webkit_navigation_action_get_mouse_button(webKitNavigationAction); 106 } 107 108 /** 109 * Return the type of action that triggered the navigation. 110 * 111 * Returns: a #WebKitNavigationType 112 * 113 * Since: 2.6 114 */ 115 public WebKitNavigationType getNavigationType() 116 { 117 return webkit_navigation_action_get_navigation_type(webKitNavigationAction); 118 } 119 120 /** 121 * Return the #WebKitURIRequest associated with the navigation action. 122 * Modifications to the returned object are <emphasis>not</emphasis> taken 123 * into account when the request is sent over the network, and is intended 124 * only to aid in evaluating whether a navigation action should be taken or 125 * not. To modify requests before they are sent over the network the 126 * #WebKitPage::send-request signal can be used instead. 127 * 128 * Returns: a #WebKitURIRequest 129 * 130 * Since: 2.6 131 */ 132 public URIRequest getRequest() 133 { 134 auto __p = webkit_navigation_action_get_request(webKitNavigationAction); 135 136 if(__p is null) 137 { 138 return null; 139 } 140 141 return ObjectG.getDObject!(URIRequest)(cast(WebKitURIRequest*) __p); 142 } 143 144 /** 145 * Returns whether the @navigation was redirected. 146 * 147 * Returns: %TRUE if the original navigation was redirected, %FALSE otherwise. 148 * 149 * Since: 2.20 150 */ 151 public bool isRedirect() 152 { 153 return webkit_navigation_action_is_redirect(webKitNavigationAction) != 0; 154 } 155 156 /** 157 * Return whether the navigation was triggered by a user gesture like a mouse click. 158 * 159 * Returns: whether navigation action is a user gesture 160 * 161 * Since: 2.6 162 */ 163 public bool isUserGesture() 164 { 165 return webkit_navigation_action_is_user_gesture(webKitNavigationAction) != 0; 166 } 167 }