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 module atk.DocumentT;
26 
27 public  import atk.c.functions;
28 public  import atk.c.types;
29 public  import glib.Str;
30 public  import gobject.Signals;
31 public  import gtkc.atktypes;
32 public  import std.algorithm;
33 
34 
35 /**
36  * The AtkDocument interface should be supported by any object whose
37  * content is a representation or view of a document.  The AtkDocument
38  * interface should appear on the toplevel container for the document
39  * content; however AtkDocument instances may be nested (i.e. an
40  * AtkDocument may be a descendant of another AtkDocument) in those
41  * cases where one document contains "embedded content" which can
42  * reasonably be considered a document in its own right.
43  */
44 public template DocumentT(TStruct)
45 {
46 	/** Get the main Gtk struct */
47 	public AtkDocument* getDocumentStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return cast(AtkDocument*)getStruct();
52 	}
53 
54 
55 	/**
56 	 * Retrieves the value of the given @attribute_name inside @document.
57 	 *
58 	 * Params:
59 	 *     attributeName = a character string representing the name of the attribute
60 	 *         whose value is being queried.
61 	 *
62 	 * Returns: a string value associated with the named
63 	 *     attribute for this document, or %NULL if a value for
64 	 *     @attribute_name has not been specified for this document.
65 	 *
66 	 * Since: 1.12
67 	 */
68 	public string getAttributeValue(string attributeName)
69 	{
70 		return Str.toString(atk_document_get_attribute_value(getDocumentStruct(), Str.toStringz(attributeName)));
71 	}
72 
73 	/**
74 	 * Gets an AtkAttributeSet which describes document-wide
75 	 * attributes as name-value pairs.
76 	 *
77 	 * Returns: An AtkAttributeSet containing the explicitly
78 	 *     set name-value-pair attributes associated with this document
79 	 *     as a whole.
80 	 *
81 	 * Since: 1.12
82 	 */
83 	public override AtkAttributeSet* getAttributes()
84 	{
85 		return atk_document_get_attributes(getDocumentStruct());
86 	}
87 
88 	/**
89 	 * Retrieves the current page number inside @document.
90 	 *
91 	 * Returns: the current page number inside @document, or -1 if
92 	 *     not implemented, not know by the implementor, or irrelevant.
93 	 *
94 	 * Since: 2.12
95 	 */
96 	public int getCurrentPageNumber()
97 	{
98 		return atk_document_get_current_page_number(getDocumentStruct());
99 	}
100 
101 	/**
102 	 * Gets a %gpointer that points to an instance of the DOM.  It is
103 	 * up to the caller to check atk_document_get_type to determine
104 	 * how to cast this pointer.
105 	 *
106 	 * Deprecated: Since 2.12. @document is already a representation of
107 	 * the document. Use it directly, or one of its children, as an
108 	 * instance of the DOM.
109 	 *
110 	 * Returns: a %gpointer that points to an instance of the DOM.
111 	 */
112 	public void* getDocument()
113 	{
114 		return atk_document_get_document(getDocumentStruct());
115 	}
116 
117 	/**
118 	 * Gets a string indicating the document type.
119 	 *
120 	 * Deprecated: Since 2.12. Please use atk_document_get_attributes() to
121 	 * ask for the document type if it applies.
122 	 *
123 	 * Returns: a string indicating the document type
124 	 */
125 	public string getDocumentType()
126 	{
127 		return Str.toString(atk_document_get_document_type(getDocumentStruct()));
128 	}
129 
130 	/**
131 	 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale
132 	 * of the content of this document instance.  Individual
133 	 * text substrings or images within this document may have
134 	 * a different locale, see atk_text_get_attributes and
135 	 * atk_image_get_image_locale.
136 	 *
137 	 * Deprecated: Please use atk_object_get_object_locale() instead.
138 	 *
139 	 * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES
140 	 *     locale of the document content as a whole, or NULL if
141 	 *     the document content does not specify a locale.
142 	 */
143 	public string getLocale()
144 	{
145 		return Str.toString(atk_document_get_locale(getDocumentStruct()));
146 	}
147 
148 	/**
149 	 * Retrieves the total number of pages inside @document.
150 	 *
151 	 * Returns: total page count of @document, or -1 if not implemented,
152 	 *     not know by the implementor or irrelevant.
153 	 *
154 	 * Since: 2.12
155 	 */
156 	public int getPageCount()
157 	{
158 		return atk_document_get_page_count(getDocumentStruct());
159 	}
160 
161 	/**
162 	 * Sets the value for the given @attribute_name inside @document.
163 	 *
164 	 * Params:
165 	 *     attributeName = a character string representing the name of the attribute
166 	 *         whose value is being set.
167 	 *     attributeValue = a string value to be associated with @attribute_name.
168 	 *
169 	 * Returns: %TRUE if @attribute_value is successfully associated
170 	 *     with @attribute_name for this @document, and %FALSE if if the
171 	 *     document does not allow the attribute to be modified
172 	 *
173 	 * Since: 1.12
174 	 */
175 	public bool setAttributeValue(string attributeName, string attributeValue)
176 	{
177 		return atk_document_set_attribute_value(getDocumentStruct(), Str.toStringz(attributeName), Str.toStringz(attributeValue)) != 0;
178 	}
179 
180 	/**
181 	 * The 'load-complete' signal is emitted when a pending load of
182 	 * a static document has completed.  This signal is to be
183 	 * expected by ATK clients if and when AtkDocument implementors
184 	 * expose ATK_STATE_BUSY.  If the state of an AtkObject which
185 	 * implements AtkDocument does not include ATK_STATE_BUSY, it
186 	 * should be safe for clients to assume that the AtkDocument's
187 	 * static contents are fully loaded into the container.
188 	 * (Dynamic document contents should be exposed via other
189 	 * signals.)
190 	 */
191 	gulong addOnLoadComplete(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
192 	{
193 		return Signals.connect(this, "load-complete", dlg, connectFlags ^ ConnectFlags.SWAPPED);
194 	}
195 
196 	/**
197 	 * The 'load-stopped' signal is emitted when a pending load of
198 	 * document contents is cancelled, paused, or otherwise
199 	 * interrupted by the user or application logic.  It should not
200 	 * however be emitted while waiting for a resource (for instance
201 	 * while blocking on a file or network read) unless a
202 	 * user-significant timeout has occurred.
203 	 */
204 	gulong addOnLoadStopped(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
205 	{
206 		return Signals.connect(this, "load-stopped", dlg, connectFlags ^ ConnectFlags.SWAPPED);
207 	}
208 
209 	/**
210 	 * The 'page-changed' signal is emitted when the current page of
211 	 * a document changes, e.g. pressing page up/down in a document
212 	 * viewer.
213 	 *
214 	 * Params:
215 	 *     pageNumber = the new page number. If this value is unknown
216 	 *         or not applicable, -1 should be provided.
217 	 *
218 	 * Since: 2.12
219 	 */
220 	gulong addOnPageChanged(void delegate(int, DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
221 	{
222 		return Signals.connect(this, "page-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
223 	}
224 
225 	/**
226 	 * The 'reload' signal is emitted when the contents of a
227 	 * document is refreshed from its source.  Once 'reload' has
228 	 * been emitted, a matching 'load-complete' or 'load-stopped'
229 	 * signal should follow, which clients may await before
230 	 * interrogating ATK for the latest document content.
231 	 */
232 	gulong addOnReload(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
233 	{
234 		return Signals.connect(this, "reload", dlg, connectFlags ^ ConnectFlags.SWAPPED);
235 	}
236 }