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  = AtkText.html
27  * outPack = atk
28  * outFile = Text
29  * strct   = AtkText
30  * realStrct=
31  * ctorStrct=
32  * clss    = Text
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- atk_text_
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.Text;
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 
64 private import glib.Str;
65 
66 
67 
68 
69 /**
70  * AtkText should be implemented by AtkObjects on behalf of widgets
71  * that have text content which is either attributed or otherwise
72  * non-trivial. AtkObjects whose text content is simple,
73  * unattributed, and very brief may expose that content via
74  * atk_object_get_name instead; however if the text is editable,
75  * multi-line, typically longer than three or four words, attributed,
76  * selectable, or if the object already uses the 'name' ATK property
77  * for other information, the AtkText interface should be used to
78  * expose the text content. In the case of editable text content,
79  * AtkEditableText (a subtype of the AtkText interface) should be
80  * implemented instead.
81  *
82  *  AtkText provides not only traversal facilities and change
83  * notification for text content, but also caret tracking and glyph
84  * bounding box calculations. Note that the text strings are exposed
85  * as UTF-8, and are therefore potentially multi-byte, and
86  * caret-to-byte offset mapping makes no assumptions about the
87  * character length; also bounding box glyph-to-offset mapping may be
88  * complex for languages which use ligatures.
89  */
90 public class Text
91 {
92 	
93 	/** the main Gtk struct */
94 	protected AtkText* atkText;
95 	
96 	
97 	public AtkText* getTextStruct()
98 	{
99 		return atkText;
100 	}
101 	
102 	
103 	/** the main Gtk struct as a void* */
104 	protected void* getStruct()
105 	{
106 		return cast(void*)atkText;
107 	}
108 	
109 	/**
110 	 * Sets our main struct and passes it to the parent class
111 	 */
112 	public this (AtkText* atkText)
113 	{
114 		this.atkText = atkText;
115 	}
116 	
117 	/**
118 	 */
119 	int[string] connectedSignals;
120 	
121 	void delegate(Text)[] onTextAttributesChangedListeners;
122 	/**
123 	 * The "text-attributes-changed" signal is emitted when the text
124 	 * attributes of the text of an object which implements AtkText
125 	 * changes.
126 	 */
127 	void addOnTextAttributesChanged(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
128 	{
129 		if ( !("text-attributes-changed" in connectedSignals) )
130 		{
131 			Signals.connectData(
132 			getStruct(),
133 			"text-attributes-changed",
134 			cast(GCallback)&callBackTextAttributesChanged,
135 			cast(void*)this,
136 			null,
137 			connectFlags);
138 			connectedSignals["text-attributes-changed"] = 1;
139 		}
140 		onTextAttributesChangedListeners ~= dlg;
141 	}
142 	extern(C) static void callBackTextAttributesChanged(AtkText* atktextStruct, Text _text)
143 	{
144 		foreach ( void delegate(Text) dlg ; _text.onTextAttributesChangedListeners )
145 		{
146 			dlg(_text);
147 		}
148 	}
149 	
150 	void delegate(gint, Text)[] onTextCaretMovedListeners;
151 	/**
152 	 * The "text-caret-moved" signal is emitted when the caret
153 	 * position of the text of an object which implements AtkText
154 	 * changes.
155 	 */
156 	void addOnTextCaretMoved(void delegate(gint, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
157 	{
158 		if ( !("text-caret-moved" in connectedSignals) )
159 		{
160 			Signals.connectData(
161 			getStruct(),
162 			"text-caret-moved",
163 			cast(GCallback)&callBackTextCaretMoved,
164 			cast(void*)this,
165 			null,
166 			connectFlags);
167 			connectedSignals["text-caret-moved"] = 1;
168 		}
169 		onTextCaretMovedListeners ~= dlg;
170 	}
171 	extern(C) static void callBackTextCaretMoved(AtkText* atktextStruct, gint arg1, Text _text)
172 	{
173 		foreach ( void delegate(gint, Text) dlg ; _text.onTextCaretMovedListeners )
174 		{
175 			dlg(arg1, _text);
176 		}
177 	}
178 	
179 	void delegate(gint, gint, Text)[] onTextChangedListeners;
180 	/**
181 	 * Warning
182 	 * AtkText::text-changed is deprecated and should not be used in newly-written code. Since 2.9.4. Use "text-insert" or
183 	 * "text-remove" instead.
184 	 * The "text-changed" signal is emitted when the text of the
185 	 * object which implements the AtkText interface changes, This
186 	 * signal will have a detail which is either "insert" or
187 	 * "delete" which identifies whether the text change was an
188 	 * insertion or a deletion.
189 	 */
190 	void addOnTextChanged(void delegate(gint, gint, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
191 	{
192 		if ( !("text-changed" in connectedSignals) )
193 		{
194 			Signals.connectData(
195 			getStruct(),
196 			"text-changed",
197 			cast(GCallback)&callBackTextChanged,
198 			cast(void*)this,
199 			null,
200 			connectFlags);
201 			connectedSignals["text-changed"] = 1;
202 		}
203 		onTextChangedListeners ~= dlg;
204 	}
205 	extern(C) static void callBackTextChanged(AtkText* atktextStruct, gint arg1, gint arg2, Text _text)
206 	{
207 		foreach ( void delegate(gint, gint, Text) dlg ; _text.onTextChangedListeners )
208 		{
209 			dlg(arg1, arg2, _text);
210 		}
211 	}
212 	
213 	void delegate(gint, gint, string, Text)[] onTextInsertListeners;
214 	/**
215 	 * The "text-insert" signal is emitted when a new text is
216 	 * inserted.
217 	 */
218 	void addOnTextInsert(void delegate(gint, gint, string, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
219 	{
220 		if ( !("text-insert" in connectedSignals) )
221 		{
222 			Signals.connectData(
223 			getStruct(),
224 			"text-insert",
225 			cast(GCallback)&callBackTextInsert,
226 			cast(void*)this,
227 			null,
228 			connectFlags);
229 			connectedSignals["text-insert"] = 1;
230 		}
231 		onTextInsertListeners ~= dlg;
232 	}
233 	extern(C) static void callBackTextInsert(AtkText* atktextStruct, gint arg1, gint arg2, gchar* arg3, Text _text)
234 	{
235 		foreach ( void delegate(gint, gint, string, Text) dlg ; _text.onTextInsertListeners )
236 		{
237 			dlg(arg1, arg2, Str.toString(arg3), _text);
238 		}
239 	}
240 	
241 	void delegate(gint, gint, string, Text)[] onTextRemoveListeners;
242 	/**
243 	 * The "text-remove" signal is emitted when a new text is
244 	 * removed.
245 	 */
246 	void addOnTextRemove(void delegate(gint, gint, string, Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
247 	{
248 		if ( !("text-remove" in connectedSignals) )
249 		{
250 			Signals.connectData(
251 			getStruct(),
252 			"text-remove",
253 			cast(GCallback)&callBackTextRemove,
254 			cast(void*)this,
255 			null,
256 			connectFlags);
257 			connectedSignals["text-remove"] = 1;
258 		}
259 		onTextRemoveListeners ~= dlg;
260 	}
261 	extern(C) static void callBackTextRemove(AtkText* atktextStruct, gint arg1, gint arg2, gchar* arg3, Text _text)
262 	{
263 		foreach ( void delegate(gint, gint, string, Text) dlg ; _text.onTextRemoveListeners )
264 		{
265 			dlg(arg1, arg2, Str.toString(arg3), _text);
266 		}
267 	}
268 	
269 	void delegate(Text)[] onTextSelectionChangedListeners;
270 	/**
271 	 * The "text-selection-changed" signal is emitted when the
272 	 * selected text of an object which implements AtkText changes.
273 	 */
274 	void addOnTextSelectionChanged(void delegate(Text) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
275 	{
276 		if ( !("text-selection-changed" in connectedSignals) )
277 		{
278 			Signals.connectData(
279 			getStruct(),
280 			"text-selection-changed",
281 			cast(GCallback)&callBackTextSelectionChanged,
282 			cast(void*)this,
283 			null,
284 			connectFlags);
285 			connectedSignals["text-selection-changed"] = 1;
286 		}
287 		onTextSelectionChangedListeners ~= dlg;
288 	}
289 	extern(C) static void callBackTextSelectionChanged(AtkText* atktextStruct, Text _text)
290 	{
291 		foreach ( void delegate(Text) dlg ; _text.onTextSelectionChangedListeners )
292 		{
293 			dlg(_text);
294 		}
295 	}
296 	
297 	
298 	/**
299 	 * Gets the specified text.
300 	 * Params:
301 	 * startOffset = start position
302 	 * endOffset = end position, or -1 for the end of the string.
303 	 * Returns: a newly allocated string containing the text from start_offset up to, but not including end_offset. Use g_free() to free the returned string.
304 	 */
305 	public string getText(int startOffset, int endOffset)
306 	{
307 		// gchar * atk_text_get_text (AtkText *text,  gint start_offset,  gint end_offset);
308 		return Str.toString(atk_text_get_text(atkText, startOffset, endOffset));
309 	}
310 	
311 	/**
312 	 * Gets the specified text.
313 	 * Params:
314 	 * offset = position
315 	 * Returns: the character at offset.
316 	 */
317 	public gunichar getCharacterAtOffset(int offset)
318 	{
319 		// gunichar atk_text_get_character_at_offset (AtkText *text,  gint offset);
320 		return atk_text_get_character_at_offset(atkText, offset);
321 	}
322 	
323 	/**
324 	 * Warning
325 	 * atk_text_get_text_after_offset is deprecated and should not be used in newly-written code. This method is deprecated since ATK version
326 	 * 2.9.3. Please use atk_text_get_string_at_offset() instead.
327 	 * Gets the specified text.
328 	 * Params:
329 	 * offset = position
330 	 * boundaryType = An AtkTextBoundary
331 	 * startOffset = the start offset of the returned string. [out]
332 	 * endOffset = the offset of the first character after the
333 	 * returned substring. [out]
334 	 * Returns: a newly allocated string containing the text after offset bounded by the specified boundary_type. Use g_free() to free the returned string.
335 	 */
336 	public string getTextAfterOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
337 	{
338 		// gchar * atk_text_get_text_after_offset (AtkText *text,  gint offset,  AtkTextBoundary boundary_type,  gint *start_offset,  gint *end_offset);
339 		return Str.toString(atk_text_get_text_after_offset(atkText, offset, boundaryType, &startOffset, &endOffset));
340 	}
341 	
342 	/**
343 	 * Warning
344 	 * atk_text_get_text_at_offset is deprecated and should not be used in newly-written code. This method is deprecated since ATK version
345 	 * 2.9.4. Please use atk_text_get_string_at_offset() instead.
346 	 * Gets the specified text.
347 	 * If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character at the
348 	 * offset is returned.
349 	 * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string
350 	 * is from the word start at or before the offset to the word start after
351 	 * the offset.
352 	 * The returned string will contain the word at the offset if the offset
353 	 * is inside a word and will contain the word before the offset if the
354 	 * offset is not inside a word.
355 	 * If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned
356 	 * string is from the sentence start at or before the offset to the sentence
357 	 * start after the offset.
358 	 * The returned string will contain the sentence at the offset if the offset
359 	 * is inside a sentence and will contain the sentence before the offset
360 	 * if the offset is not inside a sentence.
361 	 * If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned
362 	 * string is from the line start at or before the offset to the line
363 	 * start after the offset.
364 	 * Params:
365 	 * offset = position
366 	 * boundaryType = An AtkTextBoundary
367 	 * startOffset = the start offset of the returned string. [out]
368 	 * endOffset = the offset of the first character after the
369 	 * returned substring. [out]
370 	 * Returns: a newly allocated string containing the text at offset bounded by the specified boundary_type. Use g_free() to free the returned string.
371 	 */
372 	public string getTextAtOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
373 	{
374 		// gchar * atk_text_get_text_at_offset (AtkText *text,  gint offset,  AtkTextBoundary boundary_type,  gint *start_offset,  gint *end_offset);
375 		return Str.toString(atk_text_get_text_at_offset(atkText, offset, boundaryType, &startOffset, &endOffset));
376 	}
377 	
378 	/**
379 	 * Warning
380 	 * atk_text_get_text_before_offset is deprecated and should not be used in newly-written code. This method is deprecated since ATK version
381 	 * 2.9.3. Please use atk_text_get_string_at_offset() instead.
382 	 * Gets the specified text.
383 	 * Params:
384 	 * offset = position
385 	 * boundaryType = An AtkTextBoundary
386 	 * startOffset = the start offset of the returned string. [out]
387 	 * endOffset = the offset of the first character after the
388 	 * returned substring. [out]
389 	 * Returns: a newly allocated string containing the text before offset bounded by the specified boundary_type. Use g_free() to free the returned string.
390 	 */
391 	public string getTextBeforeOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
392 	{
393 		// gchar * atk_text_get_text_before_offset (AtkText *text,  gint offset,  AtkTextBoundary boundary_type,  gint *start_offset,  gint *end_offset);
394 		return Str.toString(atk_text_get_text_before_offset(atkText, offset, boundaryType, &startOffset, &endOffset));
395 	}
396 	
397 	/**
398 	 * Gets a portion of the text exposed through an AtkText according to a given offset
399 	 * and a specific granularity, along with the start and end offsets defining the
400 	 * boundaries of such a portion of text.
401 	 * If granularity is ATK_TEXT_GRANULARITY_CHAR the character at the
402 	 * offset is returned.
403 	 * If granularity is ATK_TEXT_GRANULARITY_WORD the returned string
404 	 * is from the word start at or before the offset to the word start after
405 	 * the offset.
406 	 * The returned string will contain the word at the offset if the offset
407 	 * is inside a word and will contain the word before the offset if the
408 	 * offset is not inside a word.
409 	 * If granularity is ATK_TEXT_GRANULARITY_SENTENCE the returned string
410 	 * is from the sentence start at or before the offset to the sentence
411 	 * start after the offset.
412 	 * The returned string will contain the sentence at the offset if the offset
413 	 * is inside a sentence and will contain the sentence before the offset
414 	 * if the offset is not inside a sentence.
415 	 * If granularity is ATK_TEXT_GRANULARITY_LINE the returned string
416 	 * is from the line start at or before the offset to the line
417 	 * start after the offset.
418 	 * If granularity is ATK_TEXT_GRANULARITY_PARAGRAPH the returned string
419 	 * is from the start of the paragraph at or before the offset to the start
420 	 * of the following paragraph after the offset.
421 	 * Since 2.9.4
422 	 * Params:
423 	 * offset = position
424 	 * granularity = An AtkTextGranularity
425 	 * startOffset = the start offset of the returned string, or -1
426 	 * if an error has occurred (e.g. invalid offset, not implemented). [out]
427 	 * endOffset = the offset of the first character after the returned string,
428 	 * or -1 if an error has occurred (e.g. invalid offset, not implemented). [out]
429 	 * Returns: a newly allocated string containing the text at the offset bounded by the specified granularity. Use g_free() to free the returned string. Returns NULL if the offset is invalid or no implementation is available.
430 	 */
431 	public string getStringAtOffset(int offset, AtkTextGranularity granularity, out int startOffset, out int endOffset)
432 	{
433 		// gchar * atk_text_get_string_at_offset (AtkText *text,  gint offset,  AtkTextGranularity granularity,  gint *start_offset,  gint *end_offset);
434 		return Str.toString(atk_text_get_string_at_offset(atkText, offset, granularity, &startOffset, &endOffset));
435 	}
436 	
437 	/**
438 	 * Gets the offset position of the caret (cursor).
439 	 * Returns: the offset position of the caret (cursor).
440 	 */
441 	public int getCaretOffset()
442 	{
443 		// gint atk_text_get_caret_offset (AtkText *text);
444 		return atk_text_get_caret_offset(atkText);
445 	}
446 	
447 	/**
448 	 * Get the bounding box containing the glyph representing the character at
449 	 *  a particular text offset.
450 	 * Params:
451 	 * offset = The offset of the text character for which bounding information is required.
452 	 * x = Pointer for the x cordinate of the bounding box
453 	 * y = Pointer for the y cordinate of the bounding box
454 	 * width = Pointer for the width of the bounding box
455 	 * height = Pointer for the height of the bounding box
456 	 * coords = specify whether coordinates are relative to the screen or widget window
457 	 */
458 	public void getCharacterExtents(int offset, out int x, out int y, out int width, out int height, AtkCoordType coords)
459 	{
460 		// void atk_text_get_character_extents (AtkText *text,  gint offset,  gint *x,  gint *y,  gint *width,  gint *height,  AtkCoordType coords);
461 		atk_text_get_character_extents(atkText, offset, &x, &y, &width, &height, coords);
462 	}
463 	
464 	/**
465 	 * Creates an AtkAttributeSet which consists of the attributes explicitly
466 	 * set at the position offset in the text. start_offset and end_offset are
467 	 * set to the start and end of the range around offset where the attributes are
468 	 * invariant. Note that end_offset is the offset of the first character
469 	 * after the range. See the enum AtkTextAttribute for types of text
470 	 * attributes that can be returned. Note that other attributes may also be
471 	 * returned.
472 	 * Params:
473 	 * offset = the offset at which to get the attributes, -1 means the offset of
474 	 * the character to be inserted at the caret location.
475 	 * startOffset = the address to put the start offset of the range. [out]
476 	 * endOffset = the address to put the end offset of the range. [out]
477 	 * Returns: an AtkAttributeSet which contains the attributes explicitly set at offset. This AtkAttributeSet should be freed by a call to atk_attribute_set_free(). [transfer full]
478 	 */
479 	public AtkAttributeSet* getRunAttributes(int offset, out int startOffset, out int endOffset)
480 	{
481 		// AtkAttributeSet * atk_text_get_run_attributes (AtkText *text,  gint offset,  gint *start_offset,  gint *end_offset);
482 		return atk_text_get_run_attributes(atkText, offset, &startOffset, &endOffset);
483 	}
484 	
485 	/**
486 	 * Creates an AtkAttributeSet which consists of the default values of
487 	 * attributes for the text. See the enum AtkTextAttribute for types of text
488 	 * attributes that can be returned. Note that other attributes may also be
489 	 * returned.
490 	 * Returns: an AtkAttributeSet which contains the default values of attributes. at offset. this atkattributeset should be freed by a call to atk_attribute_set_free(). [transfer full]
491 	 */
492 	public AtkAttributeSet* getDefaultAttributes()
493 	{
494 		// AtkAttributeSet * atk_text_get_default_attributes (AtkText *text);
495 		return atk_text_get_default_attributes(atkText);
496 	}
497 	
498 	/**
499 	 * Gets the character count.
500 	 * Returns: the number of characters.
501 	 */
502 	public int getCharacterCount()
503 	{
504 		// gint atk_text_get_character_count (AtkText *text);
505 		return atk_text_get_character_count(atkText);
506 	}
507 	
508 	/**
509 	 * Gets the offset of the character located at coordinates x and y. x and y
510 	 * are interpreted as being relative to the screen or this widget's window
511 	 * depending on coords.
512 	 * Params:
513 	 * x = screen x-position of character
514 	 * y = screen y-position of character
515 	 * coords = specify whether coordinates are relative to the screen or
516 	 * widget window
517 	 * Returns: the offset to the character which is located at the specified x and y coordinates.
518 	 */
519 	public int getOffsetAtPoint(int x, int y, AtkCoordType coords)
520 	{
521 		// gint atk_text_get_offset_at_point (AtkText *text,  gint x,  gint y,  AtkCoordType coords);
522 		return atk_text_get_offset_at_point(atkText, x, y, coords);
523 	}
524 	
525 	/**
526 	 * Get the ranges of text in the specified bounding box.
527 	 * Since 1.3
528 	 * Params:
529 	 * rect = An AtkTextRectangle giving the dimensions of the bounding box.
530 	 * coordType = Specify whether coordinates are relative to the screen or widget window.
531 	 * xClipType = Specify the horizontal clip type.
532 	 * yClipType = Specify the vertical clip type.
533 	 * Returns: Array of AtkTextRange. The last element of the array returned by this function will be NULL. Virtual: get_bounded_ranges. [array zero-terminated=1]
534 	 */
535 	public AtkTextRange** getBoundedRanges(AtkTextRectangle* rect, AtkCoordType coordType, AtkTextClipType xClipType, AtkTextClipType yClipType)
536 	{
537 		// AtkTextRange ** atk_text_get_bounded_ranges (AtkText *text,  AtkTextRectangle *rect,  AtkCoordType coord_type,  AtkTextClipType x_clip_type,  AtkTextClipType y_clip_type);
538 		return atk_text_get_bounded_ranges(atkText, rect, coordType, xClipType, yClipType);
539 	}
540 	
541 	/**
542 	 * Get the bounding box for text within the specified range.
543 	 * Since 1.3
544 	 * Params:
545 	 * startOffset = The offset of the first text character for which boundary
546 	 * information is required.
547 	 * endOffset = The offset of the text character after the last character
548 	 * for which boundary information is required.
549 	 * coordType = Specify whether coordinates are relative to the screen or widget window.
550 	 * rect = A pointer to a AtkTextRectangle which is filled in by this function.
551 	 */
552 	public void getRangeExtents(int startOffset, int endOffset, AtkCoordType coordType, AtkTextRectangle* rect)
553 	{
554 		// void atk_text_get_range_extents (AtkText *text,  gint start_offset,  gint end_offset,  AtkCoordType coord_type,  AtkTextRectangle *rect);
555 		atk_text_get_range_extents(atkText, startOffset, endOffset, coordType, rect);
556 	}
557 	
558 	/**
559 	 * Frees the memory associated with an array of AtkTextRange. It is assumed
560 	 * that the array was returned by the function atk_text_get_bounded_ranges
561 	 * and is NULL terminated.
562 	 * Since 1.3
563 	 * Params:
564 	 * ranges = A pointer to an array of AtkTextRange which is
565 	 * to be freed. [array]
566 	 */
567 	public static void freeRanges(AtkTextRange** ranges)
568 	{
569 		// void atk_text_free_ranges (AtkTextRange **ranges);
570 		atk_text_free_ranges(ranges);
571 	}
572 	
573 	/**
574 	 * Gets the number of selected regions.
575 	 * Returns: The number of selected regions, or -1 if a failure occurred.
576 	 */
577 	public int getNSelections()
578 	{
579 		// gint atk_text_get_n_selections (AtkText *text);
580 		return atk_text_get_n_selections(atkText);
581 	}
582 	
583 	/**
584 	 * Gets the text from the specified selection.
585 	 * Params:
586 	 * selectionNum = The selection number. The selected regions are
587 	 * assigned numbers that correspond to how far the region is from the
588 	 * start of the text. The selected region closest to the beginning
589 	 * of the text region is assigned the number 0, etc. Note that adding,
590 	 * moving or deleting a selected region can change the numbering.
591 	 * startOffset = passes back the start position of the selected region. [out]
592 	 * endOffset = passes back the end position of (e.g. offset immediately past)
593 	 * the selected region. [out]
594 	 * Returns: a newly allocated string containing the selected text. Use g_free() to free the returned string.
595 	 */
596 	public string getSelection(int selectionNum, out int startOffset, out int endOffset)
597 	{
598 		// gchar * atk_text_get_selection (AtkText *text,  gint selection_num,  gint *start_offset,  gint *end_offset);
599 		return Str.toString(atk_text_get_selection(atkText, selectionNum, &startOffset, &endOffset));
600 	}
601 	
602 	/**
603 	 * Adds a selection bounded by the specified offsets.
604 	 * Params:
605 	 * startOffset = the start position of the selected region
606 	 * endOffset = the offset of the first character after the selected region.
607 	 * Returns: TRUE if success, FALSE otherwise
608 	 */
609 	public int addSelection(int startOffset, int endOffset)
610 	{
611 		// gboolean atk_text_add_selection (AtkText *text,  gint start_offset,  gint end_offset);
612 		return atk_text_add_selection(atkText, startOffset, endOffset);
613 	}
614 	
615 	/**
616 	 * Removes the specified selection.
617 	 * Params:
618 	 * selectionNum = The selection number. The selected regions are
619 	 * assigned numbers that correspond to how far the region is from the
620 	 * start of the text. The selected region closest to the beginning
621 	 * of the text region is assigned the number 0, etc. Note that adding,
622 	 * moving or deleting a selected region can change the numbering.
623 	 * Returns: TRUE if success, FALSE otherwise
624 	 */
625 	public int removeSelection(int selectionNum)
626 	{
627 		// gboolean atk_text_remove_selection (AtkText *text,  gint selection_num);
628 		return atk_text_remove_selection(atkText, selectionNum);
629 	}
630 	
631 	/**
632 	 * Changes the start and end offset of the specified selection.
633 	 * Params:
634 	 * selectionNum = The selection number. The selected regions are
635 	 * assigned numbers that correspond to how far the region is from the
636 	 * start of the text. The selected region closest to the beginning
637 	 * of the text region is assigned the number 0, etc. Note that adding,
638 	 * moving or deleting a selected region can change the numbering.
639 	 * startOffset = the new start position of the selection
640 	 * endOffset = the new end position of (e.g. offset immediately past)
641 	 * the selection
642 	 * Returns: TRUE if success, FALSE otherwise
643 	 */
644 	public int setSelection(int selectionNum, int startOffset, int endOffset)
645 	{
646 		// gboolean atk_text_set_selection (AtkText *text,  gint selection_num,  gint start_offset,  gint end_offset);
647 		return atk_text_set_selection(atkText, selectionNum, startOffset, endOffset);
648 	}
649 	
650 	/**
651 	 * Sets the caret (cursor) position to the specified offset.
652 	 * Params:
653 	 * offset = position
654 	 * Returns: TRUE if success, FALSE otherwise.
655 	 */
656 	public int setCaretOffset(int offset)
657 	{
658 		// gboolean atk_text_set_caret_offset (AtkText *text,  gint offset);
659 		return atk_text_set_caret_offset(atkText, offset);
660 	}
661 	
662 	/**
663 	 * Frees the memory used by an AtkAttributeSet, including all its
664 	 * AtkAttributes.
665 	 * Params:
666 	 * attribSet = The AtkAttributeSet to free
667 	 */
668 	public static void atkAttributeSetFree(AtkAttributeSet* attribSet)
669 	{
670 		// void atk_attribute_set_free (AtkAttributeSet *attrib_set);
671 		atk_attribute_set_free(attribSet);
672 	}
673 	
674 	/**
675 	 * Associate name with a new AtkTextAttribute
676 	 * Params:
677 	 * name = a name string
678 	 * Returns: an AtkTextAttribute associated with name
679 	 */
680 	public static AtkTextAttribute attributeRegister(string name)
681 	{
682 		// AtkTextAttribute atk_text_attribute_register (const gchar *name);
683 		return atk_text_attribute_register(Str.toStringz(name));
684 	}
685 	
686 	/**
687 	 * Gets the name corresponding to the AtkTextAttribute
688 	 * Params:
689 	 * attr = The AtkTextAttribute whose name is required
690 	 * Returns: a string containing the name; this string should not be freed
691 	 */
692 	public static string attributeGetName(AtkTextAttribute attr)
693 	{
694 		// const gchar * atk_text_attribute_get_name (AtkTextAttribute attr);
695 		return Str.toString(atk_text_attribute_get_name(attr));
696 	}
697 	
698 	/**
699 	 * Get the AtkTextAttribute type corresponding to a text attribute name.
700 	 * Params:
701 	 * name = a string which is the (non-localized) name of an ATK text attribute.
702 	 * Returns: the AtkTextAttribute enumerated type corresponding to the specified name, or ATK_TEXT_ATTRIBUTE_INVALID if no matching text attribute is found.
703 	 */
704 	public static AtkTextAttribute attributeForName(string name)
705 	{
706 		// AtkTextAttribute atk_text_attribute_for_name (const gchar *name);
707 		return atk_text_attribute_for_name(Str.toStringz(name));
708 	}
709 	
710 	/**
711 	 * Gets the value for the index of the AtkTextAttribute
712 	 * Params:
713 	 * attr = The AtkTextAttribute for which a value is required
714 	 * index = The index of the required value
715 	 * Returns: a string containing the value; this string should not be freed; NULL is returned if there are no values maintained for the attr value. Signal Details The "text-attributes-changed" signal void user_function (AtkText *atktext, gpointer user_data) : Run Last The "text-attributes-changed" signal is emitted when the text attributes of the text of an object which implements AtkText changes.
716 	 */
717 	public static string attributeGetValue(AtkTextAttribute attr, int index)
718 	{
719 		// const gchar * atk_text_attribute_get_value (AtkTextAttribute attr,  gint index_);
720 		return Str.toString(atk_text_attribute_get_value(attr, index));
721 	}
722 }