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 		return Str.toString(atk_text_get_selection(getTextStruct(), selectionNum, &startOffset, &endOffset));
271 	}
272 
273 	/**
274 	 * Gets a portion of the text exposed through an #AtkText according to a given @offset
275 	 * and a specific @granularity, along with the start and end offsets defining the
276 	 * boundaries of such a portion of text.
277 	 *
278 	 * If @granularity is ATK_TEXT_GRANULARITY_CHAR the character at the
279 	 * offset is returned.
280 	 *
281 	 * If @granularity is ATK_TEXT_GRANULARITY_WORD the returned string
282 	 * is from the word start at or before the offset to the word start after
283 	 * the offset.
284 	 *
285 	 * The returned string will contain the word at the offset if the offset
286 	 * is inside a word and will contain the word before the offset if the
287 	 * offset is not inside a word.
288 	 *
289 	 * If @granularity is ATK_TEXT_GRANULARITY_SENTENCE the returned string
290 	 * is from the sentence start at or before the offset to the sentence
291 	 * start after the offset.
292 	 *
293 	 * The returned string will contain the sentence at the offset if the offset
294 	 * is inside a sentence and will contain the sentence before the offset
295 	 * if the offset is not inside a sentence.
296 	 *
297 	 * If @granularity is ATK_TEXT_GRANULARITY_LINE the returned string
298 	 * is from the line start at or before the offset to the line
299 	 * start after the offset.
300 	 *
301 	 * If @granularity is ATK_TEXT_GRANULARITY_PARAGRAPH the returned string
302 	 * is from the start of the paragraph at or before the offset to the start
303 	 * of the following paragraph after the offset.
304 	 *
305 	 * Params:
306 	 *     offset = position
307 	 *     granularity = An #AtkTextGranularity
308 	 *     startOffset = the start offset of the returned string, or -1
309 	 *         if an error has occurred (e.g. invalid offset, not implemented)
310 	 *     endOffset = the offset of the first character after the returned string,
311 	 *         or -1 if an error has occurred (e.g. invalid offset, not implemented)
312 	 *
313 	 * Return: a newly allocated string containing the text
314 	 *     at the @offset bounded by the specified @granularity. Use
315 	 *     g_free() to free the returned string.  Returns %NULL if the
316 	 *     offset is invalid or no implementation is available.
317 	 *
318 	 * Since: 2.10
319 	 */
320 	public string getStringAtOffset(int offset, AtkTextGranularity granularity, out int startOffset, out int endOffset)
321 	{
322 		return Str.toString(atk_text_get_string_at_offset(getTextStruct(), offset, granularity, &startOffset, &endOffset));
323 	}
324 
325 	/**
326 	 * Gets the specified text.
327 	 *
328 	 * Params:
329 	 *     startOffset = start position
330 	 *     endOffset = end position, or -1 for the end of the string.
331 	 *
332 	 * Return: a newly allocated string containing the text from @start_offset up
333 	 *     to, but not including @end_offset. Use g_free() to free the returned string.
334 	 */
335 	public string getText(int startOffset, int endOffset)
336 	{
337 		return Str.toString(atk_text_get_text(getTextStruct(), startOffset, endOffset));
338 	}
339 
340 	/**
341 	 * Gets the specified text.
342 	 *
343 	 * Deprecated: Please use atk_text_get_string_at_offset() instead.
344 	 *
345 	 * Params:
346 	 *     offset = position
347 	 *     boundaryType = An #AtkTextBoundary
348 	 *     startOffset = the start offset of the returned string
349 	 *     endOffset = the offset of the first character after the
350 	 *         returned substring
351 	 *
352 	 * Return: a newly allocated string containing the text after @offset bounded
353 	 *     by the specified @boundary_type. Use g_free() to free the returned string.
354 	 */
355 	public string getTextAfterOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
356 	{
357 		return Str.toString(atk_text_get_text_after_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset));
358 	}
359 
360 	/**
361 	 * Gets the specified text.
362 	 *
363 	 * If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character at the
364 	 * offset is returned.
365 	 *
366 	 * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string
367 	 * is from the word start at or before the offset to the word start after
368 	 * the offset.
369 	 *
370 	 * The returned string will contain the word at the offset if the offset
371 	 * is inside a word and will contain the word before the offset if the
372 	 * offset is not inside a word.
373 	 *
374 	 * If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned
375 	 * string is from the sentence start at or before the offset to the sentence
376 	 * start after the offset.
377 	 *
378 	 * The returned string will contain the sentence at the offset if the offset
379 	 * is inside a sentence and will contain the sentence before the offset
380 	 * if the offset is not inside a sentence.
381 	 *
382 	 * If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned
383 	 * string is from the line start at or before the offset to the line
384 	 * start after the offset.
385 	 *
386 	 * Deprecated: This method is deprecated since ATK version
387 	 * 2.9.4. Please use atk_text_get_string_at_offset() instead.
388 	 *
389 	 * Params:
390 	 *     offset = position
391 	 *     boundaryType = An #AtkTextBoundary
392 	 *     startOffset = the start offset of the returned string
393 	 *     endOffset = the offset of the first character after the
394 	 *         returned substring
395 	 *
396 	 * Return: a newly allocated string containing the text at @offset bounded by
397 	 *     the specified @boundary_type. Use g_free() to free the returned string.
398 	 */
399 	public string getTextAtOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
400 	{
401 		return Str.toString(atk_text_get_text_at_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset));
402 	}
403 
404 	/**
405 	 * Gets the specified text.
406 	 *
407 	 * Deprecated: Please use atk_text_get_string_at_offset() instead.
408 	 *
409 	 * Params:
410 	 *     offset = position
411 	 *     boundaryType = An #AtkTextBoundary
412 	 *     startOffset = the start offset of the returned string
413 	 *     endOffset = the offset of the first character after the
414 	 *         returned substring
415 	 *
416 	 * Return: a newly allocated string containing the text before @offset bounded
417 	 *     by the specified @boundary_type. Use g_free() to free the returned string.
418 	 */
419 	public string getTextBeforeOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
420 	{
421 		return Str.toString(atk_text_get_text_before_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset));
422 	}
423 
424 	/**
425 	 * Removes the specified selection.
426 	 *
427 	 * Params:
428 	 *     selectionNum = The selection number.  The selected regions are
429 	 *         assigned numbers that correspond to how far the region is from the
430 	 *         start of the text.  The selected region closest to the beginning
431 	 *         of the text region is assigned the number 0, etc.  Note that adding,
432 	 *         moving or deleting a selected region can change the numbering.
433 	 *
434 	 * Return: %TRUE if success, %FALSE otherwise
435 	 */
436 	public bool removeSelection(int selectionNum)
437 	{
438 		return atk_text_remove_selection(getTextStruct(), selectionNum) != 0;
439 	}
440 
441 	/**
442 	 * Sets the caret (cursor) position to the specified @offset.
443 	 *
444 	 * Params:
445 	 *     offset = position
446 	 *
447 	 * Return: %TRUE if success, %FALSE otherwise.
448 	 */
449 	public bool setCaretOffset(int offset)
450 	{
451 		return atk_text_set_caret_offset(getTextStruct(), offset) != 0;
452 	}
453 
454 	/**
455 	 * Changes the start and end offset of the specified selection.
456 	 *
457 	 * Params:
458 	 *     selectionNum = The selection number.  The selected regions are
459 	 *         assigned numbers that correspond to how far the region is from the
460 	 *         start of the text.  The selected region closest to the beginning
461 	 *         of the text region is assigned the number 0, etc.  Note that adding,
462 	 *         moving or deleting a selected region can change the numbering.
463 	 *     startOffset = the new start position of the selection
464 	 *     endOffset = the new end position of (e.g. offset immediately past)
465 	 *         the selection
466 	 *
467 	 * Return: %TRUE if success, %FALSE otherwise
468 	 */
469 	public bool setSelection(int selectionNum, int startOffset, int endOffset)
470 	{
471 		return atk_text_set_selection(getTextStruct(), selectionNum, startOffset, endOffset) != 0;
472 	}
473 
474 	int[string] connectedSignals;
475 
476 	void delegate(TextIF)[] _onTextAttributesChangedListeners;
477 	@property void delegate(TextIF)[] onTextAttributesChangedListeners()
478 	{
479 		return _onTextAttributesChangedListeners;
480 	}
481 	/**
482 	 * The "text-attributes-changed" signal is emitted when the text
483 	 * attributes of the text of an object which implements AtkText
484 	 * changes.
485 	 */
486 	void addOnTextAttributesChanged(void delegate(TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
487 	{
488 		if ( "text-attributes-changed" !in connectedSignals )
489 		{
490 			Signals.connectData(
491 				this,
492 				"text-attributes-changed",
493 				cast(GCallback)&callBackTextAttributesChanged,
494 				cast(void*)cast(TextIF)this,
495 				null,
496 				connectFlags);
497 			connectedSignals["text-attributes-changed"] = 1;
498 		}
499 		_onTextAttributesChangedListeners ~= dlg;
500 	}
501 	extern(C) static void callBackTextAttributesChanged(AtkText* textStruct, TextIF _text)
502 	{
503 		foreach ( void delegate(TextIF) dlg; _text.onTextAttributesChangedListeners )
504 		{
505 			dlg(_text);
506 		}
507 	}
508 
509 	void delegate(int, TextIF)[] _onTextCaretMovedListeners;
510 	@property void delegate(int, TextIF)[] onTextCaretMovedListeners()
511 	{
512 		return _onTextCaretMovedListeners;
513 	}
514 	/**
515 	 * The "text-caret-moved" signal is emitted when the caret
516 	 * position of the text of an object which implements AtkText
517 	 * changes.
518 	 *
519 	 * Params:
520 	 *     arg1 = The new position of the text caret.
521 	 */
522 	void addOnTextCaretMoved(void delegate(int, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
523 	{
524 		if ( "text-caret-moved" !in connectedSignals )
525 		{
526 			Signals.connectData(
527 				this,
528 				"text-caret-moved",
529 				cast(GCallback)&callBackTextCaretMoved,
530 				cast(void*)cast(TextIF)this,
531 				null,
532 				connectFlags);
533 			connectedSignals["text-caret-moved"] = 1;
534 		}
535 		_onTextCaretMovedListeners ~= dlg;
536 	}
537 	extern(C) static void callBackTextCaretMoved(AtkText* textStruct, int arg1, TextIF _text)
538 	{
539 		foreach ( void delegate(int, TextIF) dlg; _text.onTextCaretMovedListeners )
540 		{
541 			dlg(arg1, _text);
542 		}
543 	}
544 
545 	void delegate(int, int, TextIF)[] _onTextChangedListeners;
546 	@property void delegate(int, int, TextIF)[] onTextChangedListeners()
547 	{
548 		return _onTextChangedListeners;
549 	}
550 	/**
551 	 * The "text-changed" signal is emitted when the text of the
552 	 * object which implements the AtkText interface changes, This
553 	 * signal will have a detail which is either "insert" or
554 	 * "delete" which identifies whether the text change was an
555 	 * insertion or a deletion.
556 	 *
557 	 * Deprecated: Use #AtkObject::text-insert or
558 	 * #AtkObject::text-remove instead.
559 	 *
560 	 * Params:
561 	 *     arg1 = The position (character offset) of the insertion or deletion.
562 	 *     arg2 = The length (in characters) of text inserted or deleted.
563 	 */
564 	void addOnTextChanged(void delegate(int, int, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
565 	{
566 		if ( "text-changed" !in connectedSignals )
567 		{
568 			Signals.connectData(
569 				this,
570 				"text-changed",
571 				cast(GCallback)&callBackTextChanged,
572 				cast(void*)cast(TextIF)this,
573 				null,
574 				connectFlags);
575 			connectedSignals["text-changed"] = 1;
576 		}
577 		_onTextChangedListeners ~= dlg;
578 	}
579 	extern(C) static void callBackTextChanged(AtkText* textStruct, int arg1, int arg2, TextIF _text)
580 	{
581 		foreach ( void delegate(int, int, TextIF) dlg; _text.onTextChangedListeners )
582 		{
583 			dlg(arg1, arg2, _text);
584 		}
585 	}
586 
587 	void delegate(int, int, string, TextIF)[] _onTextInsertListeners;
588 	@property void delegate(int, int, string, TextIF)[] onTextInsertListeners()
589 	{
590 		return _onTextInsertListeners;
591 	}
592 	/**
593 	 * The "text-insert" signal is emitted when a new text is
594 	 * inserted. If the signal was not triggered by the user
595 	 * (e.g. typing or pasting text), the "system" detail should be
596 	 * included.
597 	 *
598 	 * Params:
599 	 *     arg1 = The position (character offset) of the insertion.
600 	 *     arg2 = The length (in characters) of text inserted.
601 	 *     arg3 = The new text inserted
602 	 */
603 	void addOnTextInsert(void delegate(int, int, string, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
604 	{
605 		if ( "text-insert" !in connectedSignals )
606 		{
607 			Signals.connectData(
608 				this,
609 				"text-insert",
610 				cast(GCallback)&callBackTextInsert,
611 				cast(void*)cast(TextIF)this,
612 				null,
613 				connectFlags);
614 			connectedSignals["text-insert"] = 1;
615 		}
616 		_onTextInsertListeners ~= dlg;
617 	}
618 	extern(C) static void callBackTextInsert(AtkText* textStruct, int arg1, int arg2, char* arg3, TextIF _text)
619 	{
620 		foreach ( void delegate(int, int, string, TextIF) dlg; _text.onTextInsertListeners )
621 		{
622 			dlg(arg1, arg2, Str.toString(arg3), _text);
623 		}
624 	}
625 
626 	void delegate(int, int, string, TextIF)[] _onTextRemoveListeners;
627 	@property void delegate(int, int, string, TextIF)[] onTextRemoveListeners()
628 	{
629 		return _onTextRemoveListeners;
630 	}
631 	/**
632 	 * The "text-remove" signal is emitted when a new text is
633 	 * removed. If the signal was not triggered by the user
634 	 * (e.g. typing or pasting text), the "system" detail should be
635 	 * included.
636 	 *
637 	 * Params:
638 	 *     arg1 = The position (character offset) of the removal.
639 	 *     arg2 = The length (in characters) of text removed.
640 	 *     arg3 = The old text removed
641 	 */
642 	void addOnTextRemove(void delegate(int, int, string, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
643 	{
644 		if ( "text-remove" !in connectedSignals )
645 		{
646 			Signals.connectData(
647 				this,
648 				"text-remove",
649 				cast(GCallback)&callBackTextRemove,
650 				cast(void*)cast(TextIF)this,
651 				null,
652 				connectFlags);
653 			connectedSignals["text-remove"] = 1;
654 		}
655 		_onTextRemoveListeners ~= dlg;
656 	}
657 	extern(C) static void callBackTextRemove(AtkText* textStruct, int arg1, int arg2, char* arg3, TextIF _text)
658 	{
659 		foreach ( void delegate(int, int, string, TextIF) dlg; _text.onTextRemoveListeners )
660 		{
661 			dlg(arg1, arg2, Str.toString(arg3), _text);
662 		}
663 	}
664 
665 	void delegate(TextIF)[] _onTextSelectionChangedListeners;
666 	@property void delegate(TextIF)[] onTextSelectionChangedListeners()
667 	{
668 		return _onTextSelectionChangedListeners;
669 	}
670 	/**
671 	 * The "text-selection-changed" signal is emitted when the
672 	 * selected text of an object which implements AtkText changes.
673 	 */
674 	void addOnTextSelectionChanged(void delegate(TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
675 	{
676 		if ( "text-selection-changed" !in connectedSignals )
677 		{
678 			Signals.connectData(
679 				this,
680 				"text-selection-changed",
681 				cast(GCallback)&callBackTextSelectionChanged,
682 				cast(void*)cast(TextIF)this,
683 				null,
684 				connectFlags);
685 			connectedSignals["text-selection-changed"] = 1;
686 		}
687 		_onTextSelectionChangedListeners ~= dlg;
688 	}
689 	extern(C) static void callBackTextSelectionChanged(AtkText* textStruct, TextIF _text)
690 	{
691 		foreach ( void delegate(TextIF) dlg; _text.onTextSelectionChangedListeners )
692 		{
693 			dlg(_text);
694 		}
695 	}
696 
697 	/**
698 	 * Frees the memory used by an #AtkAttributeSet, including all its
699 	 * #AtkAttributes.
700 	 *
701 	 * Params:
702 	 *     attribSet = The #AtkAttributeSet to free
703 	 */
704 	public static void attributeSetFree(AtkAttributeSet* attribSet)
705 	{
706 		atk_attribute_set_free(attribSet);
707 	}
708 
709 	/**
710 	 * Get the #AtkTextAttribute type corresponding to a text attribute name.
711 	 *
712 	 * Params:
713 	 *     name = a string which is the (non-localized) name of an ATK text attribute.
714 	 *
715 	 * Return: the #AtkTextAttribute enumerated type corresponding to the specified
716 	 *     name,
717 	 *     or #ATK_TEXT_ATTRIBUTE_INVALID if no matching text attribute is found.
718 	 */
719 	public static AtkTextAttribute attributeForName(string name)
720 	{
721 		return atk_text_attribute_for_name(Str.toStringz(name));
722 	}
723 
724 	/**
725 	 * Gets the name corresponding to the #AtkTextAttribute
726 	 *
727 	 * Params:
728 	 *     attr = The #AtkTextAttribute whose name is required
729 	 *
730 	 * Return: a string containing the name; this string should not be freed
731 	 */
732 	public static string attributeGetName(AtkTextAttribute attr)
733 	{
734 		return Str.toString(atk_text_attribute_get_name(attr));
735 	}
736 
737 	/**
738 	 * Gets the value for the index of the #AtkTextAttribute
739 	 *
740 	 * Params:
741 	 *     attr = The #AtkTextAttribute for which a value is required
742 	 *     index = The index of the required value
743 	 *
744 	 * Return: a string containing the value; this string
745 	 *     should not be freed; %NULL is returned if there are no values
746 	 *     maintained for the attr value.
747 	 */
748 	public static string attributeGetValue(AtkTextAttribute attr, int index)
749 	{
750 		return Str.toString(atk_text_attribute_get_value(attr, index));
751 	}
752 
753 	/**
754 	 * Associate @name with a new #AtkTextAttribute
755 	 *
756 	 * Params:
757 	 *     name = a name string
758 	 *
759 	 * Return: an #AtkTextAttribute associated with @name
760 	 */
761 	public static AtkTextAttribute attributeRegister(string name)
762 	{
763 		return atk_text_attribute_register(Str.toStringz(name));
764 	}
765 }