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