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.EditableTextT;
26 
27 public  import atk.c.functions;
28 public  import atk.c.types;
29 public  import glib.Str;
30 public  import gtkc.atktypes;
31 
32 
33 /**
34  * #AtkEditableText should be implemented by UI components which
35  * contain text which the user can edit, via the #AtkObject
36  * corresponding to that component (see #AtkObject).
37  * 
38  * #AtkEditableText is a subclass of #AtkText, and as such, an object
39  * which implements #AtkEditableText is by definition an #AtkText
40  * implementor as well.
41  * 
42  * See also: #AtkText
43  */
44 public template EditableTextT(TStruct)
45 {
46 	/** Get the main Gtk struct */
47 	public AtkEditableText* getEditableTextStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return cast(AtkEditableText*)getStruct();
52 	}
53 
54 
55 	/**
56 	 * Copy text from @start_pos up to, but not including @end_pos
57 	 * to the clipboard.
58 	 *
59 	 * Params:
60 	 *     startPos = start position
61 	 *     endPos = end position
62 	 */
63 	public void copyText(int startPos, int endPos)
64 	{
65 		atk_editable_text_copy_text(getEditableTextStruct(), startPos, endPos);
66 	}
67 
68 	/**
69 	 * Copy text from @start_pos up to, but not including @end_pos
70 	 * to the clipboard and then delete from the widget.
71 	 *
72 	 * Params:
73 	 *     startPos = start position
74 	 *     endPos = end position
75 	 */
76 	public void cutText(int startPos, int endPos)
77 	{
78 		atk_editable_text_cut_text(getEditableTextStruct(), startPos, endPos);
79 	}
80 
81 	/**
82 	 * Delete text @start_pos up to, but not including @end_pos.
83 	 *
84 	 * Params:
85 	 *     startPos = start position
86 	 *     endPos = end position
87 	 */
88 	public void deleteText(int startPos, int endPos)
89 	{
90 		atk_editable_text_delete_text(getEditableTextStruct(), startPos, endPos);
91 	}
92 
93 	/**
94 	 * Insert text at a given position.
95 	 *
96 	 * Params:
97 	 *     string_ = the text to insert
98 	 *     length = the length of text to insert, in bytes
99 	 *     position = The caller initializes this to
100 	 *         the position at which to insert the text. After the call it
101 	 *         points at the position after the newly inserted text.
102 	 */
103 	public void insertText(string string_, int length, int* position)
104 	{
105 		atk_editable_text_insert_text(getEditableTextStruct(), Str.toStringz(string_), length, position);
106 	}
107 
108 	/**
109 	 * Paste text from clipboard to specified @position.
110 	 *
111 	 * Params:
112 	 *     position = position to paste
113 	 */
114 	public void pasteText(int position)
115 	{
116 		atk_editable_text_paste_text(getEditableTextStruct(), position);
117 	}
118 
119 	/**
120 	 * Sets the attributes for a specified range. See the ATK_ATTRIBUTE
121 	 * macros (such as #ATK_ATTRIBUTE_LEFT_MARGIN) for examples of attributes
122 	 * that can be set. Note that other attributes that do not have corresponding
123 	 * ATK_ATTRIBUTE macros may also be set for certain text widgets.
124 	 *
125 	 * Params:
126 	 *     attribSet = an #AtkAttributeSet
127 	 *     startOffset = start of range in which to set attributes
128 	 *     endOffset = end of range in which to set attributes
129 	 *
130 	 * Returns: %TRUE if attributes successfully set for the specified
131 	 *     range, otherwise %FALSE
132 	 */
133 	public bool setRunAttributes(AtkAttributeSet* attribSet, int startOffset, int endOffset)
134 	{
135 		return atk_editable_text_set_run_attributes(getEditableTextStruct(), attribSet, startOffset, endOffset) != 0;
136 	}
137 
138 	/**
139 	 * Set text contents of @text.
140 	 *
141 	 * Params:
142 	 *     string_ = string to set for text contents of @text
143 	 */
144 	public void setTextContents(string string_)
145 	{
146 		atk_editable_text_set_text_contents(getEditableTextStruct(), Str.toStringz(string_));
147 	}
148 }