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 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GtkShortcutLabel* gtkShortcutLabel, bool ownedRef = false)
64 	{
65 		this.gtkShortcutLabel = gtkShortcutLabel;
66 		super(cast(GtkBox*)gtkShortcutLabel, ownedRef);
67 	}
68 
69 
70 	/** */
71 	public static GType getType()
72 	{
73 		return gtk_shortcut_label_get_type();
74 	}
75 
76 	/**
77 	 * Creates a new #GtkShortcutLabel with @accelerator set.
78 	 *
79 	 * Params:
80 	 *     accelerator = the initial accelerator
81 	 *
82 	 * Returns: a newly-allocated #GtkShortcutLabel
83 	 *
84 	 * Since: 3.22
85 	 *
86 	 * Throws: ConstructionException GTK+ fails to create the object.
87 	 */
88 	public this(string accelerator)
89 	{
90 		auto p = gtk_shortcut_label_new(Str.toStringz(accelerator));
91 
92 		if(p is null)
93 		{
94 			throw new ConstructionException("null returned by new");
95 		}
96 
97 		this(cast(GtkShortcutLabel*) p, true);
98 	}
99 
100 	/**
101 	 * Retrieves the current accelerator of @self.
102 	 *
103 	 * Returns: the current accelerator.
104 	 *
105 	 * Since: 3.22
106 	 */
107 	public string getAccelerator()
108 	{
109 		return Str.toString(gtk_shortcut_label_get_accelerator(gtkShortcutLabel));
110 	}
111 
112 	/**
113 	 * Retrieves the text that is displayed when no accelerator is set.
114 	 *
115 	 * Returns: the current text displayed when no
116 	 *     accelerator is set.
117 	 *
118 	 * Since: 3.22
119 	 */
120 	public string getDisabledText()
121 	{
122 		return Str.toString(gtk_shortcut_label_get_disabled_text(gtkShortcutLabel));
123 	}
124 
125 	/**
126 	 * Sets the accelerator to be displayed by @self.
127 	 *
128 	 * Params:
129 	 *     accelerator = the new accelerator
130 	 *
131 	 * Since: 3.22
132 	 */
133 	public void setAccelerator(string accelerator)
134 	{
135 		gtk_shortcut_label_set_accelerator(gtkShortcutLabel, Str.toStringz(accelerator));
136 	}
137 
138 	/**
139 	 * Sets the text to be displayed by @self when no accelerator is set.
140 	 *
141 	 * Params:
142 	 *     disabledText = the text to be displayed when no accelerator is set
143 	 *
144 	 * Since: 3.22
145 	 */
146 	public void setDisabledText(string disabledText)
147 	{
148 		gtk_shortcut_label_set_disabled_text(gtkShortcutLabel, Str.toStringz(disabledText));
149 	}
150 }