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  = AtkDocument.html
27  * outPack = atk
28  * outFile = Document
29  * strct   = AtkDocument
30  * realStrct=
31  * ctorStrct=
32  * clss    = Document
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- atk_document_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module atk.Document;
54 
55 public  import gtkc.atktypes;
56 
57 private import gtkc.atk;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 private import gobject.Signals;
62 public  import gtkc.gdktypes;
63 
64 private import glib.Str;
65 
66 
67 
68 
69 /**
70  * The AtkDocument interface should be supported by any object whose
71  * content is a representation or view of a document. The AtkDocument
72  * interface should appear on the toplevel container for the document
73  * content; however AtkDocument instances may be nested (i.e. an
74  * AtkDocument may be a descendant of another AtkDocument) in those
75  * cases where one document contains "embedded content" which can
76  * reasonably be considered a document in its own right.
77  */
78 public class Document
79 {
80 	
81 	/** the main Gtk struct */
82 	protected AtkDocument* atkDocument;
83 	
84 	
85 	public AtkDocument* getDocumentStruct()
86 	{
87 		return atkDocument;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected void* getStruct()
93 	{
94 		return cast(void*)atkDocument;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (AtkDocument* atkDocument)
101 	{
102 		this.atkDocument = atkDocument;
103 	}
104 	
105 	/**
106 	 */
107 	int[string] connectedSignals;
108 	
109 	void delegate(Document)[] onLoadCompleteListeners;
110 	/**
111 	 * The 'load-complete' signal is emitted when a pending load of
112 	 * a static document has completed. This signal is to be
113 	 * expected by ATK clients if and when AtkDocument implementors
114 	 * expose ATK_STATE_BUSY. If the state of an AtkObject which
115 	 * implements AtkDocument does not include ATK_STATE_BUSY, it
116 	 * should be safe for clients to assume that the AtkDocument's
117 	 * static contents are fully loaded into the container.
118 	 * (Dynamic document contents should be exposed via other
119 	 * signals.)
120 	 */
121 	void addOnLoadComplete(void delegate(Document) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
122 	{
123 		if ( !("load-complete" in connectedSignals) )
124 		{
125 			Signals.connectData(
126 			getStruct(),
127 			"load-complete",
128 			cast(GCallback)&callBackLoadComplete,
129 			cast(void*)this,
130 			null,
131 			connectFlags);
132 			connectedSignals["load-complete"] = 1;
133 		}
134 		onLoadCompleteListeners ~= dlg;
135 	}
136 	extern(C) static void callBackLoadComplete(AtkDocument* atkdocumentStruct, Document _document)
137 	{
138 		foreach ( void delegate(Document) dlg ; _document.onLoadCompleteListeners )
139 		{
140 			dlg(_document);
141 		}
142 	}
143 	
144 	void delegate(Document)[] onLoadStoppedListeners;
145 	/**
146 	 * The 'load-stopped' signal is emitted when a pending load of
147 	 * document contents is cancelled, paused, or otherwise
148 	 * interrupted by the user or application logic. It should not
149 	 * however be emitted while waiting for a resource (for instance
150 	 * while blocking on a file or network read) unless a
151 	 * user-significant timeout has occurred.
152 	 */
153 	void addOnLoadStopped(void delegate(Document) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
154 	{
155 		if ( !("load-stopped" in connectedSignals) )
156 		{
157 			Signals.connectData(
158 			getStruct(),
159 			"load-stopped",
160 			cast(GCallback)&callBackLoadStopped,
161 			cast(void*)this,
162 			null,
163 			connectFlags);
164 			connectedSignals["load-stopped"] = 1;
165 		}
166 		onLoadStoppedListeners ~= dlg;
167 	}
168 	extern(C) static void callBackLoadStopped(AtkDocument* atkdocumentStruct, Document _document)
169 	{
170 		foreach ( void delegate(Document) dlg ; _document.onLoadStoppedListeners )
171 		{
172 			dlg(_document);
173 		}
174 	}
175 	
176 	void delegate(Document)[] onReloadListeners;
177 	/**
178 	 * The 'reload' signal is emitted when the contents of a
179 	 * document is refreshed from its source. Once 'reload' has
180 	 * been emitted, a matching 'load-complete' or 'load-stopped'
181 	 * signal should follow, which clients may await before
182 	 * interrogating ATK for the latest document content.
183 	 */
184 	void addOnReload(void delegate(Document) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
185 	{
186 		if ( !("reload" in connectedSignals) )
187 		{
188 			Signals.connectData(
189 			getStruct(),
190 			"reload",
191 			cast(GCallback)&callBackReload,
192 			cast(void*)this,
193 			null,
194 			connectFlags);
195 			connectedSignals["reload"] = 1;
196 		}
197 		onReloadListeners ~= dlg;
198 	}
199 	extern(C) static void callBackReload(AtkDocument* atkdocumentStruct, Document _document)
200 	{
201 		foreach ( void delegate(Document) dlg ; _document.onReloadListeners )
202 		{
203 			dlg(_document);
204 		}
205 	}
206 	
207 	
208 	/**
209 	 * Gets a string indicating the document type.
210 	 * Returns: a string indicating the document type
211 	 */
212 	public string getDocumentType()
213 	{
214 		// const gchar * atk_document_get_document_type (AtkDocument *document);
215 		return Str.toString(atk_document_get_document_type(atkDocument));
216 	}
217 	
218 	/**
219 	 * Gets a gpointer that points to an instance of the DOM. It is
220 	 * up to the caller to check atk_document_get_type to determine
221 	 * how to cast this pointer.
222 	 * Returns: a gpointer that points to an instance of the DOM. [transfer none]
223 	 */
224 	public void* getDocument()
225 	{
226 		// gpointer atk_document_get_document (AtkDocument *document);
227 		return atk_document_get_document(atkDocument);
228 	}
229 	
230 	/**
231 	 * Since 1.12
232 	 * Params:
233 	 * attributeName = a character string representing the name of the attribute
234 	 * whose value is being queried.
235 	 * Returns: a string value associated with the named attribute for this document, or NULL if a value for attribute_name has not been specified for this document. Virtual: get_document_attribute_value
236 	 */
237 	public string getAttributeValue(string attributeName)
238 	{
239 		// const gchar * atk_document_get_attribute_value (AtkDocument *document,  const gchar *attribute_name);
240 		return Str.toString(atk_document_get_attribute_value(atkDocument, Str.toStringz(attributeName)));
241 	}
242 	
243 	/**
244 	 * Since 1.12
245 	 * Params:
246 	 * attributeName = a character string representing the name of the attribute
247 	 * whose value is being set.
248 	 * attributeValue = a string value to be associated with attribute_name.
249 	 * Returns: TRUE if value is successfully associated with attribute_name for this document, FALSE otherwise (e.g. if the document does not allow the attribute to be modified). Virtual: set_document_attribute
250 	 */
251 	public int setAttributeValue(string attributeName, string attributeValue)
252 	{
253 		// gboolean atk_document_set_attribute_value (AtkDocument *document,  const gchar *attribute_name,  const gchar *attribute_value);
254 		return atk_document_set_attribute_value(atkDocument, Str.toStringz(attributeName), Str.toStringz(attributeValue));
255 	}
256 	
257 	/**
258 	 * Gets an AtkAttributeSet which describes document-wide
259 	 *  attributes as name-value pairs.
260 	 * Since 1.12
261 	 * Returns: An AtkAttributeSet containing the explicitly set name-value-pair attributes associated with this document as a whole. Virtual: get_document_attributes. [transfer none]
262 	 */
263 	public AtkAttributeSet* getAttributes()
264 	{
265 		// AtkAttributeSet * atk_document_get_attributes (AtkDocument *document);
266 		return atk_document_get_attributes(atkDocument);
267 	}
268 	
269 	/**
270 	 * Warning
271 	 * atk_document_get_locale is deprecated and should not be used in newly-written code. This method is deprecated since ATK version
272 	 * 2.7.90. Please use atk_object_get_object_locale() instead.
273 	 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale
274 	 *  of the content of this document instance. Individual
275 	 *  text substrings or images within this document may have
276 	 *  a different locale, see atk_text_get_attributes and
277 	 *  atk_image_get_image_locale.
278 	 * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES locale of the document content as a whole, or NULL if the document content does not specify a locale. Virtual: get_document_locale Signal Details The "load-complete" signal void user_function (AtkDocument *atkdocument, gpointer user_data) : Run Last The 'load-complete' signal is emitted when a pending load of a static document has completed. This signal is to be expected by ATK clients if and when AtkDocument implementors expose ATK_STATE_BUSY. If the state of an AtkObject which implements AtkDocument does not include ATK_STATE_BUSY, it should be safe for clients to assume that the AtkDocument's static contents are fully loaded into the container. (Dynamic document contents should be exposed via other signals.)
279 	 */
280 	public string getLocale()
281 	{
282 		// const gchar * atk_document_get_locale (AtkDocument *document);
283 		return Str.toString(atk_document_get_locale(atkDocument));
284 	}
285 }