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