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 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * structWrap: 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module gtk.EditableIF; 55 56 public import gtkc.gtktypes; 57 58 private import gtkc.gtk; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 private import gobject.Signals; 63 public import gtkc.gdktypes; 64 65 private import glib.Str; 66 67 68 69 70 /** 71 * Description 72 * The GtkEditable interface is an interface which should be implemented by 73 * text editing widgets, such as GtkEntry and GtkText. It contains functions 74 * for generically manipulating an editable widget, a large number of action 75 * signals used for key bindings, and several signals that an application can 76 * connect to to modify the behavior of a widget. 77 * As an example of the latter usage, by connecting 78 * the following handler to "insert_text", an application 79 * can convert all entry into a widget into uppercase. 80 * $(DDOC_COMMENT example) 81 */ 82 public interface EditableIF 83 { 84 85 86 public GtkEditable* getEditableTStruct(); 87 88 /** the main Gtk struct as a void* */ 89 protected void* getStruct(); 90 91 92 /** 93 */ 94 95 void delegate(EditableIF)[] onChangedListeners(); 96 /** 97 * The ::changed signal is emitted at the end of a single 98 * user-visible operation on the contents of the GtkEditable. 99 * E.g., a paste operation that replaces the contents of the 100 * selection will cause only one signal emission (even though it 101 * is implemented by first deleting the selection, then inserting 102 * the new content, and may cause multiple ::notify::text signals 103 * to be emitted). 104 */ 105 void addOnChanged(void delegate(EditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 106 void delegate(gint, gint, EditableIF)[] onDeleteTextListeners(); 107 /** 108 * This signal is emitted when text is deleted from 109 * the widget by the user. The default handler for 110 * this signal will normally be responsible for deleting 111 * the text, so by connecting to this signal and then 112 * stopping the signal with g_signal_stop_emission(), it 113 * is possible to modify the range of deleted text, or 114 * prevent it from being deleted entirely. The start_pos 115 * and end_pos parameters are interpreted as for 116 * gtk_editable_delete_text(). 117 */ 118 void addOnDeleteText(void delegate(gint, gint, EditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 119 void delegate(string, gint, void*, EditableIF)[] onInsertTextListeners(); 120 /** 121 * This signal is emitted when text is inserted into 122 * the widget by the user. The default handler for 123 * this signal will normally be responsible for inserting 124 * the text, so by connecting to this signal and then 125 * stopping the signal with g_signal_stop_emission(), it 126 * is possible to modify the inserted text, or prevent 127 * it from being inserted entirely. 128 */ 129 void addOnInsertText(void delegate(string, gint, void*, EditableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 130 131 /** 132 * Selects a region of text. The characters that are selected are 133 * those characters at positions from start_pos up to, but not 134 * including end_pos. If end_pos is negative, then the the 135 * characters selected are those characters from start_pos to 136 * the end of the text. 137 * Note that positions are specified in characters, not bytes. 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(int* startPos, 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 * Params: 162 * newText = the text to append 163 * newTextLength = the length of the text in bytes, or -1 164 * position = location of the position text will be inserted at. [inout] 165 */ 166 public void insertText(string newText, int newTextLength, 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 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 * Params: 175 * startPos = start position 176 * endPos = end position 177 */ 178 public void deleteText(int startPos, int endPos); 179 180 /** 181 * Retrieves a sequence of characters. The characters that are retrieved 182 * are those characters at positions from start_pos up to, but not 183 * including end_pos. If end_pos is negative, then the the characters 184 * retrieved are those characters from start_pos to the end of the text. 185 * Note that positions are specified in characters, not bytes. 186 * Params: 187 * startPos = start of text 188 * endPos = end of text 189 * 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. 190 */ 191 public string getChars(int startPos, int endPos); 192 193 /** 194 * Removes the contents of the currently selected content in the editable and 195 * puts it on the clipboard. 196 */ 197 public void cutClipboard(); 198 199 /** 200 * Copies the contents of the currently selected content in the editable and 201 * puts it on the clipboard. 202 */ 203 public void copyClipboard(); 204 205 /** 206 * Pastes the content of the clipboard to the current position of the 207 * cursor in the editable. 208 */ 209 public void pasteClipboard(); 210 211 /** 212 * Deletes the currently selected text of the editable. 213 * This call doesn't do anything if there is no selected text. 214 */ 215 public void deleteSelection(); 216 217 /** 218 * Sets the cursor position in the editable to the given value. 219 * The cursor is displayed before the character with the given (base 0) 220 * index in the contents of the editable. The value must be less than or 221 * equal to the number of characters in the editable. A value of -1 222 * indicates that the position should be set after the last character 223 * of the editable. Note that position is in characters, not in bytes. 224 * Params: 225 * position = the position of the cursor 226 */ 227 public void setPosition(int position); 228 229 /** 230 * Retrieves the current position of the cursor relative to the start 231 * of the content of the editable. 232 * Note that this position is in characters, not in bytes. 233 * Returns: the cursor position 234 */ 235 public int getPosition(); 236 237 /** 238 * Determines if the user can edit the text in the editable 239 * widget or not. 240 * Params: 241 * isEditable = TRUE if the user is allowed to edit the text 242 * in the widget 243 */ 244 public void setEditable(int isEditable); 245 246 /** 247 * Retrieves whether editable is editable. See 248 * gtk_editable_set_editable(). 249 * 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). 250 */ 251 public int getEditable(); 252 }