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  = AtkHyperlink.html
27  * outPack = atk
28  * outFile = Hyperlink
29  * strct   = AtkHyperlink
30  * realStrct=
31  * ctorStrct=
32  * clss    = Hyperlink
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- atk_hyperlink_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- atk.ObjectAtk
47  * 	- glib.Str
48  * structWrap:
49  * 	- AtkObject* -> ObjectAtk
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module atk.Hyperlink;
56 
57 public  import gtkc.atktypes;
58 
59 private import gtkc.atk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 private import gobject.Signals;
64 public  import gtkc.gdktypes;
65 
66 private import atk.ObjectAtk;
67 private import glib.Str;
68 
69 
70 
71 private import gobject.ObjectG;
72 
73 /**
74  * Description
75  * An ATK object which encapsulates a link or set of links
76  * (for instance in the case of client-side image maps) in a hypertext document.
77  * It may implement the AtkAction interface. AtkHyperlink may also be used
78  * to refer to inline embedded content, since it allows specification of a start
79  * and end offset within the host AtkHypertext object.
80  */
81 public class Hyperlink : ObjectG
82 {
83 	
84 	/** the main Gtk struct */
85 	protected AtkHyperlink* atkHyperlink;
86 	
87 	
88 	public AtkHyperlink* getHyperlinkStruct()
89 	{
90 		return atkHyperlink;
91 	}
92 	
93 	
94 	/** the main Gtk struct as a void* */
95 	protected override void* getStruct()
96 	{
97 		return cast(void*)atkHyperlink;
98 	}
99 	
100 	/**
101 	 * Sets our main struct and passes it to the parent class
102 	 */
103 	public this (AtkHyperlink* atkHyperlink)
104 	{
105 		super(cast(GObject*)atkHyperlink);
106 		this.atkHyperlink = atkHyperlink;
107 	}
108 	
109 	protected override void setStruct(GObject* obj)
110 	{
111 		super.setStruct(obj);
112 		atkHyperlink = cast(AtkHyperlink*)obj;
113 	}
114 	
115 	/**
116 	 */
117 	int[string] connectedSignals;
118 	
119 	void delegate(Hyperlink)[] onLinkActivatedListeners;
120 	/**
121 	 * The signal link-activated is emitted when a link is activated.
122 	 */
123 	void addOnLinkActivated(void delegate(Hyperlink) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
124 	{
125 		if ( !("link-activated" in connectedSignals) )
126 		{
127 			Signals.connectData(
128 			getStruct(),
129 			"link-activated",
130 			cast(GCallback)&callBackLinkActivated,
131 			cast(void*)this,
132 			null,
133 			connectFlags);
134 			connectedSignals["link-activated"] = 1;
135 		}
136 		onLinkActivatedListeners ~= dlg;
137 	}
138 	extern(C) static void callBackLinkActivated(AtkHyperlink* atkhyperlinkStruct, Hyperlink _hyperlink)
139 	{
140 		foreach ( void delegate(Hyperlink) dlg ; _hyperlink.onLinkActivatedListeners )
141 		{
142 			dlg(_hyperlink);
143 		}
144 	}
145 	
146 	
147 	/**
148 	 * Get a the URI associated with the anchor specified
149 	 * by i of link_.
150 	 * Multiple anchors are primarily used by client-side image maps.
151 	 * Params:
152 	 * i = a (zero-index) integer specifying the desired anchor
153 	 * Returns: a string specifying the URI
154 	 */
155 	public string getUri(int i)
156 	{
157 		// gchar * atk_hyperlink_get_uri (AtkHyperlink *link_,  gint i);
158 		return Str.toString(atk_hyperlink_get_uri(atkHyperlink, i));
159 	}
160 	
161 	/**
162 	 * Returns the item associated with this hyperlinks nth anchor.
163 	 * For instance, the returned AtkObject will implement AtkText
164 	 * if link_ is a text hyperlink, AtkImage if link_ is an image
165 	 * hyperlink etc.
166 	 * Multiple anchors are primarily used by client-side image maps.
167 	 * Params:
168 	 * i = a (zero-index) integer specifying the desired anchor
169 	 * Returns: an AtkObject associated with this hyperlinks i-th anchor. [transfer none]
170 	 */
171 	public ObjectAtk getObject(int i)
172 	{
173 		// AtkObject * atk_hyperlink_get_object (AtkHyperlink *link_,  gint i);
174 		auto p = atk_hyperlink_get_object(atkHyperlink, i);
175 		
176 		if(p is null)
177 		{
178 			return null;
179 		}
180 		
181 		return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p);
182 	}
183 	
184 	/**
185 	 * Gets the index with the hypertext document at which this link ends.
186 	 * Returns: the index with the hypertext document at which this link ends
187 	 */
188 	public int getEndIndex()
189 	{
190 		// gint atk_hyperlink_get_end_index (AtkHyperlink *link_);
191 		return atk_hyperlink_get_end_index(atkHyperlink);
192 	}
193 	
194 	/**
195 	 * Gets the index with the hypertext document at which this link begins.
196 	 * Returns: the index with the hypertext document at which this link begins
197 	 */
198 	public int getStartIndex()
199 	{
200 		// gint atk_hyperlink_get_start_index (AtkHyperlink *link_);
201 		return atk_hyperlink_get_start_index(atkHyperlink);
202 	}
203 	
204 	/**
205 	 * Since the document that a link is associated with may have changed
206 	 * this method returns TRUE if the link is still valid (with
207 	 * respect to the document it references) and FALSE otherwise.
208 	 * Returns: whether or not this link is still valid
209 	 */
210 	public int isValid()
211 	{
212 		// gboolean atk_hyperlink_is_valid (AtkHyperlink *link_);
213 		return atk_hyperlink_is_valid(atkHyperlink);
214 	}
215 	
216 	/**
217 	 * Indicates whether the link currently displays some or all of its
218 	 *  content inline. Ordinary HTML links will usually return
219 	 *  FALSE, but an inline lt;srcgt; HTML element will return
220 	 *  TRUE.
221 	 * a *
222 	 * Returns: whether or not this link displays its content inline.
223 	 */
224 	public int isInline()
225 	{
226 		// gboolean atk_hyperlink_is_inline (AtkHyperlink *link_);
227 		return atk_hyperlink_is_inline(atkHyperlink);
228 	}
229 	
230 	/**
231 	 * Gets the number of anchors associated with this hyperlink.
232 	 * Returns: the number of anchors associated with this hyperlink
233 	 */
234 	public int getNAnchors()
235 	{
236 		// gint atk_hyperlink_get_n_anchors (AtkHyperlink *link_);
237 		return atk_hyperlink_get_n_anchors(atkHyperlink);
238 	}
239 	
240 	/**
241 	 * Warning
242 	 * atk_hyperlink_is_selected_link is deprecated and should not be used in newly-written code. Please use ATK_STATE_SELECTED to indicate when a hyperlink within a Hypertext container is selected.
243 	 * Determines whether this AtkHyperlink is selected
244 	 * Since 1.4
245 	 * Returns: True is the AtkHyperlink is selected, False otherwise
246 	 */
247 	public int isSelectedLink()
248 	{
249 		// gboolean atk_hyperlink_is_selected_link (AtkHyperlink *link_);
250 		return atk_hyperlink_is_selected_link(atkHyperlink);
251 	}
252 }