1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD 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 * gtkD 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 gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.ShortcutLabel; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Box; 31 private import gtk.Widget; 32 private import gtkc.gtk; 33 public import gtkc.gtktypes; 34 35 36 /** 37 * #GtkShortcutLabel is a widget that represents a single keyboard shortcut or gesture 38 * in the user interface. 39 */ 40 public class ShortcutLabel : Box 41 { 42 /** the main Gtk struct */ 43 protected GtkShortcutLabel* gtkShortcutLabel; 44 45 /** Get the main Gtk struct */ 46 public GtkShortcutLabel* getShortcutLabelStruct(bool transferOwnership = false) 47 { 48 if (transferOwnership) 49 ownedRef = false; 50 return gtkShortcutLabel; 51 } 52 53 /** the main Gtk struct as a void* */ 54 protected override void* getStruct() 55 { 56 return cast(void*)gtkShortcutLabel; 57 } 58 59 protected override void setStruct(GObject* obj) 60 { 61 gtkShortcutLabel = cast(GtkShortcutLabel*)obj; 62 super.setStruct(obj); 63 } 64 65 /** 66 * Sets our main struct and passes it to the parent class. 67 */ 68 public this (GtkShortcutLabel* gtkShortcutLabel, bool ownedRef = false) 69 { 70 this.gtkShortcutLabel = gtkShortcutLabel; 71 super(cast(GtkBox*)gtkShortcutLabel, ownedRef); 72 } 73 74 75 /** */ 76 public static GType getType() 77 { 78 return gtk_shortcut_label_get_type(); 79 } 80 81 /** 82 * Creates a new #GtkShortcutLabel with @accelerator set. 83 * 84 * Params: 85 * accelerator = the initial accelerator 86 * 87 * Returns: a newly-allocated #GtkShortcutLabel 88 * 89 * Since: 3.22 90 * 91 * Throws: ConstructionException GTK+ fails to create the object. 92 */ 93 public this(string accelerator) 94 { 95 auto p = gtk_shortcut_label_new(Str.toStringz(accelerator)); 96 97 if(p is null) 98 { 99 throw new ConstructionException("null returned by new"); 100 } 101 102 this(cast(GtkShortcutLabel*) p, true); 103 } 104 105 /** 106 * Retrieves the current accelerator of @self. 107 * 108 * Returns: the current accelerator. 109 * 110 * Since: 3.22 111 */ 112 public string getAccelerator() 113 { 114 return Str.toString(gtk_shortcut_label_get_accelerator(gtkShortcutLabel)); 115 } 116 117 /** 118 * Retrieves the text that is displayed when no accelerator is set. 119 * 120 * Returns: the current text displayed when no 121 * accelerator is set. 122 * 123 * Since: 3.22 124 */ 125 public string getDisabledText() 126 { 127 return Str.toString(gtk_shortcut_label_get_disabled_text(gtkShortcutLabel)); 128 } 129 130 /** 131 * Sets the accelerator to be displayed by @self. 132 * 133 * Params: 134 * accelerator = the new accelerator 135 * 136 * Since: 3.22 137 */ 138 public void setAccelerator(string accelerator) 139 { 140 gtk_shortcut_label_set_accelerator(gtkShortcutLabel, Str.toStringz(accelerator)); 141 } 142 143 /** 144 * Sets the text to be displayed by @self when no accelerator is set. 145 * 146 * Params: 147 * disabledText = the text to be displayed when no accelerator is set 148 * 149 * Since: 3.22 150 */ 151 public void setDisabledText(string disabledText) 152 { 153 gtk_shortcut_label_set_disabled_text(gtkShortcutLabel, Str.toStringz(disabledText)); 154 } 155 }