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  * An interface used for objects which implement linking between
72  * multiple resource or content locations, or multiple 'markers'
73  * within a single document. A Hypertext instance is associated with
74  * one or more Hyperlinks, which are associated with particular
75  * offsets within the Hypertext's included content. While this
76  * interface is derived from Text, there is no requirement that
77  * Hypertext instances have textual content; they may implement Image
78  * as well, and Hyperlinks need not have non-zero text offsets.
79  */
80 public class Hypertext
81 {
82 	
83 	/** the main Gtk struct */
84 	protected AtkHypertext* atkHypertext;
85 	
86 	
87 	public AtkHypertext* getHypertextStruct()
88 	{
89 		return atkHypertext;
90 	}
91 	
92 	
93 	/** the main Gtk struct as a void* */
94 	protected void* getStruct()
95 	{
96 		return cast(void*)atkHypertext;
97 	}
98 	
99 	/**
100 	 * Sets our main struct and passes it to the parent class
101 	 */
102 	public this (AtkHypertext* atkHypertext)
103 	{
104 		this.atkHypertext = atkHypertext;
105 	}
106 	
107 	/**
108 	 */
109 	int[string] connectedSignals;
110 	
111 	void delegate(gint, Hypertext)[] onLinkSelectedListeners;
112 	/**
113 	 * The "link-selected" signal is emitted by an AtkHyperText
114 	 * object when one of the hyperlinks associated with the object
115 	 * is selected.
116 	 */
117 	void addOnLinkSelected(void delegate(gint, Hypertext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
118 	{
119 		if ( !("link-selected" in connectedSignals) )
120 		{
121 			Signals.connectData(
122 			getStruct(),
123 			"link-selected",
124 			cast(GCallback)&callBackLinkSelected,
125 			cast(void*)this,
126 			null,
127 			connectFlags);
128 			connectedSignals["link-selected"] = 1;
129 		}
130 		onLinkSelectedListeners ~= dlg;
131 	}
132 	extern(C) static void callBackLinkSelected(AtkHypertext* atkhypertextStruct, gint arg1, Hypertext _hypertext)
133 	{
134 		foreach ( void delegate(gint, Hypertext) dlg ; _hypertext.onLinkSelectedListeners )
135 		{
136 			dlg(arg1, _hypertext);
137 		}
138 	}
139 	
140 	
141 	/**
142 	 * Gets the link in this hypertext document at index
143 	 * link_index
144 	 * Params:
145 	 * linkIndex = an integer specifying the desired link
146 	 * Returns: the link in this hypertext document at index link_index. [transfer none]
147 	 */
148 	public Hyperlink getLink(int linkIndex)
149 	{
150 		// AtkHyperlink * atk_hypertext_get_link (AtkHypertext *hypertext,  gint link_index);
151 		auto p = atk_hypertext_get_link(atkHypertext, linkIndex);
152 		
153 		if(p is null)
154 		{
155 			return null;
156 		}
157 		
158 		return ObjectG.getDObject!(Hyperlink)(cast(AtkHyperlink*) p);
159 	}
160 	
161 	/**
162 	 * Gets the number of links within this hypertext document.
163 	 * Returns: the number of links within this hypertext document
164 	 */
165 	public int getNLinks()
166 	{
167 		// gint atk_hypertext_get_n_links (AtkHypertext *hypertext);
168 		return atk_hypertext_get_n_links(atkHypertext);
169 	}
170 	
171 	/**
172 	 * Gets the index into the array of hyperlinks that is associated with
173 	 * the character specified by char_index.
174 	 * Params:
175 	 * charIndex = a character index
176 	 * 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.
177 	 */
178 	public int getLinkIndex(int charIndex)
179 	{
180 		// gint atk_hypertext_get_link_index (AtkHypertext *hypertext,  gint char_index);
181 		return atk_hypertext_get_link_index(atkHypertext, charIndex);
182 	}
183 }