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  = AtkHypertext.html
27  * outPack = atk
28  * outFile = Hypertext
29  * strct   = AtkHypertext
30  * realStrct=
31  * ctorStrct=
32  * clss    = Hypertext
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- atk_hypertext_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- atk.Hyperlink
47  * structWrap:
48  * 	- AtkHyperlink* -> Hyperlink
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module atk.Hypertext;
55 
56 public  import gtkc.atktypes;
57 
58 private import gtkc.atk;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 private import gobject.Signals;
63 public  import gtkc.gdktypes;
64 
65 private import atk.Hyperlink;
66 
67 
68 
69 
70 /**
71  * Description
72  * An interface used for objects which implement linking between multiple
73  * resource or content locations, or multiple 'markers' within a single
74  * document. A Hypertext instance is associated with one or more Hyperlinks,
75  * which are associated with particular offsets within the Hypertext's included
76  * content. While this interface is derived from Text, there is no requirement that Hypertext instances have textual content; they may implement Image as well, and Hyperlinks need not have non-zero text offsets.
77  */
78 public class Hypertext
79 {
80 	
81 	/** the main Gtk struct */
82 	protected AtkHypertext* atkHypertext;
83 	
84 	
85 	public AtkHypertext* getHypertextStruct()
86 	{
87 		return atkHypertext;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected void* getStruct()
93 	{
94 		return cast(void*)atkHypertext;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (AtkHypertext* atkHypertext)
101 	{
102 		this.atkHypertext = atkHypertext;
103 	}
104 	
105 	/**
106 	 */
107 	int[string] connectedSignals;
108 	
109 	void delegate(gint, Hypertext)[] onLinkSelectedListeners;
110 	/**
111 	 * The "link-selected" signal is emitted by an AtkHyperText object when one of
112 	 * the hyperlinks associated with the object is selected.
113 	 * See Also
114 	 * AtkHyperlink
115 	 */
116 	void addOnLinkSelected(void delegate(gint, Hypertext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
117 	{
118 		if ( !("link-selected" in connectedSignals) )
119 		{
120 			Signals.connectData(
121 			getStruct(),
122 			"link-selected",
123 			cast(GCallback)&callBackLinkSelected,
124 			cast(void*)this,
125 			null,
126 			connectFlags);
127 			connectedSignals["link-selected"] = 1;
128 		}
129 		onLinkSelectedListeners ~= dlg;
130 	}
131 	extern(C) static void callBackLinkSelected(AtkHypertext* atkhypertextStruct, gint arg1, Hypertext _hypertext)
132 	{
133 		foreach ( void delegate(gint, Hypertext) dlg ; _hypertext.onLinkSelectedListeners )
134 		{
135 			dlg(arg1, _hypertext);
136 		}
137 	}
138 	
139 	
140 	/**
141 	 * Gets the link in this hypertext document at index
142 	 * link_index
143 	 * Params:
144 	 * linkIndex = an integer specifying the desired link
145 	 * Returns: the link in this hypertext document at index link_index. [transfer none]
146 	 */
147 	public Hyperlink getLink(int linkIndex)
148 	{
149 		// AtkHyperlink * atk_hypertext_get_link (AtkHypertext *hypertext,  gint link_index);
150 		auto p = atk_hypertext_get_link(atkHypertext, linkIndex);
151 		
152 		if(p is null)
153 		{
154 			return null;
155 		}
156 		
157 		return ObjectG.getDObject!(Hyperlink)(cast(AtkHyperlink*) p);
158 	}
159 	
160 	/**
161 	 * Gets the number of links within this hypertext document.
162 	 * Returns: the number of links within this hypertext document
163 	 */
164 	public int getNLinks()
165 	{
166 		// gint atk_hypertext_get_n_links (AtkHypertext *hypertext);
167 		return atk_hypertext_get_n_links(atkHypertext);
168 	}
169 	
170 	/**
171 	 * Gets the index into the array of hyperlinks that is associated with
172 	 * the character specified by char_index.
173 	 * Params:
174 	 * charIndex = a character index
175 	 * Returns: an index into the array of hyperlinks in hypertext, or -1 if there is no hyperlink associated with this character. Signal Details The "link-selected" signal void user_function (AtkHypertext *atkhypertext, gint arg1, gpointer user_data) : Run Last The "link-selected" signal is emitted by an AtkHyperText object when one of the hyperlinks associated with the object is selected.
176 	 */
177 	public int getLinkIndex(int charIndex)
178 	{
179 		// gint atk_hypertext_get_link_index (AtkHypertext *hypertext,  gint char_index);
180 		return atk_hypertext_get_link_index(atkHypertext, charIndex);
181 	}
182 }