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: Please use atk_object_get_object_locale() instead. 133 * 134 * Return: a UTF-8 string indicating the POSIX-style LC_MESSAGES 135 * locale of the document content as a whole, or NULL if 136 * the document content does not specify a locale. 137 */ 138 public string getLocale() 139 { 140 return Str.toString(atk_document_get_locale(getDocumentStruct())); 141 } 142 143 /** 144 * Return: total page count of @document. -1 if not implemented, not 145 * know by the implementor or irrelevant. 146 * 147 * Since: 2.12 148 */ 149 public int getPageCount() 150 { 151 return atk_document_get_page_count(getDocumentStruct()); 152 } 153 154 /** 155 * 156 * Params: 157 * attributeName = a character string representing the name of the attribute 158 * whose value is being set. 159 * attributeValue = a string value to be associated with #attribute_name. 160 * Return: TRUE if #value is successfully associated with #attribute_name 161 * for this document, FALSE otherwise (e.g. if the document does not 162 * allow the attribute to be modified). 163 * 164 * Since: 1.12 165 */ 166 public bool setAttributeValue(string attributeName, string attributeValue) 167 { 168 return atk_document_set_attribute_value(getDocumentStruct(), Str.toStringz(attributeName), Str.toStringz(attributeValue)) != 0; 169 } 170 171 int[string] connectedSignals; 172 173 void delegate(DocumentIF)[] _onLoadCompleteListeners; 174 @property void delegate(DocumentIF)[] onLoadCompleteListeners() 175 { 176 return _onLoadCompleteListeners; 177 } 178 /** 179 * The 'load-complete' signal is emitted when a pending load of 180 * a static document has completed. This signal is to be 181 * expected by ATK clients if and when AtkDocument implementors 182 * expose ATK_STATE_BUSY. If the state of an AtkObject which 183 * implements AtkDocument does not include ATK_STATE_BUSY, it 184 * should be safe for clients to assume that the AtkDocument's 185 * static contents are fully loaded into the container. 186 * (Dynamic document contents should be exposed via other 187 * signals.) 188 */ 189 void addOnLoadComplete(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 190 { 191 if ( "load-complete" !in connectedSignals ) 192 { 193 Signals.connectData( 194 this, 195 "load-complete", 196 cast(GCallback)&callBackLoadComplete, 197 cast(void*)cast(DocumentIF)this, 198 null, 199 connectFlags); 200 connectedSignals["load-complete"] = 1; 201 } 202 _onLoadCompleteListeners ~= dlg; 203 } 204 extern(C) static void callBackLoadComplete(AtkDocument* documentStruct, DocumentIF _document) 205 { 206 foreach ( void delegate(DocumentIF) dlg; _document.onLoadCompleteListeners ) 207 { 208 dlg(_document); 209 } 210 } 211 212 void delegate(DocumentIF)[] _onLoadStoppedListeners; 213 @property void delegate(DocumentIF)[] onLoadStoppedListeners() 214 { 215 return _onLoadStoppedListeners; 216 } 217 /** 218 * The 'load-stopped' signal is emitted when a pending load of 219 * document contents is cancelled, paused, or otherwise 220 * interrupted by the user or application logic. It should not 221 * however be emitted while waiting for a resource (for instance 222 * while blocking on a file or network read) unless a 223 * user-significant timeout has occurred. 224 */ 225 void addOnLoadStopped(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 226 { 227 if ( "load-stopped" !in connectedSignals ) 228 { 229 Signals.connectData( 230 this, 231 "load-stopped", 232 cast(GCallback)&callBackLoadStopped, 233 cast(void*)cast(DocumentIF)this, 234 null, 235 connectFlags); 236 connectedSignals["load-stopped"] = 1; 237 } 238 _onLoadStoppedListeners ~= dlg; 239 } 240 extern(C) static void callBackLoadStopped(AtkDocument* documentStruct, DocumentIF _document) 241 { 242 foreach ( void delegate(DocumentIF) dlg; _document.onLoadStoppedListeners ) 243 { 244 dlg(_document); 245 } 246 } 247 248 void delegate(int, DocumentIF)[] _onPageChangedListeners; 249 @property void delegate(int, DocumentIF)[] onPageChangedListeners() 250 { 251 return _onPageChangedListeners; 252 } 253 /** 254 * The 'page-changed' signal is emitted when the current page of 255 * a document changes, e.g. pressing page up/down in a document 256 * viewer. 257 * 258 * Params: 259 * pageNumber = the new page number. If this value is unknown 260 * or not applicable, -1 should be provided. 261 * 262 * Since: 2.12 263 */ 264 void addOnPageChanged(void delegate(int, DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 265 { 266 if ( "page-changed" !in connectedSignals ) 267 { 268 Signals.connectData( 269 this, 270 "page-changed", 271 cast(GCallback)&callBackPageChanged, 272 cast(void*)cast(DocumentIF)this, 273 null, 274 connectFlags); 275 connectedSignals["page-changed"] = 1; 276 } 277 _onPageChangedListeners ~= dlg; 278 } 279 extern(C) static void callBackPageChanged(AtkDocument* documentStruct, int pageNumber, DocumentIF _document) 280 { 281 foreach ( void delegate(int, DocumentIF) dlg; _document.onPageChangedListeners ) 282 { 283 dlg(pageNumber, _document); 284 } 285 } 286 287 void delegate(DocumentIF)[] _onReloadListeners; 288 @property void delegate(DocumentIF)[] onReloadListeners() 289 { 290 return _onReloadListeners; 291 } 292 /** 293 * The 'reload' signal is emitted when the contents of a 294 * document is refreshed from its source. Once 'reload' has 295 * been emitted, a matching 'load-complete' or 'load-stopped' 296 * signal should follow, which clients may await before 297 * interrogating ATK for the latest document content. 298 */ 299 void addOnReload(void delegate(DocumentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 300 { 301 if ( "reload" !in connectedSignals ) 302 { 303 Signals.connectData( 304 this, 305 "reload", 306 cast(GCallback)&callBackReload, 307 cast(void*)cast(DocumentIF)this, 308 null, 309 connectFlags); 310 connectedSignals["reload"] = 1; 311 } 312 _onReloadListeners ~= dlg; 313 } 314 extern(C) static void callBackReload(AtkDocument* documentStruct, DocumentIF _document) 315 { 316 foreach ( void delegate(DocumentIF) dlg; _document.onReloadListeners ) 317 { 318 dlg(_document); 319 } 320 } 321 }