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