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 glib.c.functions;
30 private import gobject.ObjectG;
31 private import gtk.Widget;
32 private import gtk.c.functions;
33 public  import gtk.c.types;
34 
35 
36 /**
37  * `GtkShortcutLabel` displays a single keyboard shortcut or gesture.
38  * 
39  * The main use case for `GtkShortcutLabel` is inside a [class@Gtk.ShortcutsWindow].
40  */
41 public class ShortcutLabel : Widget
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(GtkWidget*)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 	 * Throws: ConstructionException GTK+ fails to create the object.
85 	 */
86 	public this(string accelerator)
87 	{
88 		auto __p = gtk_shortcut_label_new(Str.toStringz(accelerator));
89 
90 		if(__p is null)
91 		{
92 			throw new ConstructionException("null returned by new");
93 		}
94 
95 		this(cast(GtkShortcutLabel*) __p);
96 	}
97 
98 	/**
99 	 * Retrieves the current accelerator of @self.
100 	 *
101 	 * Returns: the current accelerator.
102 	 */
103 	public string getAccelerator()
104 	{
105 		return Str.toString(gtk_shortcut_label_get_accelerator(gtkShortcutLabel));
106 	}
107 
108 	/**
109 	 * Retrieves the text that is displayed when no accelerator is set.
110 	 *
111 	 * Returns: the current text displayed when no
112 	 *     accelerator is set.
113 	 */
114 	public string getDisabledText()
115 	{
116 		return Str.toString(gtk_shortcut_label_get_disabled_text(gtkShortcutLabel));
117 	}
118 
119 	/**
120 	 * Sets the accelerator to be displayed by @self.
121 	 *
122 	 * Params:
123 	 *     accelerator = the new accelerator
124 	 */
125 	public void setAccelerator(string accelerator)
126 	{
127 		gtk_shortcut_label_set_accelerator(gtkShortcutLabel, Str.toStringz(accelerator));
128 	}
129 
130 	/**
131 	 * Sets the text to be displayed by @self when no accelerator is set.
132 	 *
133 	 * Params:
134 	 *     disabledText = the text to be displayed when no accelerator is set
135 	 */
136 	public void setDisabledText(string disabledText)
137 	{
138 		gtk_shortcut_label_set_disabled_text(gtkShortcutLabel, Str.toStringz(disabledText));
139 	}
140 }