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