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 gtk.EditableIF;
26 
27 private import glib.Str;
28 private import gobject.Signals;
29 public  import gtkc.gdktypes;
30 private import gtkc.gtk;
31 public  import gtkc.gtktypes;
32 
33 
34 /**
35  * The #GtkEditable interface is an interface which should be implemented by
36  * text editing widgets, such as #GtkEntry and #GtkSpinButton. It contains functions
37  * for generically manipulating an editable widget, a large number of action
38  * signals used for key bindings, and several signals that an application can
39  * connect to to modify the behavior of a widget.
40  * 
41  * As an example of the latter usage, by connecting
42  * the following handler to #GtkEditable::insert-text, an application
43  * can convert all entry into a widget into uppercase.
44  * 
45  * ## Forcing entry to uppercase.
46  * 
47  * |[<!-- language="C" -->
48  * #include <ctype.h>;
49  * 
50  * void
51  * insert_text_handler (GtkEditable *editable,
52  * const gchar *text,
53  * gint         length,
54  * gint        *position,
55  * gpointer     data)
56  * {
57  * gchar *result = g_utf8_strup (text, length);
58  * 
59  * g_signal_handlers_block_by_func (editable,
60  * (gpointer) insert_text_handler, data);
61  * gtk_editable_insert_text (editable, result, length, position);
62  * g_signal_handlers_unblock_by_func (editable,
63  * (gpointer) insert_text_handler, data);
64  * 
65  * g_signal_stop_emission_by_name (editable, "insert_text");
66  * 
67  * g_free (result);
68  * }
69  * ]|
70  */
71 public interface EditableIF{
72 	/** Get the main Gtk struct */
73 	public GtkEditable* getEditableStruct();
74 
75 	/** the main Gtk struct as a void* */
76 	protected void* getStruct();
77 
78 	/**
79 	 */
80 
81 	/**
82 	 * Copies the contents of the currently selected content in the editable and
83 	 * puts it on the clipboard.
84 	 */
85 	public void copyClipboard();
86 
87 	/**
88 	 * Removes the contents of the currently selected content in the editable and
89 	 * puts it on the clipboard.
90 	 */
91 	public void cutClipboard();
92 
93 	/**
94 	 * Deletes the currently selected text of the editable.
95 	 * This call doesn’t do anything if there is no selected text.
96 	 */
97 	public void deleteSelection();
98 
99 	/**
100 	 * Deletes a sequence of characters. The characters that are deleted are
101 	 * those characters at positions from @start_pos up to, but not including
102 	 * @end_pos. If @end_pos is negative, then the characters deleted
103 	 * are those from @start_pos to the end of the text.
104 	 *
105 	 * Note that the positions are specified in characters, not bytes.
106 	 *
107 	 * Params:
108 	 *     startPos = start position
109 	 *     endPos = end position
110 	 */
111 	public void deleteText(int startPos, int endPos);
112 
113 	/**
114 	 * Retrieves a sequence of characters. The characters that are retrieved
115 	 * are those characters at positions from @start_pos up to, but not
116 	 * including @end_pos. If @end_pos is negative, then the characters
117 	 * retrieved are those characters from @start_pos to the end of the text.
118 	 *
119 	 * Note that positions are specified in characters, not bytes.
120 	 *
121 	 * Params:
122 	 *     startPos = start of text
123 	 *     endPos = end of text
124 	 *
125 	 * Return: a pointer to the contents of the widget as a
126 	 *     string. This string is allocated by the #GtkEditable
127 	 *     implementation and should be freed by the caller.
128 	 */
129 	public string getChars(int startPos, int endPos);
130 
131 	/**
132 	 * Retrieves whether @editable is editable. See
133 	 * gtk_editable_set_editable().
134 	 *
135 	 * Return: %TRUE if @editable is editable.
136 	 */
137 	public bool getEditable();
138 
139 	/**
140 	 * Retrieves the current position of the cursor relative to the start
141 	 * of the content of the editable.
142 	 *
143 	 * Note that this position is in characters, not in bytes.
144 	 *
145 	 * Return: the cursor position
146 	 */
147 	public int getPosition();
148 
149 	/**
150 	 * Retrieves the selection bound of the editable. start_pos will be filled
151 	 * with the start of the selection and @end_pos with end. If no text was
152 	 * selected both will be identical and %FALSE will be returned.
153 	 *
154 	 * Note that positions are specified in characters, not bytes.
155 	 *
156 	 * Params:
157 	 *     startPos = location to store the starting position, or %NULL
158 	 *     endPos = location to store the end position, or %NULL
159 	 *
160 	 * Return: %TRUE if an area is selected, %FALSE otherwise
161 	 */
162 	public bool getSelectionBounds(out int startPos, out int endPos);
163 
164 	/**
165 	 * Inserts @new_text_length bytes of @new_text into the contents of the
166 	 * widget, at position @position.
167 	 *
168 	 * Note that the position is in characters, not in bytes.
169 	 * The function updates @position to point after the newly inserted text.
170 	 *
171 	 * Params:
172 	 *     newText = the text to append
173 	 *     newTextLength = the length of the text in bytes, or -1
174 	 *     position = location of the position text will be inserted at
175 	 */
176 	public void insertText(string newText, int newTextLength, ref int position);
177 
178 	/**
179 	 * Pastes the content of the clipboard to the current position of the
180 	 * cursor in the editable.
181 	 */
182 	public void pasteClipboard();
183 
184 	/**
185 	 * Selects a region of text. The characters that are selected are
186 	 * those characters at positions from @start_pos up to, but not
187 	 * including @end_pos. If @end_pos is negative, then the
188 	 * characters selected are those characters from @start_pos to
189 	 * the end of the text.
190 	 *
191 	 * Note that positions are specified in characters, not bytes.
192 	 *
193 	 * Params:
194 	 *     startPos = start of region
195 	 *     endPos = end of region
196 	 */
197 	public void selectRegion(int startPos, int endPos);
198 
199 	/**
200 	 * Determines if the user can edit the text in the editable
201 	 * widget or not.
202 	 *
203 	 * Params:
204 	 *     isEditable = %TRUE if the user is allowed to edit the text
205 	 *         in the widget
206 	 */
207 	public void setEditable(bool isEditable);
208 
209 	/**
210 	 * Sets the cursor position in the editable to the given value.
211 	 *
212 	 * The cursor is displayed before the character with the given (base 0)
213 	 * index in the contents of the editable. The value must be less than or
214 	 * equal to the number of characters in the editable. A value of -1
215 	 * indicates that the position should be set after the last character
216 	 * of the editable. Note that @position is in characters, not in bytes.
217 	 *
218 	 * Params:
219 	 *     position = the position of the cursor
220 	 */
221 	public void setPosition(int position);
222 	@property void delegate(EditableIF)[] onChangedListeners();
223 	/**
224 	 * The ::changed signal is emitted at the end of a single
225 	 * user-visible operation on the contents of the #GtkEditable.
226 	 *
227 	 * E.g., a paste operation that replaces the contents of the
228 	 * selection will cause only one signal emission (even though it
229 	 * is implemented by first deleting the selection, then inserting
230 	 * the new content, and may cause multiple ::notify::text signals
231 	 * to be emitted).
232 	 */
233 	void addOnChanged(void delegate(EditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
234 
235 	@property void delegate(int, int, EditableIF)[] onDeleteTextListeners();
236 	/**
237 	 * This signal is emitted when text is deleted from
238 	 * the widget by the user. The default handler for
239 	 * this signal will normally be responsible for deleting
240 	 * the text, so by connecting to this signal and then
241 	 * stopping the signal with g_signal_stop_emission(), it
242 	 * is possible to modify the range of deleted text, or
243 	 * prevent it from being deleted entirely. The @start_pos
244 	 * and @end_pos parameters are interpreted as for
245 	 * gtk_editable_delete_text().
246 	 *
247 	 * Params:
248 	 *     startPos = the starting position
249 	 *     endPos = the end position
250 	 */
251 	void addOnDeleteText(void delegate(int, int, EditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
252 
253 	@property void delegate(string, int, void*, EditableIF)[] onInsertTextListeners();
254 	/**
255 	 * This signal is emitted when text is inserted into
256 	 * the widget by the user. The default handler for
257 	 * this signal will normally be responsible for inserting
258 	 * the text, so by connecting to this signal and then
259 	 * stopping the signal with g_signal_stop_emission(), it
260 	 * is possible to modify the inserted text, or prevent
261 	 * it from being inserted entirely.
262 	 *
263 	 * Params:
264 	 *     newText = the new text to insert
265 	 *     newTextLength = the length of the new text, in bytes,
266 	 *         or -1 if new_text is nul-terminated
267 	 *     position = the position, in characters,
268 	 *         at which to insert the new text. this is an in-out
269 	 *         parameter.  After the signal emission is finished, it
270 	 *         should point after the newly inserted text.
271 	 */
272 	void addOnInsertText(void delegate(string, int, void*, EditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
273 
274 }