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 handy.c.functions; 30 public import handy.c.types; 31 32 33 /** */ 34 public class PreferencesRow : ListBoxRow 35 { 36 /** the main Gtk struct */ 37 protected HdyPreferencesRow* hdyPreferencesRow; 38 39 /** Get the main Gtk struct */ 40 public HdyPreferencesRow* getPreferencesRowStruct(bool transferOwnership = false) 41 { 42 if (transferOwnership) 43 ownedRef = false; 44 return hdyPreferencesRow; 45 } 46 47 /** the main Gtk struct as a void* */ 48 protected override void* getStruct() 49 { 50 return cast(void*)hdyPreferencesRow; 51 } 52 53 /** 54 * Sets our main struct and passes it to the parent class. 55 */ 56 public this (HdyPreferencesRow* hdyPreferencesRow, bool ownedRef = false) 57 { 58 this.hdyPreferencesRow = hdyPreferencesRow; 59 super(cast(GtkListBoxRow*)hdyPreferencesRow, ownedRef); 60 } 61 62 63 /** */ 64 public static GType getType() 65 { 66 return hdy_preferences_row_get_type(); 67 } 68 69 /** 70 * Creates a new #HdyPreferencesRow. 71 * 72 * Returns: a new #HdyPreferencesRow 73 * 74 * Since: 0.0.10 75 * 76 * Throws: ConstructionException GTK+ fails to create the object. 77 */ 78 public this() 79 { 80 auto p = hdy_preferences_row_new(); 81 82 if(p is null) 83 { 84 throw new ConstructionException("null returned by new"); 85 } 86 87 this(cast(HdyPreferencesRow*) p); 88 } 89 90 /** 91 * Gets the title of the preference represented by @self. 92 * 93 * Returns: the title of the preference represented 94 * by @self, or %NULL. 95 * 96 * Since: 0.0.10 97 */ 98 public string getTitle() 99 { 100 return Str.toString(hdy_preferences_row_get_title(hdyPreferencesRow)); 101 } 102 103 /** 104 * Gets whether an embedded underline in the text of the title indicates a 105 * mnemonic. See hdy_preferences_row_set_use_underline(). 106 * 107 * Returns: %TRUE if an embedded underline in the title indicates the mnemonic 108 * accelerator keys. 109 * 110 * Since: 0.0.10 111 */ 112 public bool getUseUnderline() 113 { 114 return hdy_preferences_row_get_use_underline(hdyPreferencesRow) != 0; 115 } 116 117 /** 118 * Sets the title of the preference represented by @self. 119 * 120 * Params: 121 * title = the title, or %NULL. 122 * 123 * Since: 0.0.10 124 */ 125 public void setTitle(string title) 126 { 127 hdy_preferences_row_set_title(hdyPreferencesRow, Str.toStringz(title)); 128 } 129 130 /** 131 * If true, an underline in the text of the title indicates the next character 132 * should be used for the mnemonic accelerator key. 133 * 134 * Params: 135 * useUnderline = %TRUE if underlines in the text indicate mnemonics 136 * 137 * Since: 0.0.10 138 */ 139 public void setUseUnderline(bool useUnderline) 140 { 141 hdy_preferences_row_set_use_underline(hdyPreferencesRow, useUnderline); 142 } 143 }