1 /* 2 * This file is part of d-handy. 3 * 4 * d-handy is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * d-handy is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with d-handy; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 module handy.PreferencesRow; 20 21 private import glib.ConstructionException; 22 private import glib.Str; 23 private import gobject.ObjectG; 24 private import gtk.ActionableIF; 25 private import gtk.ActionableT; 26 private import gtk.BuildableIF; 27 private import gtk.BuildableT; 28 private import gtk.ListBoxRow; 29 private import gtk.Widget; 30 private import handy.c.functions; 31 public import handy.c.types; 32 33 34 /** */ 35 public class PreferencesRow : ListBoxRow 36 { 37 /** the main Gtk struct */ 38 protected HdyPreferencesRow* hdyPreferencesRow; 39 40 /** Get the main Gtk struct */ 41 public HdyPreferencesRow* getPreferencesRowStruct(bool transferOwnership = false) 42 { 43 if (transferOwnership) 44 ownedRef = false; 45 return hdyPreferencesRow; 46 } 47 48 /** the main Gtk struct as a void* */ 49 protected override void* getStruct() 50 { 51 return cast(void*)hdyPreferencesRow; 52 } 53 54 /** 55 * Sets our main struct and passes it to the parent class. 56 */ 57 public this (HdyPreferencesRow* hdyPreferencesRow, bool ownedRef = false) 58 { 59 this.hdyPreferencesRow = hdyPreferencesRow; 60 super(cast(GtkListBoxRow*)hdyPreferencesRow, ownedRef); 61 } 62 63 64 /** */ 65 public static GType getType() 66 { 67 return hdy_preferences_row_get_type(); 68 } 69 70 /** 71 * Creates a new #HdyPreferencesRow. 72 * 73 * Returns: a new #HdyPreferencesRow 74 * 75 * Since: 0.0.10 76 * 77 * Throws: ConstructionException GTK+ fails to create the object. 78 */ 79 public this() 80 { 81 auto __p = hdy_preferences_row_new(); 82 83 if(__p is null) 84 { 85 throw new ConstructionException("null returned by new"); 86 } 87 88 this(cast(HdyPreferencesRow*) __p); 89 } 90 91 /** 92 * Gets the title of the preference represented by @self. 93 * 94 * Returns: the title of the preference represented 95 * by @self, or %NULL. 96 * 97 * Since: 0.0.10 98 */ 99 public string getTitle() 100 { 101 return Str.toString(hdy_preferences_row_get_title(hdyPreferencesRow)); 102 } 103 104 /** 105 * Gets whether an embedded underline in the text of the title indicates a 106 * mnemonic. See hdy_preferences_row_set_use_underline(). 107 * 108 * Returns: %TRUE if an embedded underline in the title indicates the mnemonic 109 * accelerator keys. 110 * 111 * Since: 0.0.10 112 */ 113 public bool getUseUnderline() 114 { 115 return hdy_preferences_row_get_use_underline(hdyPreferencesRow) != 0; 116 } 117 118 /** 119 * Sets the title of the preference represented by @self. 120 * 121 * Params: 122 * title = the title, or %NULL. 123 * 124 * Since: 0.0.10 125 */ 126 public void setTitle(string title) 127 { 128 hdy_preferences_row_set_title(hdyPreferencesRow, Str.toStringz(title)); 129 } 130 131 /** 132 * If true, an underline in the text of the title indicates the next character 133 * should be used for the mnemonic accelerator key. 134 * 135 * Params: 136 * useUnderline = %TRUE if underlines in the text indicate mnemonics 137 * 138 * Since: 0.0.10 139 */ 140 public void setUseUnderline(bool useUnderline) 141 { 142 hdy_preferences_row_set_use_underline(hdyPreferencesRow, useUnderline); 143 } 144 }