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 private import atk.Hyperlink;
65 
66 
67 
68 /**
69  * An interface used for objects which implement linking between
70  * multiple resource or content locations, or multiple 'markers'
71  * within a single document. A Hypertext instance is associated with
72  * one or more Hyperlinks, which are associated with particular
73  * offsets within the Hypertext's included content. While this
74  * interface is derived from Text, there is no requirement that
75  * Hypertext instances have textual content; they may implement Image
76  * 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 	/** Get the main Gtk struct */
86 	public AtkHypertext* getHypertextStruct()
87 	{
88 		return atkHypertext;
89 	}
90 	
91 	
92 	/** the main Gtk struct as a void* */
93 	protected void* getStruct()
94 	{
95 		return cast(void*)atkHypertext;
96 	}
97 	
98 	/**
99 	 * Sets our main struct and passes it to the parent class
100 	 */
101 	public this (AtkHypertext* atkHypertext)
102 	{
103 		this.atkHypertext = atkHypertext;
104 	}
105 	
106 	/**
107 	 */
108 	int[string] connectedSignals;
109 	
110 	void delegate(gint, Hypertext)[] onLinkSelectedListeners;
111 	/**
112 	 * The "link-selected" signal is emitted by an AtkHyperText
113 	 * object when one of the hyperlinks associated with the object
114 	 * is selected.
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 }