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 glib.Str; 28 public import gobject.Signals; 29 public import gtkc.atk; 30 public import gtkc.atktypes; 31 public import gtkc.gdktypes; 32 33 34 /** 35 * The AtkDocument interface should be supported by any object whose 36 * content is a representation or view of a document. The AtkDocument 37 * interface should appear on the toplevel container for the document 38 * content; however AtkDocument instances may be nested (i.e. an 39 * AtkDocument may be a descendant of another AtkDocument) in those 40 * cases where one document contains "embedded content" which can 41 * reasonably be considered a document in its own right. 42 */ 43 public template DocumentT(TStruct) 44 { 45 /** Get the main Gtk struct */ 46 public AtkDocument* getDocumentStruct() 47 { 48 return cast(AtkDocument*)getStruct(); 49 } 50 51 /** 52 */ 53 54 /** 55 * 56 * Params: 57 * attributeName = a character string representing the name of the attribute 58 * whose value is being queried. 59 * Return: a string value associated with the named 60 * attribute for this document, or NULL if a value for 61 * #attribute_name has not been specified for this document. 62 * 63 * Since: 1.12 64 */ 65 public string getAttributeValue(string attributeName) 66 { 67 return Str.toString(atk_document_get_attribute_value(getDocumentStruct(), Str.toStringz(attributeName))); 68 } 69 70 /** 71 * Gets an AtkAttributeSet which describes document-wide 72 * attributes as name-value pairs. 73 * 74 * Return: An AtkAttributeSet containing the explicitly 75 * set name-value-pair attributes associated with this document 76 * as a whole. 77 * 78 * Since: 1.12 79 */ 80 public override AtkAttributeSet* getAttributes() 81 { 82 return atk_document_get_attributes(getDocumentStruct()); 83 } 84 85 /** 86 * Return: current page number inside @document. -1 if not 87 * implemented, not know by the implementor or irrelevant. 88 * 89 * Since: 2.12 90 */ 91 public int getCurrentPageNumber() 92 { 93 return atk_document_get_current_page_number(getDocumentStruct()); 94 } 95 96 /** 97 * Gets a %gpointer that points to an instance of the DOM. It is 98 * up to the caller to check atk_document_get_type to determine 99 * how to cast this pointer. 100 * 101 * Deprecated: Since 2.12. @document is already a representation of 102 * the document. Use it directly, or one of his children, as an 103 * instance of the DOM. 104 * 105 * Return: a %gpointer that points to an instance of the DOM. 106 */ 107 public void* getDocument() 108 { 109 return atk_document_get_document(getDocumentStruct()); 110 } 111 112 /** 113 * Gets a string indicating the document type. 114 * 115 * Deprecated: Since 2.12. Please use atk_document_get_attributes() to 116 * ask for the document type if it applies. 117 * 118 * Return: a string indicating the document type 119 */ 120 public string getDocumentType() 121 { 122 return Str.toString(atk_document_get_document_type(getDocumentStruct())); 123 } 124 125 /** 126 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale 127 * of the content of this document instance. Individual 128 * text substrings or images within this document may have 129 * a different locale, see atk_text_get_attributes and 130 * atk_image_get_image_locale. 131 * 132 * Deprecated: This method is deprecated since ATK version 133 * 2.7.90. Please use atk_object_get_object_locale() instead. 134 * 135 * Return: a UTF-8 string indicating the POSIX-style LC_MESSAGES 136 * locale of the document content as a whole, or NULL if 137 * the document content does not specify a locale. 138 */ 139 public string getLocale() 140 { 141 return Str.toString(atk_document_get_locale(getDocumentStruct())); 142 } 143 144 /** 145 * Return: total page count of @document. -1 if not implemented, not 146 * know by the implementor or irrelevant. 147 * 148 * Since: 2.12 149 */ 150 public int getPageCount() 151 { 152 return atk_document_get_page_count(getDocumentStruct()); 153 } 154 155 /** 156 * 157 * Params: 158 * attributeName = a character string representing the name of the attribute 159 * whose value is being set. 160 * attributeValue = a string value to be associated with #attribute_name. 161 * Return: TRUE if #value is successfully associated with #attribute_name 162 * for this document, FALSE otherwise (e.g. if the document does not 163 * allow the attribute to be modified). 164 * 165 * Since: 1.12 166 */ 167 public bool setAttributeValue(string attributeName, string attributeValue) 168 { 169 return atk_document_set_attribute_value(getDocumentStruct(), Str.toStringz(attributeName), Str.toStringz(attributeValue)) != 0; 170 } 171 172 int[string] connectedSignals; 173 174 void delegate(DocumentIF)[] _onLoadCompleteListeners; 175 @property void delegate(DocumentIF)[] onLoadCompleteListeners() 176 { 177 return _onLoadCompleteListeners; 178 } 179 /** 180 * The 'load-complete' signal is emitted when a pending load of 181 * a static document has completed. This signal is to be 182 * expected by ATK clients if and when AtkDocument implementors 183 * expose ATK_STATE_BUSY. If the state of an AtkObject which 184 * implements AtkDocument does not include ATK_STATE_BUSY, it 185 * should be safe for clients to assume that the AtkDocument's 186 * static contents are fully loaded into the container. 187 * (Dynamic document contents should be exposed via other 188 * signals.) 189 */ 190 void addOnLoadComplete(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 191 { 192 if ( "load-complete" !in connectedSignals ) 193 { 194 Signals.connectData( 195 this, 196 "load-complete", 197 cast(GCallback)&callBackLoadComplete, 198 cast(void*)cast(DocumentIF)this, 199 null, 200 connectFlags); 201 connectedSignals["load-complete"] = 1; 202 } 203 _onLoadCompleteListeners ~= dlg; 204 } 205 extern(C) static void callBackLoadComplete(AtkDocument* documentStruct, DocumentIF _document) 206 { 207 foreach ( void delegate(DocumentIF) dlg; _document.onLoadCompleteListeners ) 208 { 209 dlg(_document); 210 } 211 } 212 213 void delegate(DocumentIF)[] _onLoadStoppedListeners; 214 @property void delegate(DocumentIF)[] onLoadStoppedListeners() 215 { 216 return _onLoadStoppedListeners; 217 } 218 /** 219 * The 'load-stopped' signal is emitted when a pending load of 220 * document contents is cancelled, paused, or otherwise 221 * interrupted by the user or application logic. It should not 222 * however be emitted while waiting for a resource (for instance 223 * while blocking on a file or network read) unless a 224 * user-significant timeout has occurred. 225 */ 226 void addOnLoadStopped(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 227 { 228 if ( "load-stopped" !in connectedSignals ) 229 { 230 Signals.connectData( 231 this, 232 "load-stopped", 233 cast(GCallback)&callBackLoadStopped, 234 cast(void*)cast(DocumentIF)this, 235 null, 236 connectFlags); 237 connectedSignals["load-stopped"] = 1; 238 } 239 _onLoadStoppedListeners ~= dlg; 240 } 241 extern(C) static void callBackLoadStopped(AtkDocument* documentStruct, DocumentIF _document) 242 { 243 foreach ( void delegate(DocumentIF) dlg; _document.onLoadStoppedListeners ) 244 { 245 dlg(_document); 246 } 247 } 248 249 void delegate(int, DocumentIF)[] _onPageChangedListeners; 250 @property void delegate(int, DocumentIF)[] onPageChangedListeners() 251 { 252 return _onPageChangedListeners; 253 } 254 /** 255 * The 'page-changed' signal is emitted when the current page of 256 * a document changes, e.g. pressing page up/down in a document 257 * viewer. 258 * 259 * Params: 260 * pageNumber = the new page number. If this value is unknown 261 * or not applicable, -1 should be provided. 262 * 263 * Since: 2.12 264 */ 265 void addOnPageChanged(void delegate(int, DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 266 { 267 if ( "page-changed" !in connectedSignals ) 268 { 269 Signals.connectData( 270 this, 271 "page-changed", 272 cast(GCallback)&callBackPageChanged, 273 cast(void*)cast(DocumentIF)this, 274 null, 275 connectFlags); 276 connectedSignals["page-changed"] = 1; 277 } 278 _onPageChangedListeners ~= dlg; 279 } 280 extern(C) static void callBackPageChanged(AtkDocument* documentStruct, int pageNumber, DocumentIF _document) 281 { 282 foreach ( void delegate(int, DocumentIF) dlg; _document.onPageChangedListeners ) 283 { 284 dlg(pageNumber, _document); 285 } 286 } 287 288 void delegate(DocumentIF)[] _onReloadListeners; 289 @property void delegate(DocumentIF)[] onReloadListeners() 290 { 291 return _onReloadListeners; 292 } 293 /** 294 * The 'reload' signal is emitted when the contents of a 295 * document is refreshed from its source. Once 'reload' has 296 * been emitted, a matching 'load-complete' or 'load-stopped' 297 * signal should follow, which clients may await before 298 * interrogating ATK for the latest document content. 299 */ 300 void addOnReload(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 301 { 302 if ( "reload" !in connectedSignals ) 303 { 304 Signals.connectData( 305 this, 306 "reload", 307 cast(GCallback)&callBackReload, 308 cast(void*)cast(DocumentIF)this, 309 null, 310 connectFlags); 311 connectedSignals["reload"] = 1; 312 } 313 _onReloadListeners ~= dlg; 314 } 315 extern(C) static void callBackReload(AtkDocument* documentStruct, DocumentIF _document) 316 { 317 foreach ( void delegate(DocumentIF) dlg; _document.onReloadListeners ) 318 { 319 dlg(_document); 320 } 321 } 322 }