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