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