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