This file is indexed.

/usr/include/d/gtkd-3/atk/TextT.d is in libgtkd-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module atk.TextT;

public  import atk.TextRange;
public  import atk.c.functions;
public  import atk.c.types;
public  import glib.Str;
public  import gobject.ObjectG;
public  import gobject.Signals;
public  import gtkc.atktypes;
public  import std.algorithm;


/**
 * #AtkText should be implemented by #AtkObjects on behalf of widgets
 * that have text content which is either attributed or otherwise
 * non-trivial.  #AtkObjects whose text content is simple,
 * unattributed, and very brief may expose that content via
 * #atk_object_get_name instead; however if the text is editable,
 * multi-line, typically longer than three or four words, attributed,
 * selectable, or if the object already uses the 'name' ATK property
 * for other information, the #AtkText interface should be used to
 * expose the text content.  In the case of editable text content,
 * #AtkEditableText (a subtype of the #AtkText interface) should be
 * implemented instead.
 * 
 * #AtkText provides not only traversal facilities and change
 * notification for text content, but also caret tracking and glyph
 * bounding box calculations.  Note that the text strings are exposed
 * as UTF-8, and are therefore potentially multi-byte, and
 * caret-to-byte offset mapping makes no assumptions about the
 * character length; also bounding box glyph-to-offset mapping may be
 * complex for languages which use ligatures.
 */
