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  * Description
71  * The AtkDocument interface should be supported by any object whose content is a
72  * representation or view of a document. The AtkDocument interface should appear
73  * on the toplevel container for the document content; however AtkDocument
74  * instances may be nested (i.e. an AtkDocument may be a descendant of another
75  * AtkDocument) in those cases where one document contains "embedded content"
76  * which can 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 a static
112 	 * document has completed. This signal is to be expected by ATK clients
113 	 * if and when AtkDocument implementors expose ATK_STATE_BUSY. If the state
114 	 * of an AtkObject which implements AtkDocument does not include ATK_STATE_BUSY,
115 	 * it should be safe for clients to assume that the AtkDocument's static contents
116 	 * are fully loaded into the container. (Dynamic document contents should
117 	 * be exposed via other signals.)
118 	 */
119 	void addOnLoadComplete(void delegate(Document) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
120 	{
121 		if ( !("load-complete" in connectedSignals) )
122 		{
123 			Signals.connectData(
124 			getStruct(),
125 			"load-complete",
126 			cast(GCallback)&callBackLoadComplete,
127 			cast(void*)this,
128 			null,
129 			connectFlags);
130 			connectedSignals["load-complete"] = 1;
131 		}
132 		onLoadCompleteListeners ~= dlg;
133 	}
134 	extern(C) static void callBackLoadComplete(AtkDocument* atkdocumentStruct, Document _document)
135 	{
136 		foreach ( void delegate(Document) dlg ; _document.onLoadCompleteListeners )
137 		{
138 			dlg(_document);
139 		}
140 	}
141 	
142 	void delegate(Document)[] onLoadStoppedListeners;
143 	/**
144 	 * The 'load-stopped' signal is emitted when a pending load of document contents
145 	 * is cancelled, paused, or otherwise interrupted by the user or application
146 	 * logic. It should not however be
147 	 * emitted while waiting for a resource (for instance while blocking on a file or
148 	 * network read) unless a user-significant timeout has occurred.
149 	 */
150 	void addOnLoadStopped(void delegate(Document) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
151 	{
152 		if ( !("load-stopped" in connectedSignals) )
153 		{
154 			Signals.connectData(
155 			getStruct(),
156 			"load-stopped",
157 			cast(GCallback)&callBackLoadStopped,
158 			cast(void*)this,
159 			null,
160 			connectFlags);
161 			connectedSignals["load-stopped"] = 1;
162 		}
163 		onLoadStoppedListeners ~= dlg;
164 	}
165 	extern(C) static void callBackLoadStopped(AtkDocument* atkdocumentStruct, Document _document)
166 	{
167 		foreach ( void delegate(Document) dlg ; _document.onLoadStoppedListeners )
168 		{
169 			dlg(_document);
170 		}
171 	}
172 	
173 	void delegate(Document)[] onReloadListeners;
174 	/**
175 	 * The 'reload' signal is emitted when the contents of a document is refreshed
176 	 * from its source. Once 'reload' has been emitted, a matching 'load-complete'
177 	 * or 'load-stopped' signal should follow, which clients may await before
178 	 * interrogating ATK for the latest document content.
179 	 */
180 	void addOnReload(void delegate(Document) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
181 	{
182 		if ( !("reload" in connectedSignals) )
183 		{
184 			Signals.connectData(
185 			getStruct(),
186 			"reload",
187 			cast(GCallback)&callBackReload,
188 			cast(void*)this,
189 			null,
190 			connectFlags);
191 			connectedSignals["reload"] = 1;
192 		}
193 		onReloadListeners ~= dlg;
194 	}
195 	extern(C) static void callBackReload(AtkDocument* atkdocumentStruct, Document _document)
196 	{
197 		foreach ( void delegate(Document) dlg ; _document.onReloadListeners )
198 		{
199 			dlg(_document);
200 		}
201 	}
202 	
203 	
204 	/**
205 	 * Gets a string indicating the document type.
206 	 * Returns: a string indicating the document type
207 	 */
208 	public string getDocumentType()
209 	{
210 		// const gchar * atk_document_get_document_type (AtkDocument *document);
211 		return Str.toString(atk_document_get_document_type(atkDocument));
212 	}
213 	
214 	/**
215 	 * Gets a gpointer that points to an instance of the DOM. It is
216 	 * up to the caller to check atk_document_get_type to determine
217 	 * how to cast this pointer.
218 	 * Returns: a gpointer that points to an instance of the DOM. [transfer none]
219 	 */
220 	public void* getDocument()
221 	{
222 		// gpointer atk_document_get_document (AtkDocument *document);
223 		return atk_document_get_document(atkDocument);
224 	}
225 	
226 	/**
227 	 * Since 1.12
228 	 * Params:
229 	 * attributeName = a character string representing the name of the attribute
230 	 * whose value is being queried.
231 	 * 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.
232 	 */
233 	public string getAttributeValue(string attributeName)
234 	{
235 		// const gchar * atk_document_get_attribute_value (AtkDocument *document,  const gchar *attribute_name);
236 		return Str.toString(atk_document_get_attribute_value(atkDocument, Str.toStringz(attributeName)));
237 	}
238 	
239 	/**
240 	 * Since 1.12
241 	 * Params:
242 	 * attributeName = a character string representing the name of the attribute
243 	 * whose value is being set.
244 	 * attributeValue = a string value to be associated with attribute_name.
245 	 * 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).
246 	 */
247 	public int setAttributeValue(string attributeName, string attributeValue)
248 	{
249 		// gboolean atk_document_set_attribute_value (AtkDocument *document,  const gchar *attribute_name,  const gchar *attribute_value);
250 		return atk_document_set_attribute_value(atkDocument, Str.toStringz(attributeName), Str.toStringz(attributeValue));
251 	}
252 	
253 	/**
254 	 * Gets an AtkAttributeSet which describes document-wide
255 	 *  attributes as name-value pairs.
256 	 * Since 1.12
257 	 * Returns: An AtkAttributeSet containing the explicitly set name-value-pair attributes associated with this document as a whole. [transfer none]
258 	 */
259 	public AtkAttributeSet* getAttributes()
260 	{
261 		// AtkAttributeSet * atk_document_get_attributes (AtkDocument *document);
262 		return atk_document_get_attributes(atkDocument);
263 	}
264 	
265 	/**
266 	 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale
267 	 *  of the content of this document instance. Individual
268 	 *  text substrings or images within this document may have
269 	 *  a different locale, see atk_text_get_attributes and
270 	 *  atk_image_get_image_locale.
271 	 * 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. 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.)
272 	 */
273 	public string getLocale()
274 	{
275 		// const gchar * atk_document_get_locale (AtkDocument *document);
276 		return Str.toString(atk_document_get_locale(atkDocument));
277 	}
278 }