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