public template TextT(TStruct)
{
	/** Get the main Gtk struct */
	public AtkText* getTextStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return cast(AtkText*)getStruct();
	}


	/**
	 * Adds a selection bounded by the specified offsets.
	 *
	 * Params:
	 *     startOffset = the start position of the selected region
	 *     endOffset = the offset of the first character after the selected region.
	 *
	 * Returns: %TRUE if success, %FALSE otherwise
	 */
	public bool addSelection(int startOffset, int endOffset)
	{
		return atk_text_add_selection(getTextStruct(), startOffset, endOffset) != 0;
	}

	/**
	 * Get the ranges of text in the specified bounding box.
	 *
	 * Params:
	 *     rect = An AtkTextRectangle giving the dimensions of the bounding box.
	 *     coordType = Specify whether coordinates are relative to the screen or widget window.
	 *     xClipType = Specify the horizontal clip type.
	 *     yClipType = Specify the vertical clip type.
	 *
	 * Returns: Array of AtkTextRange. The last
	 *     element of the array returned by this function will be NULL.
	 *
	 * Since: 1.3
	 */
	public TextRange[] getBoundedRanges(AtkTextRectangle* rect, AtkCoordType coordType, AtkTextClipType xClipType, AtkTextClipType yClipType)
	{
		auto p = atk_text_get_bounded_ranges(getTextStruct(), rect, coordType, xClipType, yClipType);

		if(p is null)
		{
			return null;
		}

		TextRange[] arr = new TextRange[getArrayLength(p)];
		for(int i = 0; i < getArrayLength(p); i++)
		{
			arr[i] = ObjectG.getDObject!(TextRange)(cast(AtkTextRange*) p[i]);
		}

		return arr;
	}

	/**
	 * Gets the offset position of the caret (cursor).
	 *
	 * Returns: the offset position of the caret (cursor).
	 */
	public int getCaretOffset()
	{
		return atk_text_get_caret_offset(getTextStruct());
	}

	/**
	 * Gets the specified text.
	 *
	 * Params:
	 *     offset = position
	 *
	 * Returns: the character at @offset.
	 */
	public dchar getCharacterAtOffset(int offset)
	{
		return atk_text_get_character_at_offset(getTextStruct(), offset);
	}

	/**
	 * Gets the character count.
	 *
	 * Returns: the number of characters.
	 */
	public int getCharacterCount()
	{
		return atk_text_get_character_count(getTextStruct());
	}

	/**
	 * Get the bounding box containing the glyph representing the character at
	 * a particular text offset.
	 *
	 * Params:
	 *     offset = The offset of the text character for which bounding information is required.
	 *     x = Pointer for the x cordinate of the bounding box
	 *     y = Pointer for the y cordinate of the bounding box
	 *     width = Pointer for the width of the bounding box
	 *     height = Pointer for the height of the bounding box
	 *     coords = specify whether coordinates are relative to the screen or widget window
	 */
	public void getCharacterExtents(int offset, out int x, out int y, out int width, out int height, AtkCoordType coords)
	{
		atk_text_get_character_extents(getTextStruct(), offset, &x, &y, &width, &height, coords);
	}

	/**
	 * Creates an #AtkAttributeSet which consists of the default values of
	 * attributes for the text. See the enum AtkTextAttribute for types of text
	 * attributes that can be returned. Note that other attributes may also be
	 * returned.
	 *
	 * 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().
	 */
	public AtkAttributeSet* getDefaultAttributes()
	{
		return atk_text_get_default_attributes(getTextStruct());
	}

	/**
	 * Gets the number of selected regions.
	 *
	 * Returns: The number of selected regions, or -1 if a failure
	 *     occurred.
	 */
	public int getNSelections()
	{
		return atk_text_get_n_selections(getTextStruct());
	}

	/**
	 * Gets the offset of the character located at coordinates @x and @y. @x and @y
	 * are interpreted as being relative to the screen or this widget's window
	 * depending on @coords.
	 *
	 * Params:
	 *     x = screen x-position of character
	 *     y = screen y-position of character
	 *     coords = specify whether coordinates are relative to the screen or
	 *         widget window
	 *
	 * Returns: the offset to the character which is located at
	 *     the specified @x and @y coordinates.
	 */
	public int getOffsetAtPoint(int x, int y, AtkCoordType coords)
	{
		return atk_text_get_offset_at_point(getTextStruct(), x, y, coords);
	}

	/**
	 * Get the bounding box for text within the specified range.
	 *
	 * Params:
	 *     startOffset = The offset of the first text character for which boundary
	 *         information is required.
	 *     endOffset = The offset of the text character after the last character
	 *         for which boundary information is required.
	 *     coordType = Specify whether coordinates are relative to the screen or widget window.
	 *     rect = A pointer to a AtkTextRectangle which is filled in by this function.
	 *
	 * Since: 1.3
	 */
	public void getRangeExtents(int startOffset, int endOffset, AtkCoordType coordType, out AtkTextRectangle rect)
	{
		atk_text_get_range_extents(getTextStruct(), startOffset, endOffset, coordType, &rect);
	}

	/**
	 * Creates an #AtkAttributeSet which consists of the attributes explicitly
	 * set at the position @offset in the text. @start_offset and @end_offset are
	 * set to the start and end of the range around @offset where the attributes are
	 * invariant. Note that @end_offset is the offset of the first character
	 * after the range.  See the enum AtkTextAttribute for types of text
	 * attributes that can be returned. Note that other attributes may also be
	 * returned.
	 *
	 * Params:
	 *     offset = the offset at which to get the attributes, -1 means the offset of
	 *         the character to be inserted at the caret location.
	 *     startOffset = the address to put the start offset of the range
	 *     endOffset = the address to put the end offset of the range
	 *
	 * Returns: an #AtkAttributeSet which contains the attributes
	 *     explicitly set at @offset. This #AtkAttributeSet should be freed by a call
	 *     to atk_attribute_set_free().
	 */
	public AtkAttributeSet* getRunAttributes(int offset, out int startOffset, out int endOffset)
	{
		return atk_text_get_run_attributes(getTextStruct(), offset, &startOffset, &endOffset);
	}

	/**
	 * Gets the text from the specified selection.
	 *
	 * Params:
	 *     selectionNum = The selection number.  The selected regions are
	 *         assigned numbers that correspond to how far the region is from the
	 *         start of the text.  The selected region closest to the beginning
	 *         of the text region is assigned the number 0, etc.  Note that adding,
	 *         moving or deleting a selected region can change the numbering.
	 *     startOffset = passes back the start position of the selected region
	 *     endOffset = passes back the end position of (e.g. offset immediately past)
	 *         the selected region
	 *
	 * Returns: a newly allocated string containing the selected text. Use g_free()
	 *     to free the returned string.
	 */
	public string getSelection(int selectionNum, out int startOffset, out int endOffset)
	{
		auto retStr = atk_text_get_selection(getTextStruct(), selectionNum, &startOffset, &endOffset);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Gets a portion of the text exposed through an #AtkText according to a given @offset
	 * and a specific @granularity, along with the start and end offsets defining the
	 * boundaries of such a portion of text.
	 *
	 * If @granularity is ATK_TEXT_GRANULARITY_CHAR the character at the
	 * offset is returned.
	 *
	 * If @granularity is ATK_TEXT_GRANULARITY_WORD the returned string
	 * is from the word start at or before the offset to the word start after
	 * the offset.
	 *
	 * The returned string will contain the word at the offset if the offset
	 * is inside a word and will contain the word before the offset if the
	 * offset is not inside a word.
	 *
	 * If @granularity is ATK_TEXT_GRANULARITY_SENTENCE the returned string
	 * is from the sentence start at or before the offset to the sentence
	 * start after the offset.
	 *
	 * The returned string will contain the sentence at the offset if the offset
	 * is inside a sentence and will contain the sentence before the offset
	 * if the offset is not inside a sentence.
	 *
	 * If @granularity is ATK_TEXT_GRANULARITY_LINE the returned string
	 * is from the line start at or before the offset to the line
	 * start after the offset.
	 *
	 * If @granularity is ATK_TEXT_GRANULARITY_PARAGRAPH the returned string
	 * is from the start of the paragraph at or before the offset to the start
	 * of the following paragraph after the offset.
	 *
	 * Params:
	 *     offset = position
	 *     granularity = An #AtkTextGranularity
	 *     startOffset = the start offset of the returned string, or -1
	 *         if an error has occurred (e.g. invalid offset, not implemented)
	 *     endOffset = the offset of the first character after the returned string,
	 *         or -1 if an error has occurred (e.g. invalid offset, not implemented)
	 *
	 * 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.
	 *
	 * Since: 2.10
	 */
	public string getStringAtOffset(int offset, AtkTextGranularity granularity, out int startOffset, out int endOffset)
	{
		auto retStr = atk_text_get_string_at_offset(getTextStruct(), offset, granularity, &startOffset, &endOffset);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Gets the specified text.
	 *
	 * Params:
	 *     startOffset = start position
	 *     endOffset = end position, or -1 for the end of the string.
	 *
	 * 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.
	 */
	public string getText(int startOffset, int endOffset)
	{
		auto retStr = atk_text_get_text(getTextStruct(), startOffset, endOffset);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Gets the specified text.
	 *
	 * Deprecated: Please use atk_text_get_string_at_offset() instead.
	 *
	 * Params:
	 *     offset = position
	 *     boundaryType = An #AtkTextBoundary
	 *     startOffset = the start offset of the returned string
	 *     endOffset = the offset of the first character after the
	 *         returned substring
	 *
	 * Returns: a newly allocated string containing the text after @offset bounded
	 *     by the specified @boundary_type. Use g_free() to free the returned string.
	 */
	public string getTextAfterOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
	{
		auto retStr = atk_text_get_text_after_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Gets the specified text.
	 *
	 * If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character at the
	 * offset is returned.
	 *
	 * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string
	 * is from the word start at or before the offset to the word start after
	 * the offset.
	 *
	 * The returned string will contain the word at the offset if the offset
	 * is inside a word and will contain the word before the offset if the
	 * offset is not inside a word.
	 *
	 * If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned
	 * string is from the sentence start at or before the offset to the sentence
	 * start after the offset.
	 *
	 * The returned string will contain the sentence at the offset if the offset
	 * is inside a sentence and will contain the sentence before the offset
	 * if the offset is not inside a sentence.
	 *
	 * If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned
	 * string is from the line start at or before the offset to the line
	 * start after the offset.
	 *
	 * Deprecated: This method is deprecated since ATK version
	 * 2.9.4. Please use atk_text_get_string_at_offset() instead.
	 *
	 * Params:
	 *     offset = position
	 *     boundaryType = An #AtkTextBoundary
	 *     startOffset = the start offset of the returned string
	 *     endOffset = the offset of the first character after the
	 *         returned substring
	 *
	 * Returns: a newly allocated string containing the text at @offset bounded by
	 *     the specified @boundary_type. Use g_free() to free the returned string.
	 */
	public string getTextAtOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
	{
		auto retStr = atk_text_get_text_at_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Gets the specified text.
	 *
	 * Deprecated: Please use atk_text_get_string_at_offset() instead.
	 *
	 * Params:
	 *     offset = position
	 *     boundaryType = An #AtkTextBoundary
	 *     startOffset = the start offset of the returned string
	 *     endOffset = the offset of the first character after the
	 *         returned substring
	 *
	 * Returns: a newly allocated string containing the text before @offset bounded
	 *     by the specified @boundary_type. Use g_free() to free the returned string.
	 */
	public string getTextBeforeOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset)
	{
		auto retStr = atk_text_get_text_before_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset);

		scope(exit) Str.freeString(retStr);
		return Str.toString(retStr);
	}

	/**
	 * Removes the specified selection.
	 *
	 * Params:
	 *     selectionNum = The selection number.  The selected regions are
	 *         assigned numbers that correspond to how far the region is from the
	 *         start of the text.  The selected region closest to the beginning
	 *         of the text region is assigned the number 0, etc.  Note that adding,
	 *         moving or deleting a selected region can change the numbering.
	 *
	 * Returns: %TRUE if success, %FALSE otherwise
	 */
	public bool removeSelection(int selectionNum)
	{
		return atk_text_remove_selection(getTextStruct(), selectionNum) != 0;
	}

	/**
	 * Sets the caret (cursor) position to the specified @offset.
	 *
	 * Params:
	 *     offset = position
	 *
	 * Returns: %TRUE if success, %FALSE otherwise.
	 */
	public bool setCaretOffset(int offset)
	{
		return atk_text_set_caret_offset(getTextStruct(), offset) != 0;
	}

	/**
	 * Changes the start and end offset of the specified selection.
	 *
	 * Params:
	 *     selectionNum = The selection number.  The selected regions are
	 *         assigned numbers that correspond to how far the region is from the
	 *         start of the text.  The selected region closest to the beginning
	 *         of the text region is assigned the number 0, etc.  Note that adding,
	 *         moving or deleting a selected region can change the numbering.
	 *     startOffset = the new start position of the selection
	 *     endOffset = the new end position of (e.g. offset immediately past)
	 *         the selection
	 *
	 * Returns: %TRUE if success, %FALSE otherwise
	 */
	public bool setSelection(int selectionNum, int startOffset, int endOffset)
	{
		return atk_text_set_selection(getTextStruct(), selectionNum, startOffset, endOffset) != 0;
	}

	protected class OnTextAttributesChangedDelegateWrapper
	{
		void delegate(TextIF) dlg;
		gulong handlerId;

		this(void delegate(TextIF) dlg)
		{
			this.dlg = dlg;
			onTextAttributesChangedListeners ~= this;
		}

		void remove(OnTextAttributesChangedDelegateWrapper source)
		{
			foreach(index, wrapper; onTextAttributesChangedListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onTextAttributesChangedListeners[index] = null;
					onTextAttributesChangedListeners = std.algorithm.remove(onTextAttributesChangedListeners, index);
					break;
				}
			}
		}
	}
	OnTextAttributesChangedDelegateWrapper[] onTextAttributesChangedListeners;

	/**
	 * The "text-attributes-changed" signal is emitted when the text
	 * attributes of the text of an object which implements AtkText
	 * changes.
	 */
	gulong addOnTextAttributesChanged(void delegate(TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnTextAttributesChangedDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"text-attributes-changed",
			cast(GCallback)&callBackTextAttributesChanged,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackTextAttributesChangedDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackTextAttributesChanged(AtkText* textStruct, OnTextAttributesChangedDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackTextAttributesChangedDestroy(OnTextAttributesChangedDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnTextCaretMovedDelegateWrapper
	{
		void delegate(int, TextIF) dlg;
		gulong handlerId;

		this(void delegate(int, TextIF) dlg)
		{
			this.dlg = dlg;
			onTextCaretMovedListeners ~= this;
		}

		void remove(OnTextCaretMovedDelegateWrapper source)
		{
			foreach(index, wrapper; onTextCaretMovedListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onTextCaretMovedListeners[index] = null;
					onTextCaretMovedListeners = std.algorithm.remove(onTextCaretMovedListeners, index);
					break;
				}
			}
		}
	}
	OnTextCaretMovedDelegateWrapper[] onTextCaretMovedListeners;

	/**
	 * The "text-caret-moved" signal is emitted when the caret
	 * position of the text of an object which implements AtkText
	 * changes.
	 *
	 * Params:
	 *     arg1 = The new position of the text caret.
	 */
	gulong addOnTextCaretMoved(void delegate(int, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnTextCaretMovedDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"text-caret-moved",
			cast(GCallback)&callBackTextCaretMoved,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackTextCaretMovedDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackTextCaretMoved(AtkText* textStruct, int arg1, OnTextCaretMovedDelegateWrapper wrapper)
	{
		wrapper.dlg(arg1, wrapper.outer);
	}

	extern(C) static void callBackTextCaretMovedDestroy(OnTextCaretMovedDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnTextChangedDelegateWrapper
	{
		void delegate(int, int, TextIF) dlg;
		gulong handlerId;

		this(void delegate(int, int, TextIF) dlg)
		{
			this.dlg = dlg;
			onTextChangedListeners ~= this;
		}

		void remove(OnTextChangedDelegateWrapper source)
		{
			foreach(index, wrapper; onTextChangedListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onTextChangedListeners[index] = null;
					onTextChangedListeners = std.algorithm.remove(onTextChangedListeners, index);
					break;
				}
			}
		}
	}
	OnTextChangedDelegateWrapper[] onTextChangedListeners;

	/**
	 * The "text-changed" signal is emitted when the text of the
	 * object which implements the AtkText interface changes, This
	 * signal will have a detail which is either "insert" or
	 * "delete" which identifies whether the text change was an
	 * insertion or a deletion.
	 *
	 * Deprecated: Use #AtkObject::text-insert or
	 * #AtkObject::text-remove instead.
	 *
	 * Params:
	 *     arg1 = The position (character offset) of the insertion or deletion.
	 *     arg2 = The length (in characters) of text inserted or deleted.
	 */
	gulong addOnTextChanged(void delegate(int, int, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnTextChangedDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"text-changed",
			cast(GCallback)&callBackTextChanged,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackTextChangedDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackTextChanged(AtkText* textStruct, int arg1, int arg2, OnTextChangedDelegateWrapper wrapper)
	{
		wrapper.dlg(arg1, arg2, wrapper.outer);
	}

	extern(C) static void callBackTextChangedDestroy(OnTextChangedDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnTextInsertDelegateWrapper
	{
		void delegate(int, int, string, TextIF) dlg;
		gulong handlerId;

		this(void delegate(int, int, string, TextIF) dlg)
		{
			this.dlg = dlg;
			onTextInsertListeners ~= this;
		}

		void remove(OnTextInsertDelegateWrapper source)
		{
			foreach(index, wrapper; onTextInsertListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onTextInsertListeners[index] = null;
					onTextInsertListeners = std.algorithm.remove(onTextInsertListeners, index);
					break;
				}
			}
		}
	}
	OnTextInsertDelegateWrapper[] onTextInsertListeners;

	/**
	 * The "text-insert" signal is emitted when a new text is
	 * inserted. If the signal was not triggered by the user
	 * (e.g. typing or pasting text), the "system" detail should be
	 * included.
	 *
	 * Params:
	 *     arg1 = The position (character offset) of the insertion.
	 *     arg2 = The length (in characters) of text inserted.
	 *     arg3 = The new text inserted
	 */
	gulong addOnTextInsert(void delegate(int, int, string, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnTextInsertDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"text-insert",
			cast(GCallback)&callBackTextInsert,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackTextInsertDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackTextInsert(AtkText* textStruct, int arg1, int arg2, char* arg3, OnTextInsertDelegateWrapper wrapper)
	{
		wrapper.dlg(arg1, arg2, Str.toString(arg3), wrapper.outer);
	}

	extern(C) static void callBackTextInsertDestroy(OnTextInsertDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnTextRemoveDelegateWrapper
	{
		void delegate(int, int, string, TextIF) dlg;
		gulong handlerId;

		this(void delegate(int, int, string, TextIF) dlg)
		{
			this.dlg = dlg;
			onTextRemoveListeners ~= this;
		}

		void remove(OnTextRemoveDelegateWrapper source)
		{
			foreach(index, wrapper; onTextRemoveListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onTextRemoveListeners[index] = null;
					onTextRemoveListeners = std.algorithm.remove(onTextRemoveListeners, index);
					break;
				}
			}
		}
	}
	OnTextRemoveDelegateWrapper[] onTextRemoveListeners;

	/**
	 * The "text-remove" signal is emitted when a new text is
	 * removed. If the signal was not triggered by the user
	 * (e.g. typing or pasting text), the "system" detail should be
	 * included.
	 *
	 * Params:
	 *     arg1 = The position (character offset) of the removal.
	 *     arg2 = The length (in characters) of text removed.
	 *     arg3 = The old text removed
	 */
	gulong addOnTextRemove(void delegate(int, int, string, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnTextRemoveDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"text-remove",
			cast(GCallback)&callBackTextRemove,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackTextRemoveDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackTextRemove(AtkText* textStruct, int arg1, int arg2, char* arg3, OnTextRemoveDelegateWrapper wrapper)
	{
		wrapper.dlg(arg1, arg2, Str.toString(arg3), wrapper.outer);
	}

	extern(C) static void callBackTextRemoveDestroy(OnTextRemoveDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnTextSelectionChangedDelegateWrapper
	{
		void delegate(TextIF) dlg;
		gulong handlerId;

		this(void delegate(TextIF) dlg)
		{
			this.dlg = dlg;
			onTextSelectionChangedListeners ~= this;
		}

		void remove(OnTextSelectionChangedDelegateWrapper source)
		{
			foreach(index, wrapper; onTextSelectionChangedListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onTextSelectionChangedListeners[index] = null;
					onTextSelectionChangedListeners = std.algorithm.remove(onTextSelectionChangedListeners, index);
					break;
				}
			}
		}
	}
	OnTextSelectionChangedDelegateWrapper[] onTextSelectionChangedListeners;

	/**
	 * The "text-selection-changed" signal is emitted when the
	 * selected text of an object which implements AtkText changes.
	 */
	gulong addOnTextSelectionChanged(void delegate(TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnTextSelectionChangedDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"text-selection-changed",
			cast(GCallback)&callBackTextSelectionChanged,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackTextSelectionChangedDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackTextSelectionChanged(AtkText* textStruct, OnTextSelectionChangedDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackTextSelectionChangedDestroy(OnTextSelectionChangedDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}
}