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  * Conversion parameters:
26  * inFile  = GtkLinkButton.html
27  * outPack = gtk
28  * outFile = LinkButton
29  * strct   = GtkLinkButton
30  * realStrct=
31  * ctorStrct=
32  * clss    = LinkButton
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_link_button_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gtk.Widget
49  * structWrap:
50  * 	- GtkWidget* -> Widget
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gtk.LinkButton;
57 
58 public  import gtkc.gtktypes;
59 
60 private import gtkc.gtk;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 
65 private import glib.Str;
66 private import gtk.Widget;
67 
68 
69 
70 private import gtk.Button;
71 
72 /**
73  * Description
74  * A GtkLinkButton is a GtkButton with a hyperlink, similar to the one
75  * used by web browsers, which triggers an action when clicked. It is useful
76  * to show quick links to resources.
77  * A link button is created by calling either gtk_link_button_new() or
78  * gtk_link_button_new_with_label(). If using the former, the URI you pass
79  * to the constructor is used as a label for the widget.
80  * The URI bound to a GtkLinkButton can be set specifically using
81  * gtk_link_button_set_uri(), and retrieved using gtk_link_button_get_uri().
82  * GtkLinkButton offers a global hook, which is called when the used clicks
83  * on it: see gtk_link_button_set_uri_hook().
84  * GtkLinkButton was added in GTK+ 2.10.
85  */
86 public class LinkButton : Button
87 {
88 	
89 	/** the main Gtk struct */
90 	protected GtkLinkButton* gtkLinkButton;
91 	
92 	
93 	public GtkLinkButton* getLinkButtonStruct()
94 	{
95 		return gtkLinkButton;
96 	}
97 	
98 	
99 	/** the main Gtk struct as a void* */
100 	protected override void* getStruct()
101 	{
102 		return cast(void*)gtkLinkButton;
103 	}
104 	
105 	/**
106 	 * Sets our main struct and passes it to the parent class
107 	 */
108 	public this (GtkLinkButton* gtkLinkButton)
109 	{
110 		super(cast(GtkButton*)gtkLinkButton);
111 		this.gtkLinkButton = gtkLinkButton;
112 	}
113 	
114 	protected override void setStruct(GObject* obj)
115 	{
116 		super.setStruct(obj);
117 		gtkLinkButton = cast(GtkLinkButton*)obj;
118 	}
119 	
120 	/**
121 	 */
122 	
123 	/**
124 	 * Creates a new GtkLinkButton with the URI as its text.
125 	 * Since 2.10
126 	 * Params:
127 	 * uri = a valid URI
128 	 * Throws: ConstructionException GTK+ fails to create the object.
129 	 */
130 	public this (string uri)
131 	{
132 		// GtkWidget * gtk_link_button_new (const gchar *uri);
133 		auto p = gtk_link_button_new(Str.toStringz(uri));
134 		if(p is null)
135 		{
136 			throw new ConstructionException("null returned by gtk_link_button_new(Str.toStringz(uri))");
137 		}
138 		this(cast(GtkLinkButton*) p);
139 	}
140 	
141 	/**
142 	 * Creates a new GtkLinkButton containing a label.
143 	 * Since 2.10
144 	 * Params:
145 	 * uri = a valid URI
146 	 * label = the text of the button. [allow-none]
147 	 * Throws: ConstructionException GTK+ fails to create the object.
148 	 */
149 	public this (string uri, string label)
150 	{
151 		// GtkWidget * gtk_link_button_new_with_label (const gchar *uri,  const gchar *label);
152 		auto p = gtk_link_button_new_with_label(Str.toStringz(uri), Str.toStringz(label));
153 		if(p is null)
154 		{
155 			throw new ConstructionException("null returned by gtk_link_button_new_with_label(Str.toStringz(uri), Str.toStringz(label))");
156 		}
157 		this(cast(GtkLinkButton*) p);
158 	}
159 	
160 	/**
161 	 * Retrieves the URI set using gtk_link_button_set_uri().
162 	 * Since 2.10
163 	 * Returns: a valid URI. The returned string is owned by the link button and should not be modified or freed.
164 	 */
165 	public string getUri()
166 	{
167 		// const gchar * gtk_link_button_get_uri (GtkLinkButton *link_button);
168 		return Str.toString(gtk_link_button_get_uri(gtkLinkButton));
169 	}
170 	
171 	/**
172 	 * Sets uri as the URI where the GtkLinkButton points. As a side-effect
173 	 * this unsets the 'visited' state of the button.
174 	 * Since 2.10
175 	 * Params:
176 	 * uri = a valid URI
177 	 */
178 	public void setUri(string uri)
179 	{
180 		// void gtk_link_button_set_uri (GtkLinkButton *link_button,  const gchar *uri);
181 		gtk_link_button_set_uri(gtkLinkButton, Str.toStringz(uri));
182 	}
183 	
184 	/**
185 	 * Warning
186 	 * gtk_link_button_set_uri_hook has been deprecated since version 2.24 and should not be used in newly-written code. Use the "clicked" signal instead
187 	 * Sets func as the function that should be invoked every time a user clicks
188 	 * a GtkLinkButton. This function is called before every callback registered
189 	 * for the "clicked" signal.
190 	 * If no uri hook has been set, GTK+ defaults to calling gtk_show_uri().
191 	 * Since 2.10
192 	 * Params:
193 	 * func = a function called each time a GtkLinkButton is clicked, or NULL. [allow-none]
194 	 * data = user data to be passed to func, or NULL. [allow-none]
195 	 * destroy = a GDestroyNotify that gets called when data is no longer needed, or NULL. [allow-none]
196 	 * Returns: the previously set hook function.
197 	 */
198 	public static GtkLinkButtonUriFunc setUriHook(GtkLinkButtonUriFunc func, void* data, GDestroyNotify destroy)
199 	{
200 		// GtkLinkButtonUriFunc gtk_link_button_set_uri_hook (GtkLinkButtonUriFunc func,  gpointer data,  GDestroyNotify destroy);
201 		return gtk_link_button_set_uri_hook(func, data, destroy);
202 	}
203 	
204 	/**
205 	 * Retrieves the 'visited' state of the URI where the GtkLinkButton
206 	 * points. The button becomes visited when it is clicked. If the URI
207 	 * is changed on the button, the 'visited' state is unset again.
208 	 * The state may also be changed using gtk_link_button_set_visited().
209 	 * Since 2.14
210 	 * Returns: TRUE if the link has been visited, FALSE otherwise
211 	 */
212 	public int getVisited()
213 	{
214 		// gboolean gtk_link_button_get_visited (GtkLinkButton *link_button);
215 		return gtk_link_button_get_visited(gtkLinkButton);
216 	}
217 	
218 	/**
219 	 * Sets the 'visited' state of the URI where the GtkLinkButton
220 	 * points. See gtk_link_button_get_visited() for more details.
221 	 * Since 2.14
222 	 * Params:
223 	 * visited = the new 'visited' state
224 	 */
225 	public void setVisited(int visited)
226 	{
227 		// void gtk_link_button_set_visited (GtkLinkButton *link_button,  gboolean visited);
228 		gtk_link_button_set_visited(gtkLinkButton, visited);
229 	}
230 }