alternative to assert
[gtkD.git] / gtkD / src / atk / Hypertext.d
blob358fd86a425906c44a3b06ea1390f8d6c818e34b
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = AtkHypertext.html
26 * outPack = atk
27 * outFile = Hypertext
28 * strct = AtkHypertext
29 * realStrct=
30 * ctorStrct=
31 * clss = Hypertext
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - atk_hypertext
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * structWrap:
45 * module aliases:
46 * local aliases:
49 module atk.Hypertext;
51 version(noAssert)
53 version(Tango)
55 import tango.io.Stdout; // use the tango loging?
59 private import gtkc.atktypes;
61 private import gtkc.atk;
68 /**
69 * Description
70 * An interface used for objects which implement linking between multiple
71 * resource or content locations, or multiple 'markers' within a single
72 * document. A Hypertext instance is associated with one or more Hyperlinks,
73 * which are associated with particular offsets within the Hypertext's included
74 * 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.
76 public class Hypertext
79 /** the main Gtk struct */
80 protected AtkHypertext* atkHypertext;
83 public AtkHypertext* getHypertextStruct()
85 return atkHypertext;
89 /** the main Gtk struct as a void* */
90 protected void* getStruct()
92 return cast(void*)atkHypertext;
95 /**
96 * Sets our main struct and passes it to the parent class
98 public this (AtkHypertext* atkHypertext)
100 version(noAssert)
102 if ( atkHypertext is null )
104 int zero = 0;
105 version(Tango)
107 Stdout("struct atkHypertext is null on constructor").newline;
109 else
111 printf("struct atkHypertext is null on constructor");
113 zero = zero / zero;
116 else
118 assert(atkHypertext !is null, "struct atkHypertext is null on constructor");
120 this.atkHypertext = atkHypertext;
126 // imports for the signal processing
127 private import gobject.Signals;
128 private import gtkc.gdktypes;
129 int[char[]] connectedSignals;
131 void delegate(gint, Hypertext)[] onLinkSelectedListeners;
132 void addOnLinkSelected(void delegate(gint, Hypertext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
134 if ( !("link-selected" in connectedSignals) )
136 Signals.connectData(
137 getStruct(),
138 "link-selected",
139 cast(GCallback)&callBackLinkSelected,
140 cast(void*)this,
141 null,
142 connectFlags);
143 connectedSignals["link-selected"] = 1;
145 onLinkSelectedListeners ~= dlg;
147 extern(C) static void callBackLinkSelected(AtkHypertext* atkhypertextStruct, gint arg1, Hypertext hypertext)
149 bool consumed = false;
151 foreach ( void delegate(gint, Hypertext) dlg ; hypertext.onLinkSelectedListeners )
153 dlg(arg1, hypertext);
156 return consumed;
162 * Gets the link in this hypertext document at index
163 * link_index
164 * hypertext:
165 * an AtkHypertext
166 * link_index:
167 * an integer specifying the desired link
168 * Returns:
169 * the link in this hypertext document at
170 * index link_index
172 public AtkHyperlink* _GetLink(int linkIndex)
174 // AtkHyperlink* atk_hypertext_get_link (AtkHypertext *hypertext, gint link_index);
175 return atk_hypertext_get_link(atkHypertext, linkIndex);
179 * Gets the number of links within this hypertext document.
180 * hypertext:
181 * an AtkHypertext
182 * Returns:
183 * the number of links within this hypertext document
185 public int _GetNLinks()
187 // gint atk_hypertext_get_n_links (AtkHypertext *hypertext);
188 return atk_hypertext_get_n_links(atkHypertext);
192 * Gets the index into the array of hyperlinks that is associated with
193 * the character specified by char_index.
194 * hypertext:
195 * an AtkHypertext
196 * char_index:
197 * a character index
198 * Returns:
199 * an index into the array of hyperlinks in hypertext,
200 * or -1 if there is no hyperlink associated with this character.
201 * Signal Details
202 * The "link-selected" signal
203 * void user_function (AtkHypertext *atkhypertext,
204 * gint arg1,
205 * gpointer user_data) : Run Last
206 * The "link-selected" signal is emitted by an AtkHyperText object when one of
207 * the hyperlinks associated with the object is selected.
208 * atkhypertext:
209 * the object which received the signal.
210 * arg1:
211 * the index of the hyperlink which is selected
212 * user_data:
213 * user data set when the signal handler was connected.
214 * See Also
215 * AtkHyperlink
217 public int _GetLinkIndex(int charIndex)
219 // gint atk_hypertext_get_link_index (AtkHypertext *hypertext, gint char_index);
220 return atk_hypertext_get_link_index(atkHypertext, charIndex);