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