1 module webkit2.FormSubmissionRequest; 2 3 private import glib.HashTable; 4 private import glib.PtrArray; 5 private import glib.Str; 6 private import gobject.ObjectG; 7 private import webkit2.c.functions; 8 public import webkit2.c.types; 9 10 11 /** 12 * When a form is about to be submitted in a #WebKitWebView, the 13 * #WebKitWebView::submit-form signal is emitted. Its request argument 14 * contains information about the text fields of the form, that are 15 * typically used to store login information, returned as lists by 16 * webkit_form_submission_request_list_text_fields(). You can submit the 17 * form with webkit_form_submission_request_submit(). 18 */ 19 public class FormSubmissionRequest : ObjectG 20 { 21 /** the main Gtk struct */ 22 protected WebKitFormSubmissionRequest* webKitFormSubmissionRequest; 23 24 /** Get the main Gtk struct */ 25 public WebKitFormSubmissionRequest* getFormSubmissionRequestStruct(bool transferOwnership = false) 26 { 27 if (transferOwnership) 28 ownedRef = false; 29 return webKitFormSubmissionRequest; 30 } 31 32 /** the main Gtk struct as a void* */ 33 protected override void* getStruct() 34 { 35 return cast(void*)webKitFormSubmissionRequest; 36 } 37 38 /** 39 * Sets our main struct and passes it to the parent class. 40 */ 41 public this (WebKitFormSubmissionRequest* webKitFormSubmissionRequest, bool ownedRef = false) 42 { 43 this.webKitFormSubmissionRequest = webKitFormSubmissionRequest; 44 super(cast(GObject*)webKitFormSubmissionRequest, ownedRef); 45 } 46 47 48 /** */ 49 public static GType getType() 50 { 51 return webkit_form_submission_request_get_type(); 52 } 53 54 /** 55 * Get a #GHashTable with the values of the text fields contained in the form 56 * associated to @request. Note that fields will be missing if the form 57 * contains multiple text input elements with the same name, so this 58 * function does not reliably return all text fields. 59 * 60 * Deprecated: Use webkit_form_submission_request_list_text_fields() instead. 61 * 62 * Returns: a #GHashTable with the form 63 * text fields, or %NULL if the form doesn't contain text fields. 64 */ 65 public HashTable getTextFields() 66 { 67 auto __p = webkit_form_submission_request_get_text_fields(webKitFormSubmissionRequest); 68 69 if(__p is null) 70 { 71 return null; 72 } 73 74 return new HashTable(cast(GHashTable*) __p); 75 } 76 77 /** 78 * Get lists with the names and values of the text fields contained in 79 * the form associated to @request. Note that names and values may be 80 * %NULL. 81 * 82 * If this function returns %FALSE, then both @field_names and 83 * @field_values will be empty. 84 * 85 * Params: 86 * fieldNames = names of the text fields in the form 87 * fieldValues = values of the text fields in the form 88 * 89 * Returns: %TRUE if the form contains text fields, or %FALSE otherwise 90 * 91 * Since: 2.20 92 */ 93 public bool listTextFields(out PtrArray fieldNames, out PtrArray fieldValues) 94 { 95 GPtrArray* outfieldNames = null; 96 GPtrArray* outfieldValues = null; 97 98 auto __p = webkit_form_submission_request_list_text_fields(webKitFormSubmissionRequest, &outfieldNames, &outfieldValues) != 0; 99 100 fieldNames = new PtrArray(outfieldNames); 101 fieldValues = new PtrArray(outfieldValues); 102 103 return __p; 104 } 105 106 /** 107 * Continue the form submission. 108 */ 109 public void submit() 110 { 111 webkit_form_submission_request_submit(webKitFormSubmissionRequest); 112 } 113 }