1 module webkit2.InputMethodUnderline; 2 3 private import gdk.RGBA; 4 private import glib.ConstructionException; 5 private import gobject.ObjectG; 6 private import webkit2.c.functions; 7 public import webkit2.c.types; 8 9 10 /** */ 11 public class InputMethodUnderline 12 { 13 /** the main Gtk struct */ 14 protected WebKitInputMethodUnderline* webKitInputMethodUnderline; 15 protected bool ownedRef; 16 17 /** Get the main Gtk struct */ 18 public WebKitInputMethodUnderline* getInputMethodUnderlineStruct(bool transferOwnership = false) 19 { 20 if (transferOwnership) 21 ownedRef = false; 22 return webKitInputMethodUnderline; 23 } 24 25 /** the main Gtk struct as a void* */ 26 protected void* getStruct() 27 { 28 return cast(void*)webKitInputMethodUnderline; 29 } 30 31 /** 32 * Sets our main struct and passes it to the parent class. 33 */ 34 public this (WebKitInputMethodUnderline* webKitInputMethodUnderline, bool ownedRef = false) 35 { 36 this.webKitInputMethodUnderline = webKitInputMethodUnderline; 37 this.ownedRef = ownedRef; 38 } 39 40 ~this () 41 { 42 if ( ownedRef ) 43 webkit_input_method_underline_free(webKitInputMethodUnderline); 44 } 45 46 47 /** */ 48 public static GType getType() 49 { 50 return webkit_input_method_underline_get_type(); 51 } 52 53 /** 54 * Create a new #WebKitInputMethodUnderline for the given range in preedit string 55 * 56 * Params: 57 * startOffset = the start offset in preedit string 58 * endOffset = the end offset in preedit string 59 * 60 * Returns: A newly created #WebKitInputMethodUnderline 61 * 62 * Since: 2.28 63 * 64 * Throws: ConstructionException GTK+ fails to create the object. 65 */ 66 public this(uint startOffset, uint endOffset) 67 { 68 auto __p = webkit_input_method_underline_new(startOffset, endOffset); 69 70 if(__p is null) 71 { 72 throw new ConstructionException("null returned by new"); 73 } 74 75 this(cast(WebKitInputMethodUnderline*) __p); 76 } 77 78 /** 79 * Make a copy of the #WebKitInputMethodUnderline. 80 * 81 * Returns: A copy of passed in #WebKitInputMethodUnderline 82 * 83 * Since: 2.28 84 */ 85 public InputMethodUnderline copy() 86 { 87 auto __p = webkit_input_method_underline_copy(webKitInputMethodUnderline); 88 89 if(__p is null) 90 { 91 return null; 92 } 93 94 return ObjectG.getDObject!(InputMethodUnderline)(cast(WebKitInputMethodUnderline*) __p, true); 95 } 96 97 /** 98 * Free the #WebKitInputMethodUnderline. 99 * 100 * Since: 2.28 101 */ 102 public void free() 103 { 104 webkit_input_method_underline_free(webKitInputMethodUnderline); 105 ownedRef = false; 106 } 107 108 /** 109 * Set the color of the underline. If @rgba is %NULL the foreground text color will be used 110 * for the underline too. 111 * 112 * Params: 113 * rgba = a #GdkRGBA or %NULL 114 * 115 * Since: 2.28 116 */ 117 public void setColor(RGBA rgba) 118 { 119 webkit_input_method_underline_set_color(webKitInputMethodUnderline, (rgba is null) ? null : rgba.getRGBAStruct()); 120 } 121 }