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