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 = GtkEntry.html 27 * outPack = gtk 28 * outFile = Entry 29 * strct = GtkEntry 30 * realStrct= 31 * ctorStrct= 32 * clss = Entry 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - EditableIF 40 * - CellEditableIF 41 * prefixes: 42 * - gtk_entry_ 43 * omit structs: 44 * omit prefixes: 45 * omit code: 46 * omit signals: 47 * imports: 48 * - glib.Str 49 * - gio.Icon 50 * - gio.IconIF 51 * - gdk.Pixbuf 52 * - gtk.Adjustment 53 * - gtk.Border 54 * - gtk.EntryBuffer 55 * - gtk.EntryCompletion 56 * - gtk.TargetList 57 * - gtk.Widget 58 * - pango.PgAttributeList 59 * - pango.PgLayout 60 * - pango.PgTabArray 61 * - gtk.EditableT 62 * - gtk.EditableIF 63 * - gtk.CellEditableT 64 * - gtk.CellEditableIF 65 * structWrap: 66 * - GIcon* -> IconIF 67 * - GdkPixbuf* -> Pixbuf 68 * - GtkAdjustment* -> Adjustment 69 * - GtkBorder* -> Border 70 * - GtkEntryBuffer* -> EntryBuffer 71 * - GtkEntryCompletion* -> EntryCompletion 72 * - GtkTargetList* -> TargetList 73 * - GtkWidget* -> Widget 74 * - PangoAttrList* -> PgAttributeList 75 * - PangoLayout* -> PgLayout 76 * - PangoTabArray* -> PgTabArray 77 * module aliases: 78 * local aliases: 79 * overrides: 80 */ 81 82 module gtk.Entry; 83 84 public import gtkc.gtktypes; 85 86 private import gtkc.gtk; 87 private import glib.ConstructionException; 88 private import gobject.ObjectG; 89 90 private import gobject.Signals; 91 public import gtkc.gdktypes; 92 private import glib.Str; 93 private import gio.Icon; 94 private import gio.IconIF; 95 private import gdk.Pixbuf; 96 private import gtk.Adjustment; 97 private import gtk.Border; 98 private import gtk.EntryBuffer; 99 private import gtk.EntryCompletion; 100 private import gtk.TargetList; 101 private import gtk.Widget; 102 private import pango.PgAttributeList; 103 private import pango.PgLayout; 104 private import pango.PgTabArray; 105 private import gtk.EditableT; 106 private import gtk.EditableIF; 107 private import gtk.CellEditableT; 108 private import gtk.CellEditableIF; 109 110 111 private import gtk.Widget; 112 113 /** 114 * The GtkEntry widget is a single line text entry 115 * widget. A fairly large set of key bindings are supported 116 * by default. If the entered text is longer than the allocation 117 * of the widget, the widget will scroll so that the cursor 118 * position is visible. 119 * 120 * When using an entry for passwords and other sensitive information, 121 * it can be put into "password mode" using gtk_entry_set_visibility(). 122 * In this mode, entered text is displayed using a 'invisible' character. 123 * By default, GTK+ picks the best invisible character that is available 124 * in the current font, but it can be changed with 125 * gtk_entry_set_invisible_char(). Since 2.16, GTK+ displays a warning 126 * when Caps Lock or input methods might interfere with entering text in 127 * a password entry. The warning can be turned off with the 128 * "caps-lock-warning" property. 129 * 130 * Since 2.16, GtkEntry has the ability to display progress or activity 131 * information behind the text. To make an entry display such information, 132 * use gtk_entry_set_progress_fraction() or gtk_entry_set_progress_pulse_step(). 133 * 134 * Additionally, GtkEntry can show icons at either side of the entry. These 135 * icons can be activatable by clicking, can be set up as drag source and 136 * can have tooltips. To add an icon, use gtk_entry_set_icon_from_gicon() or 137 * one of the various other functions that set an icon from a stock id, an 138 * icon name or a pixbuf. To trigger an action when the user clicks an icon, 139 * connect to the "icon-press" signal. To allow DND operations 140 * from an icon, use gtk_entry_set_icon_drag_source(). To set a tooltip on 141 * an icon, use gtk_entry_set_icon_tooltip_text() or the corresponding function 142 * for markup. 143 * 144 * Note that functionality or information that is only available by clicking 145 * on an icon in an entry may not be accessible at all to users which are not 146 * able to use a mouse or other pointing device. It is therefore recommended 147 * that any such functionality should also be available by other means, e.g. 148 * via the context menu of the entry. 149 */ 150 public class Entry : Widget, EditableIF, CellEditableIF 151 { 152 153 /** the main Gtk struct */ 154 protected GtkEntry* gtkEntry; 155 156 157 /** Get the main Gtk struct */ 158 public GtkEntry* getEntryStruct() 159 { 160 return gtkEntry; 161 } 162 163 164 /** the main Gtk struct as a void* */ 165 protected override void* getStruct() 166 { 167 return cast(void*)gtkEntry; 168 } 169 170 /** 171 * Sets our main struct and passes it to the parent class 172 */ 173 public this (GtkEntry* gtkEntry) 174 { 175 super(cast(GtkWidget*)gtkEntry); 176 this.gtkEntry = gtkEntry; 177 } 178 179 protected override void setStruct(GObject* obj) 180 { 181 super.setStruct(obj); 182 gtkEntry = cast(GtkEntry*)obj; 183 } 184 185 // add the Editable capabilities 186 mixin EditableT!(GtkEntry); 187 188 // add the CellEditable capabilities 189 mixin CellEditableT!(GtkEntry); 190 191 /** */ 192 public this (string text) 193 { 194 this(); 195 setText(text); 196 } 197 198 /** */ 199 public this (string text, int max) 200 { 201 this(text); 202 setMaxLength(max); 203 } 204 205 /** 206 * Gets the stock id of action. 207 * Since 2.16 208 * Returns: the stock id 209 */ 210 public StockID getStockId(GtkEntryIconPosition iconPos) 211 { 212 // const gchar* gtk_entry_get_icon_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos); 213 string id = Str.toString(gtk_entry_get_icon_stock(gtkEntry, iconPos)); 214 215 foreach(i, desc; StockDesc) 216 { 217 if(desc == id) 218 return cast(StockID)i; 219 } 220 221 return StockID.DISCARD; 222 } 223 224 /** 225 * Sets the stock id on action 226 * Since 2.16 227 * Params: 228 * stockId = the stock id 229 */ 230 public void setStockId(GtkEntryIconPosition iconPos, StockID stockId) 231 { 232 // void gtk_entry_set_icon_from_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id); 233 gtk_entry_set_icon_from_stock(gtkEntry, iconPos, Str.toStringz(StockDesc[stockId])); 234 } 235 236 /** 237 */ 238 int[string] connectedSignals; 239 240 void delegate(Entry)[] onActivateListeners; 241 /** 242 * The ::activate signal is emitted when the user hits 243 * the Enter key. 244 * While this signal is used as a 245 * keybinding signal, 246 * it is also commonly used by applications to intercept 247 * activation of entries. 248 * The default bindings for this signal are all forms of the Enter key. 249 */ 250 void addOnActivate(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 251 { 252 if ( !("activate" in connectedSignals) ) 253 { 254 Signals.connectData( 255 getStruct(), 256 "activate", 257 cast(GCallback)&callBackActivate, 258 cast(void*)this, 259 null, 260 connectFlags); 261 connectedSignals["activate"] = 1; 262 } 263 onActivateListeners ~= dlg; 264 } 265 extern(C) static void callBackActivate(GtkEntry* entryStruct, Entry _entry) 266 { 267 foreach ( void delegate(Entry) dlg ; _entry.onActivateListeners ) 268 { 269 dlg(_entry); 270 } 271 } 272 273 void delegate(Entry)[] onBackspaceListeners; 274 /** 275 * The ::backspace signal is a 276 * keybinding signal 277 * which gets emitted when the user asks for it. 278 * The default bindings for this signal are 279 * Backspace and Shift-Backspace. 280 */ 281 void addOnBackspace(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 282 { 283 if ( !("backspace" in connectedSignals) ) 284 { 285 Signals.connectData( 286 getStruct(), 287 "backspace", 288 cast(GCallback)&callBackBackspace, 289 cast(void*)this, 290 null, 291 connectFlags); 292 connectedSignals["backspace"] = 1; 293 } 294 onBackspaceListeners ~= dlg; 295 } 296 extern(C) static void callBackBackspace(GtkEntry* entryStruct, Entry _entry) 297 { 298 foreach ( void delegate(Entry) dlg ; _entry.onBackspaceListeners ) 299 { 300 dlg(_entry); 301 } 302 } 303 304 void delegate(Entry)[] onCopyClipboardListeners; 305 /** 306 * The ::copy-clipboard signal is a 307 * keybinding signal 308 * which gets emitted to copy the selection to the clipboard. 309 * The default bindings for this signal are 310 * Ctrl-c and Ctrl-Insert. 311 */ 312 void addOnCopyClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 313 { 314 if ( !("copy-clipboard" in connectedSignals) ) 315 { 316 Signals.connectData( 317 getStruct(), 318 "copy-clipboard", 319 cast(GCallback)&callBackCopyClipboard, 320 cast(void*)this, 321 null, 322 connectFlags); 323 connectedSignals["copy-clipboard"] = 1; 324 } 325 onCopyClipboardListeners ~= dlg; 326 } 327 extern(C) static void callBackCopyClipboard(GtkEntry* entryStruct, Entry _entry) 328 { 329 foreach ( void delegate(Entry) dlg ; _entry.onCopyClipboardListeners ) 330 { 331 dlg(_entry); 332 } 333 } 334 335 void delegate(Entry)[] onCutClipboardListeners; 336 /** 337 * The ::cut-clipboard signal is a 338 * keybinding signal 339 * which gets emitted to cut the selection to the clipboard. 340 * The default bindings for this signal are 341 * Ctrl-x and Shift-Delete. 342 */ 343 void addOnCutClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 344 { 345 if ( !("cut-clipboard" in connectedSignals) ) 346 { 347 Signals.connectData( 348 getStruct(), 349 "cut-clipboard", 350 cast(GCallback)&callBackCutClipboard, 351 cast(void*)this, 352 null, 353 connectFlags); 354 connectedSignals["cut-clipboard"] = 1; 355 } 356 onCutClipboardListeners ~= dlg; 357 } 358 extern(C) static void callBackCutClipboard(GtkEntry* entryStruct, Entry _entry) 359 { 360 foreach ( void delegate(Entry) dlg ; _entry.onCutClipboardListeners ) 361 { 362 dlg(_entry); 363 } 364 } 365 366 void delegate(GtkDeleteType, gint, Entry)[] onDeleteFromCursorListeners; 367 /** 368 * The ::delete-from-cursor signal is a 369 * keybinding signal 370 * which gets emitted when the user initiates a text deletion. 371 * If the type is GTK_DELETE_CHARS, GTK+ deletes the selection 372 * if there is one, otherwise it deletes the requested number 373 * of characters. 374 * The default bindings for this signal are 375 * Delete for deleting a character and Ctrl-Delete for 376 * deleting a word. 377 */ 378 void addOnDeleteFromCursor(void delegate(GtkDeleteType, gint, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 379 { 380 if ( !("delete-from-cursor" in connectedSignals) ) 381 { 382 Signals.connectData( 383 getStruct(), 384 "delete-from-cursor", 385 cast(GCallback)&callBackDeleteFromCursor, 386 cast(void*)this, 387 null, 388 connectFlags); 389 connectedSignals["delete-from-cursor"] = 1; 390 } 391 onDeleteFromCursorListeners ~= dlg; 392 } 393 extern(C) static void callBackDeleteFromCursor(GtkEntry* entryStruct, GtkDeleteType type, gint count, Entry _entry) 394 { 395 foreach ( void delegate(GtkDeleteType, gint, Entry) dlg ; _entry.onDeleteFromCursorListeners ) 396 { 397 dlg(type, count, _entry); 398 } 399 } 400 401 void delegate(GtkEntryIconPosition, GdkEvent*, Entry)[] onIconPressListeners; 402 /** 403 * The ::icon-press signal is emitted when an activatable icon 404 * is clicked. 405 * Since 2.16 406 */ 407 void addOnIconPress(void delegate(GtkEntryIconPosition, GdkEvent*, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 408 { 409 if ( !("icon-press" in connectedSignals) ) 410 { 411 Signals.connectData( 412 getStruct(), 413 "icon-press", 414 cast(GCallback)&callBackIconPress, 415 cast(void*)this, 416 null, 417 connectFlags); 418 connectedSignals["icon-press"] = 1; 419 } 420 onIconPressListeners ~= dlg; 421 } 422 extern(C) static void callBackIconPress(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEvent* event, Entry _entry) 423 { 424 foreach ( void delegate(GtkEntryIconPosition, GdkEvent*, Entry) dlg ; _entry.onIconPressListeners ) 425 { 426 dlg(iconPos, event, _entry); 427 } 428 } 429 430 void delegate(GtkEntryIconPosition, GdkEvent*, Entry)[] onIconReleaseListeners; 431 /** 432 * The ::icon-release signal is emitted on the button release from a 433 * mouse click over an activatable icon. 434 * Since 2.16 435 */ 436 void addOnIconRelease(void delegate(GtkEntryIconPosition, GdkEvent*, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 437 { 438 if ( !("icon-release" in connectedSignals) ) 439 { 440 Signals.connectData( 441 getStruct(), 442 "icon-release", 443 cast(GCallback)&callBackIconRelease, 444 cast(void*)this, 445 null, 446 connectFlags); 447 connectedSignals["icon-release"] = 1; 448 } 449 onIconReleaseListeners ~= dlg; 450 } 451 extern(C) static void callBackIconRelease(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEvent* event, Entry _entry) 452 { 453 foreach ( void delegate(GtkEntryIconPosition, GdkEvent*, Entry) dlg ; _entry.onIconReleaseListeners ) 454 { 455 dlg(iconPos, event, _entry); 456 } 457 } 458 459 void delegate(string, Entry)[] onInsertAtCursorListeners; 460 /** 461 * The ::insert-at-cursor signal is a 462 * keybinding signal 463 * which gets emitted when the user initiates the insertion of a 464 * fixed string at the cursor. 465 * This signal has no default bindings. 466 */ 467 void addOnInsertAtCursor(void delegate(string, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 468 { 469 if ( !("insert-at-cursor" in connectedSignals) ) 470 { 471 Signals.connectData( 472 getStruct(), 473 "insert-at-cursor", 474 cast(GCallback)&callBackInsertAtCursor, 475 cast(void*)this, 476 null, 477 connectFlags); 478 connectedSignals["insert-at-cursor"] = 1; 479 } 480 onInsertAtCursorListeners ~= dlg; 481 } 482 extern(C) static void callBackInsertAtCursor(GtkEntry* entryStruct, gchar* str, Entry _entry) 483 { 484 foreach ( void delegate(string, Entry) dlg ; _entry.onInsertAtCursorListeners ) 485 { 486 dlg(Str.toString(str), _entry); 487 } 488 } 489 490 void delegate(GtkMovementStep, gint, gboolean, Entry)[] onMoveCursorListeners; 491 /** 492 * The ::move-cursor signal is a 493 * keybinding signal 494 * which gets emitted when the user initiates a cursor movement. 495 * If the cursor is not visible in entry, this signal causes 496 * the viewport to be moved instead. 497 * Applications should not connect to it, but may emit it with 498 * g_signal_emit_by_name() if they need to control the cursor 499 * programmatically. 500 * The default bindings for this signal come in two variants, 501 * the variant with the Shift modifier extends the selection, 502 * the variant without the Shift modifer does not. 503 * There are too many key combinations to list them all here. 504 * Arrow keys move by individual characters/lines 505 * Ctrl-arrow key combinations move by words/paragraphs 506 * Home/End keys move to the ends of the buffer 507 * TRUE if the move should extend the selection 508 */ 509 void addOnMoveCursor(void delegate(GtkMovementStep, gint, gboolean, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 510 { 511 if ( !("move-cursor" in connectedSignals) ) 512 { 513 Signals.connectData( 514 getStruct(), 515 "move-cursor", 516 cast(GCallback)&callBackMoveCursor, 517 cast(void*)this, 518 null, 519 connectFlags); 520 connectedSignals["move-cursor"] = 1; 521 } 522 onMoveCursorListeners ~= dlg; 523 } 524 extern(C) static void callBackMoveCursor(GtkEntry* entryStruct, GtkMovementStep step, gint count, gboolean extendSelection, Entry _entry) 525 { 526 foreach ( void delegate(GtkMovementStep, gint, gboolean, Entry) dlg ; _entry.onMoveCursorListeners ) 527 { 528 dlg(step, count, extendSelection, _entry); 529 } 530 } 531 532 void delegate(Entry)[] onPasteClipboardListeners; 533 /** 534 * The ::paste-clipboard signal is a 535 * keybinding signal 536 * which gets emitted to paste the contents of the clipboard 537 * into the text view. 538 * The default bindings for this signal are 539 * Ctrl-v and Shift-Insert. 540 */ 541 void addOnPasteClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 542 { 543 if ( !("paste-clipboard" in connectedSignals) ) 544 { 545 Signals.connectData( 546 getStruct(), 547 "paste-clipboard", 548 cast(GCallback)&callBackPasteClipboard, 549 cast(void*)this, 550 null, 551 connectFlags); 552 connectedSignals["paste-clipboard"] = 1; 553 } 554 onPasteClipboardListeners ~= dlg; 555 } 556 extern(C) static void callBackPasteClipboard(GtkEntry* entryStruct, Entry _entry) 557 { 558 foreach ( void delegate(Entry) dlg ; _entry.onPasteClipboardListeners ) 559 { 560 dlg(_entry); 561 } 562 } 563 564 void delegate(Widget, Entry)[] onPopulatePopupListeners; 565 /** 566 * The ::populate-popup signal gets emitted before showing the 567 * context menu of the entry. 568 * If you need to add items to the context menu, connect 569 * to this signal and append your items to the widget, which 570 * will be a GtkMenu in this case. 571 * If "populate-all" is TRUE, this signal will 572 * also be emitted to populate touch popups. In this case, 573 * widget will be a different container, e.g. a GtkToolbar. 574 * The signal handler should not make assumptions about the 575 * type of widget. 576 */ 577 void addOnPopulatePopup(void delegate(Widget, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 578 { 579 if ( !("populate-popup" in connectedSignals) ) 580 { 581 Signals.connectData( 582 getStruct(), 583 "populate-popup", 584 cast(GCallback)&callBackPopulatePopup, 585 cast(void*)this, 586 null, 587 connectFlags); 588 connectedSignals["populate-popup"] = 1; 589 } 590 onPopulatePopupListeners ~= dlg; 591 } 592 extern(C) static void callBackPopulatePopup(GtkEntry* entryStruct, GtkWidget* popup, Entry _entry) 593 { 594 foreach ( void delegate(Widget, Entry) dlg ; _entry.onPopulatePopupListeners ) 595 { 596 dlg(ObjectG.getDObject!(Widget)(popup), _entry); 597 } 598 } 599 600 void delegate(string, Entry)[] onPreeditChangedListeners; 601 /** 602 * If an input method is used, the typed text will not immediately 603 * be committed to the buffer. So if you are interested in the text, 604 * connect to this signal. 605 * Since 2.20 606 */ 607 void addOnPreeditChanged(void delegate(string, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 608 { 609 if ( !("preedit-changed" in connectedSignals) ) 610 { 611 Signals.connectData( 612 getStruct(), 613 "preedit-changed", 614 cast(GCallback)&callBackPreeditChanged, 615 cast(void*)this, 616 null, 617 connectFlags); 618 connectedSignals["preedit-changed"] = 1; 619 } 620 onPreeditChangedListeners ~= dlg; 621 } 622 extern(C) static void callBackPreeditChanged(GtkEntry* entryStruct, gchar* preedit, Entry _entry) 623 { 624 foreach ( void delegate(string, Entry) dlg ; _entry.onPreeditChangedListeners ) 625 { 626 dlg(Str.toString(preedit), _entry); 627 } 628 } 629 630 void delegate(Entry)[] onToggleOverwriteListeners; 631 /** 632 * The ::toggle-overwrite signal is a 633 * keybinding signal 634 * which gets emitted to toggle the overwrite mode of the entry. 635 * The default bindings for this signal is Insert. 636 * See Also 637 * GtkTextView, GtkEntryCompletion 638 */ 639 void addOnToggleOverwrite(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 640 { 641 if ( !("toggle-overwrite" in connectedSignals) ) 642 { 643 Signals.connectData( 644 getStruct(), 645 "toggle-overwrite", 646 cast(GCallback)&callBackToggleOverwrite, 647 cast(void*)this, 648 null, 649 connectFlags); 650 connectedSignals["toggle-overwrite"] = 1; 651 } 652 onToggleOverwriteListeners ~= dlg; 653 } 654 extern(C) static void callBackToggleOverwrite(GtkEntry* entryStruct, Entry _entry) 655 { 656 foreach ( void delegate(Entry) dlg ; _entry.onToggleOverwriteListeners ) 657 { 658 dlg(_entry); 659 } 660 } 661 662 663 /** 664 * Creates a new entry. 665 * Throws: ConstructionException GTK+ fails to create the object. 666 */ 667 public this () 668 { 669 // GtkWidget * gtk_entry_new (void); 670 auto p = gtk_entry_new(); 671 if(p is null) 672 { 673 throw new ConstructionException("null returned by gtk_entry_new()"); 674 } 675 this(cast(GtkEntry*) p); 676 } 677 678 /** 679 * Creates a new entry with the specified text buffer. 680 * Since 2.18 681 * Params: 682 * buffer = The buffer to use for the new GtkEntry. 683 * Throws: ConstructionException GTK+ fails to create the object. 684 */ 685 public this (EntryBuffer buffer) 686 { 687 // GtkWidget * gtk_entry_new_with_buffer (GtkEntryBuffer *buffer); 688 auto p = gtk_entry_new_with_buffer((buffer is null) ? null : buffer.getEntryBufferStruct()); 689 if(p is null) 690 { 691 throw new ConstructionException("null returned by gtk_entry_new_with_buffer((buffer is null) ? null : buffer.getEntryBufferStruct())"); 692 } 693 this(cast(GtkEntry*) p); 694 } 695 696 /** 697 * Get the GtkEntryBuffer object which holds the text for 698 * this widget. 699 * Since 2.18 700 * Returns: A GtkEntryBuffer object. [transfer none] 701 */ 702 public EntryBuffer getBuffer() 703 { 704 // GtkEntryBuffer * gtk_entry_get_buffer (GtkEntry *entry); 705 auto p = gtk_entry_get_buffer(gtkEntry); 706 707 if(p is null) 708 { 709 return null; 710 } 711 712 return ObjectG.getDObject!(EntryBuffer)(cast(GtkEntryBuffer*) p); 713 } 714 715 /** 716 * Set the GtkEntryBuffer object which holds the text for 717 * this widget. 718 * Since 2.18 719 * Params: 720 * buffer = a GtkEntryBuffer 721 */ 722 public void setBuffer(EntryBuffer buffer) 723 { 724 // void gtk_entry_set_buffer (GtkEntry *entry, GtkEntryBuffer *buffer); 725 gtk_entry_set_buffer(gtkEntry, (buffer is null) ? null : buffer.getEntryBufferStruct()); 726 } 727 728 /** 729 * Sets the text in the widget to the given 730 * value, replacing the current contents. 731 * See gtk_entry_buffer_set_text(). 732 * Params: 733 * text = the new text 734 */ 735 public void setText(string text) 736 { 737 // void gtk_entry_set_text (GtkEntry *entry, const gchar *text); 738 gtk_entry_set_text(gtkEntry, Str.toStringz(text)); 739 } 740 741 /** 742 * Retrieves the contents of the entry widget. 743 * See also gtk_editable_get_chars(). 744 * Returns: a pointer to the contents of the widget as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored. 745 */ 746 public string getText() 747 { 748 // const gchar * gtk_entry_get_text (GtkEntry *entry); 749 return Str.toString(gtk_entry_get_text(gtkEntry)); 750 } 751 752 /** 753 * Retrieves the current length of the text in 754 * entry. 755 * Since 2.14 756 * Returns: the current number of characters in GtkEntry, or 0 if there are none. 757 */ 758 public ushort getTextLength() 759 { 760 // guint16 gtk_entry_get_text_length (GtkEntry *entry); 761 return gtk_entry_get_text_length(gtkEntry); 762 } 763 764 /** 765 * Gets the area where the entry's text is drawn. This function is 766 * useful when drawing something to the entry in a draw callback. 767 * If the entry is not realized, text_area is filled with zeros. 768 * See also gtk_entry_get_icon_area(). 769 * Params: 770 * textArea = Return location for the text area. [out] 771 * Since 3.0 772 */ 773 public void getTextArea(out Rectangle textArea) 774 { 775 // void gtk_entry_get_text_area (GtkEntry *entry, GdkRectangle *text_area); 776 gtk_entry_get_text_area(gtkEntry, &textArea); 777 } 778 779 /** 780 * Sets whether the contents of the entry are visible or not. 781 * When visibility is set to FALSE, characters are displayed 782 * as the invisible char, and will also appear that way when 783 * the text in the entry widget is copied elsewhere. 784 * By default, GTK+ picks the best invisible character available 785 * in the current font, but it can be changed with 786 * gtk_entry_set_invisible_char(). 787 * Note that you probably want to set "input-purpose" 788 * to GTK_INPUT_PURPOSE_PASSWORD or GTK_INPUT_PURPOSE_PIN to 789 * inform input methods about the purpose of this entry, 790 * in addition to setting visibility to FALSE. 791 * Params: 792 * visible = TRUE if the contents of the entry are displayed 793 * as plaintext 794 */ 795 public void setVisibility(int visible) 796 { 797 // void gtk_entry_set_visibility (GtkEntry *entry, gboolean visible); 798 gtk_entry_set_visibility(gtkEntry, visible); 799 } 800 801 /** 802 * Sets the character to use in place of the actual text when 803 * gtk_entry_set_visibility() has been called to set text visibility 804 * to FALSE. i.e. this is the character used in "password mode" to 805 * show the user how many characters have been typed. By default, GTK+ 806 * picks the best invisible char available in the current font. If you 807 * set the invisible char to 0, then the user will get no feedback 808 * at all; there will be no text on the screen as they type. 809 * Params: 810 * ch = a Unicode character 811 */ 812 public void setInvisibleChar(gunichar ch) 813 { 814 // void gtk_entry_set_invisible_char (GtkEntry *entry, gunichar ch); 815 gtk_entry_set_invisible_char(gtkEntry, ch); 816 } 817 818 /** 819 * Unsets the invisible char previously set with 820 * gtk_entry_set_invisible_char(). So that the 821 * default invisible char is used again. 822 * Since 2.16 823 */ 824 public void unsetInvisibleChar() 825 { 826 // void gtk_entry_unset_invisible_char (GtkEntry *entry); 827 gtk_entry_unset_invisible_char(gtkEntry); 828 } 829 830 /** 831 * Sets the maximum allowed length of the contents of the widget. If 832 * the current contents are longer than the given length, then they 833 * will be truncated to fit. 834 * Params: 835 * max = the maximum length of the entry, or 0 for no maximum. 836 * (other than the maximum length of entries.) The value passed in will 837 * be clamped to the range 0-65536. 838 */ 839 public void setMaxLength(int max) 840 { 841 // void gtk_entry_set_max_length (GtkEntry *entry, gint max); 842 gtk_entry_set_max_length(gtkEntry, max); 843 } 844 845 /** 846 * Retrieves the value set by gtk_entry_set_activates_default(). 847 * Returns: TRUE if the entry will activate the default widget 848 */ 849 public int getActivatesDefault() 850 { 851 // gboolean gtk_entry_get_activates_default (GtkEntry *entry); 852 return gtk_entry_get_activates_default(gtkEntry); 853 } 854 855 /** 856 * Gets the value set by gtk_entry_set_has_frame(). 857 * Returns: whether the entry has a beveled frame 858 */ 859 public int getHasFrame() 860 { 861 // gboolean gtk_entry_get_has_frame (GtkEntry *entry); 862 return gtk_entry_get_has_frame(gtkEntry); 863 } 864 865 /** 866 * Warning 867 * gtk_entry_get_inner_border has been deprecated since version 3.4 and should not be used in newly-written code. Use the standard border and padding CSS properties (through 868 * objects like GtkStyleContext and GtkCssProvider); the value returned by 869 * this function is ignored by GtkEntry. 870 * This function returns the entry's "inner-border" property. See 871 * gtk_entry_set_inner_border() for more information. 872 * Since 2.10 873 * Returns: the entry's GtkBorder, or NULL if none was set. [transfer none] 874 */ 875 public Border getInnerBorder() 876 { 877 // const GtkBorder * gtk_entry_get_inner_border (GtkEntry *entry); 878 auto p = gtk_entry_get_inner_border(gtkEntry); 879 880 if(p is null) 881 { 882 return null; 883 } 884 885 return ObjectG.getDObject!(Border)(cast(GtkBorder*) p); 886 } 887 888 /** 889 * Gets the value set by gtk_entry_set_width_chars(). 890 * Returns: number of chars to request space for, or negative if unset 891 */ 892 public int getWidthChars() 893 { 894 // gint gtk_entry_get_width_chars (GtkEntry *entry); 895 return gtk_entry_get_width_chars(gtkEntry); 896 } 897 898 /** 899 * If setting is TRUE, pressing Enter in the entry will activate the default 900 * widget for the window containing the entry. This usually means that 901 * the dialog box containing the entry will be closed, since the default 902 * widget is usually one of the dialog buttons. 903 * (For experts: if setting is TRUE, the entry calls 904 * gtk_window_activate_default() on the window containing the entry, in 905 * the default handler for the "activate" signal.) 906 * Params: 907 * setting = TRUE to activate window's default widget on Enter keypress 908 */ 909 public void setActivatesDefault(int setting) 910 { 911 // void gtk_entry_set_activates_default (GtkEntry *entry, gboolean setting); 912 gtk_entry_set_activates_default(gtkEntry, setting); 913 } 914 915 /** 916 * Sets whether the entry has a beveled frame around it. 917 * Params: 918 * setting = new value 919 */ 920 public void setHasFrame(int setting) 921 { 922 // void gtk_entry_set_has_frame (GtkEntry *entry, gboolean setting); 923 gtk_entry_set_has_frame(gtkEntry, setting); 924 } 925 926 /** 927 * Warning 928 * gtk_entry_set_inner_border has been deprecated since version 3.4 and should not be used in newly-written code. Use the standard border and padding CSS properties (through 929 * objects like GtkStyleContext and GtkCssProvider); the value set with 930 * this function is ignored by GtkEntry. 931 * Sets entry's inner-border property to border, or clears it if NULL 932 * is passed. The inner-border is the area around the entry's text, but 933 * inside its frame. 934 * If set, this property overrides the inner-border style property. 935 * Overriding the style-provided border is useful when you want to do 936 * in-place editing of some text in a canvas or list widget, where 937 * pixel-exact positioning of the entry is important. 938 * Since 2.10 939 * Params: 940 * border = a GtkBorder, or NULL. [allow-none] 941 */ 942 public void setInnerBorder(Border border) 943 { 944 // void gtk_entry_set_inner_border (GtkEntry *entry, const GtkBorder *border); 945 gtk_entry_set_inner_border(gtkEntry, (border is null) ? null : border.getBorderStruct()); 946 } 947 948 /** 949 * Changes the size request of the entry to be about the right size 950 * for n_chars characters. Note that it changes the size 951 * request, the size can still be affected by 952 * how you pack the widget into containers. If n_chars is -1, the 953 * size reverts to the default entry size. 954 * Params: 955 * nChars = width in chars 956 */ 957 public void setWidthChars(int nChars) 958 { 959 // void gtk_entry_set_width_chars (GtkEntry *entry, gint n_chars); 960 gtk_entry_set_width_chars(gtkEntry, nChars); 961 } 962 963 /** 964 * Retrieves the character displayed in place of the real characters 965 * for entries with visibility set to false. See gtk_entry_set_invisible_char(). 966 * Returns: the current invisible char, or 0, if the entry does not show invisible text at all. 967 */ 968 public gunichar getInvisibleChar() 969 { 970 // gunichar gtk_entry_get_invisible_char (GtkEntry *entry); 971 return gtk_entry_get_invisible_char(gtkEntry); 972 } 973 974 /** 975 * Sets the alignment for the contents of the entry. This controls 976 * the horizontal positioning of the contents when the displayed 977 * text is shorter than the width of the entry. 978 * Since 2.4 979 * Params: 980 * xalign = The horizontal alignment, from 0 (left) to 1 (right). 981 * Reversed for RTL layouts 982 */ 983 public void setAlignment(float xalign) 984 { 985 // void gtk_entry_set_alignment (GtkEntry *entry, gfloat xalign); 986 gtk_entry_set_alignment(gtkEntry, xalign); 987 } 988 989 /** 990 * Gets the value set by gtk_entry_set_alignment(). 991 * Since 2.4 992 * Returns: the alignment 993 */ 994 public float getAlignment() 995 { 996 // gfloat gtk_entry_get_alignment (GtkEntry *entry); 997 return gtk_entry_get_alignment(gtkEntry); 998 } 999 1000 /** 1001 * Sets text to be displayed in entry when it is empty and unfocused. 1002 * This can be used to give a visual hint of the expected contents of 1003 * the GtkEntry. 1004 * Note that since the placeholder text gets removed when the entry 1005 * received focus, using this feature is a bit problematic if the entry 1006 * is given the initial focus in a window. Sometimes this can be 1007 * worked around by delaying the initial focus setting until the 1008 * first key event arrives. 1009 * Params: 1010 * text = a string to be displayed when entry is empty an unfocused, or NULL 1011 * Since 3.2 1012 */ 1013 public void setPlaceholderText(string text) 1014 { 1015 // void gtk_entry_set_placeholder_text (GtkEntry *entry, const gchar *text); 1016 gtk_entry_set_placeholder_text(gtkEntry, Str.toStringz(text)); 1017 } 1018 1019 /** 1020 * Retrieves the text that will be displayed when entry is empty and unfocused 1021 * Returns: a pointer to the placeholder text as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored. Since 3.2 1022 */ 1023 public string getPlaceholderText() 1024 { 1025 // const gchar * gtk_entry_get_placeholder_text (GtkEntry *entry); 1026 return Str.toString(gtk_entry_get_placeholder_text(gtkEntry)); 1027 } 1028 1029 /** 1030 * Sets whether the text is overwritten when typing in the GtkEntry. 1031 * Since 2.14 1032 * Params: 1033 * overwrite = new value 1034 */ 1035 public void setOverwriteMode(int overwrite) 1036 { 1037 // void gtk_entry_set_overwrite_mode (GtkEntry *entry, gboolean overwrite); 1038 gtk_entry_set_overwrite_mode(gtkEntry, overwrite); 1039 } 1040 1041 /** 1042 * Gets the value set by gtk_entry_set_overwrite_mode(). 1043 * Since 2.14 1044 * Returns: whether the text is overwritten when typing. 1045 */ 1046 public int getOverwriteMode() 1047 { 1048 // gboolean gtk_entry_get_overwrite_mode (GtkEntry *entry); 1049 return gtk_entry_get_overwrite_mode(gtkEntry); 1050 } 1051 1052 /** 1053 * Gets the PangoLayout used to display the entry. 1054 * The layout is useful to e.g. convert text positions to 1055 * pixel positions, in combination with gtk_entry_get_layout_offsets(). 1056 * The returned layout is owned by the entry and must not be 1057 * modified or freed by the caller. 1058 * Keep in mind that the layout text may contain a preedit string, so 1059 * gtk_entry_layout_index_to_text_index() and 1060 * gtk_entry_text_index_to_layout_index() are needed to convert byte 1061 * indices in the layout to byte indices in the entry contents. 1062 * Returns: the PangoLayout for this entry. [transfer none] 1063 */ 1064 public PgLayout getLayout() 1065 { 1066 // PangoLayout * gtk_entry_get_layout (GtkEntry *entry); 1067 auto p = gtk_entry_get_layout(gtkEntry); 1068 1069 if(p is null) 1070 { 1071 return null; 1072 } 1073 1074 return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) p); 1075 } 1076 1077 /** 1078 * Obtains the position of the PangoLayout used to render text 1079 * in the entry, in widget coordinates. Useful if you want to line 1080 * up the text in an entry with some other text, e.g. when using the 1081 * entry to implement editable cells in a sheet widget. 1082 * Also useful to convert mouse events into coordinates inside the 1083 * PangoLayout, e.g. to take some action if some part of the entry text 1084 * is clicked. 1085 * Note that as the user scrolls around in the entry the offsets will 1086 * change; you'll need to connect to the "notify::scroll-offset" 1087 * signal to track this. Remember when using the PangoLayout 1088 * functions you need to convert to and from pixels using 1089 * PANGO_PIXELS() or PANGO_SCALE. 1090 * Keep in mind that the layout text may contain a preedit string, so 1091 * gtk_entry_layout_index_to_text_index() and 1092 * gtk_entry_text_index_to_layout_index() are needed to convert byte 1093 * indices in the layout to byte indices in the entry contents. 1094 * Params: 1095 * x = location to store X offset of layout, or NULL. [out][allow-none] 1096 * y = location to store Y offset of layout, or NULL. [out][allow-none] 1097 */ 1098 public void getLayoutOffsets(out int x, out int y) 1099 { 1100 // void gtk_entry_get_layout_offsets (GtkEntry *entry, gint *x, gint *y); 1101 gtk_entry_get_layout_offsets(gtkEntry, &x, &y); 1102 } 1103 1104 /** 1105 * Converts from a position in the entry contents (returned 1106 * by gtk_entry_get_text()) to a position in the 1107 * entry's PangoLayout (returned by gtk_entry_get_layout(), 1108 * with text retrieved via pango_layout_get_text()). 1109 * Params: 1110 * layoutIndex = byte index into the entry layout text 1111 * Returns: byte index into the entry contents 1112 */ 1113 public int layoutIndexToTextIndex(int layoutIndex) 1114 { 1115 // gint gtk_entry_layout_index_to_text_index (GtkEntry *entry, gint layout_index); 1116 return gtk_entry_layout_index_to_text_index(gtkEntry, layoutIndex); 1117 } 1118 1119 /** 1120 * Converts from a position in the entry's PangoLayout (returned by 1121 * gtk_entry_get_layout()) to a position in the entry contents 1122 * (returned by gtk_entry_get_text()). 1123 * Params: 1124 * textIndex = byte index into the entry contents 1125 * Returns: byte index into the entry layout text 1126 */ 1127 public int textIndexToLayoutIndex(int textIndex) 1128 { 1129 // gint gtk_entry_text_index_to_layout_index (GtkEntry *entry, gint text_index); 1130 return gtk_entry_text_index_to_layout_index(gtkEntry, textIndex); 1131 } 1132 1133 /** 1134 * Sets a PangoAttrList; the attributes in the list are applied to the 1135 * entry text. 1136 * Params: 1137 * attrs = a PangoAttrList 1138 * Since 3.6 1139 */ 1140 public void setAttributes(PgAttributeList attrs) 1141 { 1142 // void gtk_entry_set_attributes (GtkEntry *entry, PangoAttrList *attrs); 1143 gtk_entry_set_attributes(gtkEntry, (attrs is null) ? null : attrs.getPgAttributeListStruct()); 1144 } 1145 1146 /** 1147 * Gets the attribute list that was set on the entry using 1148 * gtk_entry_set_attributes(), if any. 1149 * Returns: the attribute list, or NULL if none was set. [transfer none] Since 3.6 1150 */ 1151 public PgAttributeList getAttributes() 1152 { 1153 // PangoAttrList * gtk_entry_get_attributes (GtkEntry *entry); 1154 auto p = gtk_entry_get_attributes(gtkEntry); 1155 1156 if(p is null) 1157 { 1158 return null; 1159 } 1160 1161 return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) p); 1162 } 1163 1164 /** 1165 * Retrieves the maximum allowed length of the text in 1166 * entry. See gtk_entry_set_max_length(). 1167 * Returns: the maximum allowed number of characters in GtkEntry, or 0 if there is no maximum. 1168 */ 1169 public int getMaxLength() 1170 { 1171 // gint gtk_entry_get_max_length (GtkEntry *entry); 1172 return gtk_entry_get_max_length(gtkEntry); 1173 } 1174 1175 /** 1176 * Retrieves whether the text in entry is visible. See 1177 * gtk_entry_set_visibility(). 1178 * Returns: TRUE if the text is currently visible 1179 */ 1180 public int getVisibility() 1181 { 1182 // gboolean gtk_entry_get_visibility (GtkEntry *entry); 1183 return gtk_entry_get_visibility(gtkEntry); 1184 } 1185 1186 /** 1187 * Sets completion to be the auxiliary completion object to use with entry. 1188 * All further configuration of the completion mechanism is done on 1189 * completion using the GtkEntryCompletion API. Completion is disabled if 1190 * completion is set to NULL. 1191 * Since 2.4 1192 * Params: 1193 * completion = The GtkEntryCompletion or NULL. [allow-none] 1194 */ 1195 public void setCompletion(EntryCompletion completion) 1196 { 1197 // void gtk_entry_set_completion (GtkEntry *entry, GtkEntryCompletion *completion); 1198 gtk_entry_set_completion(gtkEntry, (completion is null) ? null : completion.getEntryCompletionStruct()); 1199 } 1200 1201 /** 1202 * Returns the auxiliary completion object currently in use by entry. 1203 * Since 2.4 1204 * Returns: The auxiliary completion object currently in use by entry. [transfer none] 1205 */ 1206 public EntryCompletion getCompletion() 1207 { 1208 // GtkEntryCompletion * gtk_entry_get_completion (GtkEntry *entry); 1209 auto p = gtk_entry_get_completion(gtkEntry); 1210 1211 if(p is null) 1212 { 1213 return null; 1214 } 1215 1216 return ObjectG.getDObject!(EntryCompletion)(cast(GtkEntryCompletion*) p); 1217 } 1218 1219 /** 1220 * Hooks up an adjustment to the cursor position in an entry, so that when 1221 * the cursor is moved, the adjustment is scrolled to show that position. 1222 * See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining 1223 * the adjustment. 1224 * The adjustment has to be in pixel units and in the same coordinate system 1225 * as the entry. 1226 * Since 2.12 1227 * Params: 1228 * adjustment = an adjustment which should be adjusted when the cursor 1229 * is moved, or NULL 1230 */ 1231 public void setCursorHadjustment(Adjustment adjustment) 1232 { 1233 // void gtk_entry_set_cursor_hadjustment (GtkEntry *entry, GtkAdjustment *adjustment); 1234 gtk_entry_set_cursor_hadjustment(gtkEntry, (adjustment is null) ? null : adjustment.getAdjustmentStruct()); 1235 } 1236 1237 /** 1238 * Retrieves the horizontal cursor adjustment for the entry. 1239 * See gtk_entry_set_cursor_hadjustment(). 1240 * Since 2.12 1241 * Returns: the horizontal cursor adjustment, or NULL if none has been set. [transfer none] 1242 */ 1243 public Adjustment getCursorHadjustment() 1244 { 1245 // GtkAdjustment * gtk_entry_get_cursor_hadjustment (GtkEntry *entry); 1246 auto p = gtk_entry_get_cursor_hadjustment(gtkEntry); 1247 1248 if(p is null) 1249 { 1250 return null; 1251 } 1252 1253 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 1254 } 1255 1256 /** 1257 * Causes the entry's progress indicator to "fill in" the given 1258 * fraction of the bar. The fraction should be between 0.0 and 1.0, 1259 * inclusive. 1260 * Since 2.16 1261 * Params: 1262 * fraction = fraction of the task that's been completed 1263 */ 1264 public void setProgressFraction(double fraction) 1265 { 1266 // void gtk_entry_set_progress_fraction (GtkEntry *entry, gdouble fraction); 1267 gtk_entry_set_progress_fraction(gtkEntry, fraction); 1268 } 1269 1270 /** 1271 * Returns the current fraction of the task that's been completed. 1272 * See gtk_entry_set_progress_fraction(). 1273 * Since 2.16 1274 * Returns: a fraction from 0.0 to 1.0 1275 */ 1276 public double getProgressFraction() 1277 { 1278 // gdouble gtk_entry_get_progress_fraction (GtkEntry *entry); 1279 return gtk_entry_get_progress_fraction(gtkEntry); 1280 } 1281 1282 /** 1283 * Sets the fraction of total entry width to move the progress 1284 * bouncing block for each call to gtk_entry_progress_pulse(). 1285 * Since 2.16 1286 * Params: 1287 * fraction = fraction between 0.0 and 1.0 1288 */ 1289 public void setProgressPulseStep(double fraction) 1290 { 1291 // void gtk_entry_set_progress_pulse_step (GtkEntry *entry, gdouble fraction); 1292 gtk_entry_set_progress_pulse_step(gtkEntry, fraction); 1293 } 1294 1295 /** 1296 * Retrieves the pulse step set with gtk_entry_set_progress_pulse_step(). 1297 * Since 2.16 1298 * Returns: a fraction from 0.0 to 1.0 1299 */ 1300 public double getProgressPulseStep() 1301 { 1302 // gdouble gtk_entry_get_progress_pulse_step (GtkEntry *entry); 1303 return gtk_entry_get_progress_pulse_step(gtkEntry); 1304 } 1305 1306 /** 1307 * Indicates that some progress is made, but you don't know how much. 1308 * Causes the entry's progress indicator to enter "activity mode," 1309 * where a block bounces back and forth. Each call to 1310 * gtk_entry_progress_pulse() causes the block to move by a little bit 1311 * (the amount of movement per pulse is determined by 1312 * gtk_entry_set_progress_pulse_step()). 1313 * Since 2.16 1314 */ 1315 public void progressPulse() 1316 { 1317 // void gtk_entry_progress_pulse (GtkEntry *entry); 1318 gtk_entry_progress_pulse(gtkEntry); 1319 } 1320 1321 /** 1322 * Allow the GtkEntry input method to internally handle key press 1323 * and release events. If this function returns TRUE, then no further 1324 * processing should be done for this key event. See 1325 * gtk_im_context_filter_keypress(). 1326 * Note that you are expected to call this function from your handler 1327 * when overriding key event handling. This is needed in the case when 1328 * you need to insert your own key handling between the input method 1329 * and the default key event handling of the GtkEntry. 1330 * See gtk_text_view_reset_im_context() for an example of use. 1331 * Since 2.22 1332 * Params: 1333 * event = the key event. [type Gdk.EventKey] 1334 * Returns: TRUE if the input method handled the key event. 1335 */ 1336 public int imContextFilterKeypress(GdkEventKey* event) 1337 { 1338 // gboolean gtk_entry_im_context_filter_keypress (GtkEntry *entry, GdkEventKey *event); 1339 return gtk_entry_im_context_filter_keypress(gtkEntry, event); 1340 } 1341 1342 /** 1343 * Reset the input method context of the entry if needed. 1344 * This can be necessary in the case where modifying the buffer 1345 * would confuse on-going input method behavior. 1346 * Since 2.22 1347 */ 1348 public void resetImContext() 1349 { 1350 // void gtk_entry_reset_im_context (GtkEntry *entry); 1351 gtk_entry_reset_im_context(gtkEntry); 1352 } 1353 1354 /** 1355 * Gets the tabstops that were set on the entry using gtk_entry_set_tabs(), if 1356 * any. 1357 * Returns: the tabstops, or NULL if none was set. [transfer none] Since 3.10 1358 */ 1359 public PgTabArray getTabs() 1360 { 1361 // PangoTabArray * gtk_entry_get_tabs (GtkEntry *entry); 1362 auto p = gtk_entry_get_tabs(gtkEntry); 1363 1364 if(p is null) 1365 { 1366 return null; 1367 } 1368 1369 return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) p); 1370 } 1371 1372 /** 1373 * Sets a PangoTabArray; the tabstops in the array are applied to the entry 1374 * text. 1375 * Params: 1376 * tabs = a PangoTabArray 1377 * Since 3.10 1378 */ 1379 public void setTabs(PgTabArray tabs) 1380 { 1381 // void gtk_entry_set_tabs (GtkEntry *entry, PangoTabArray *tabs); 1382 gtk_entry_set_tabs(gtkEntry, (tabs is null) ? null : tabs.getPgTabArrayStruct()); 1383 } 1384 1385 /** 1386 * Sets the icon shown in the specified position using a pixbuf. 1387 * If pixbuf is NULL, no icon will be shown in the specified position. 1388 * Since 2.16 1389 * Params: 1390 * iconPos = Icon position 1391 * pixbuf = A GdkPixbuf, or NULL. [allow-none] 1392 */ 1393 public void setIconFromPixbuf(GtkEntryIconPosition iconPos, Pixbuf pixbuf) 1394 { 1395 // void gtk_entry_set_icon_from_pixbuf (GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf); 1396 gtk_entry_set_icon_from_pixbuf(gtkEntry, iconPos, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 1397 } 1398 1399 /** 1400 * Warning 1401 * gtk_entry_set_icon_from_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_entry_set_icon_from_icon_name() instead. 1402 * Sets the icon shown in the entry at the specified position from 1403 * a stock image. 1404 * If stock_id is NULL, no icon will be shown in the specified position. 1405 * Since 2.16 1406 * Params: 1407 * iconPos = Icon position 1408 * stockId = The name of the stock item, or NULL. [allow-none] 1409 */ 1410 public void setIconFromStock(GtkEntryIconPosition iconPos, string stockId) 1411 { 1412 // void gtk_entry_set_icon_from_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id); 1413 gtk_entry_set_icon_from_stock(gtkEntry, iconPos, Str.toStringz(stockId)); 1414 } 1415 1416 /** 1417 * Sets the icon shown in the entry at the specified position 1418 * from the current icon theme. 1419 * If the icon name isn't known, a "broken image" icon will be displayed 1420 * instead. 1421 * If icon_name is NULL, no icon will be shown in the specified position. 1422 * Since 2.16 1423 * Params: 1424 * iconPos = The position at which to set the icon 1425 * iconName = An icon name, or NULL. [allow-none] 1426 */ 1427 public void setIconFromIconName(GtkEntryIconPosition iconPos, string iconName) 1428 { 1429 // void gtk_entry_set_icon_from_icon_name (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *icon_name); 1430 gtk_entry_set_icon_from_icon_name(gtkEntry, iconPos, Str.toStringz(iconName)); 1431 } 1432 1433 /** 1434 * Sets the icon shown in the entry at the specified position 1435 * from the current icon theme. 1436 * If the icon isn't known, a "broken image" icon will be displayed 1437 * instead. 1438 * If icon is NULL, no icon will be shown in the specified position. 1439 * Since 2.16 1440 * Params: 1441 * iconPos = The position at which to set the icon 1442 * icon = The icon to set, or NULL. [allow-none] 1443 */ 1444 public void setIconFromGicon(GtkEntryIconPosition iconPos, IconIF icon) 1445 { 1446 // void gtk_entry_set_icon_from_gicon (GtkEntry *entry, GtkEntryIconPosition icon_pos, GIcon *icon); 1447 gtk_entry_set_icon_from_gicon(gtkEntry, iconPos, (icon is null) ? null : icon.getIconTStruct()); 1448 } 1449 1450 /** 1451 * Gets the type of representation being used by the icon 1452 * to store image data. If the icon has no image data, 1453 * the return value will be GTK_IMAGE_EMPTY. 1454 * Since 2.16 1455 * Params: 1456 * iconPos = Icon position 1457 * Returns: image representation being used 1458 */ 1459 public GtkImageType getIconStorageType(GtkEntryIconPosition iconPos) 1460 { 1461 // GtkImageType gtk_entry_get_icon_storage_type (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1462 return gtk_entry_get_icon_storage_type(gtkEntry, iconPos); 1463 } 1464 1465 /** 1466 * Retrieves the image used for the icon. 1467 * Unlike the other methods of setting and getting icon data, this 1468 * method will work regardless of whether the icon was set using a 1469 * GdkPixbuf, a GIcon, a stock item, or an icon name. 1470 * Since 2.16 1471 * Params: 1472 * iconPos = Icon position 1473 * Returns: A GdkPixbuf, or NULL if no icon is set for this position. [transfer none] 1474 */ 1475 public Pixbuf getIconPixbuf(GtkEntryIconPosition iconPos) 1476 { 1477 // GdkPixbuf * gtk_entry_get_icon_pixbuf (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1478 auto p = gtk_entry_get_icon_pixbuf(gtkEntry, iconPos); 1479 1480 if(p is null) 1481 { 1482 return null; 1483 } 1484 1485 import gtkc.gobject : g_object_ref; 1486 g_object_ref(cast(GObject*)p); 1487 1488 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 1489 } 1490 1491 /** 1492 * Warning 1493 * gtk_entry_get_icon_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_entry_get_icon_name() instead. 1494 * Retrieves the stock id used for the icon, or NULL if there is 1495 * no icon or if the icon was set by some other method (e.g., by 1496 * pixbuf, icon name or gicon). 1497 * Since 2.16 1498 * Params: 1499 * iconPos = Icon position 1500 * Returns: A stock id, or NULL if no icon is set or if the icon wasn't set from a stock id 1501 */ 1502 public string getIconStock(GtkEntryIconPosition iconPos) 1503 { 1504 // const gchar * gtk_entry_get_icon_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1505 return Str.toString(gtk_entry_get_icon_stock(gtkEntry, iconPos)); 1506 } 1507 1508 /** 1509 * Retrieves the icon name used for the icon, or NULL if there is 1510 * no icon or if the icon was set by some other method (e.g., by 1511 * pixbuf, stock or gicon). 1512 * Since 2.16 1513 * Params: 1514 * iconPos = Icon position 1515 * Returns: An icon name, or NULL if no icon is set or if the icon wasn't set from an icon name 1516 */ 1517 public string getIconName(GtkEntryIconPosition iconPos) 1518 { 1519 // const gchar * gtk_entry_get_icon_name (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1520 return Str.toString(gtk_entry_get_icon_name(gtkEntry, iconPos)); 1521 } 1522 1523 /** 1524 * Retrieves the GIcon used for the icon, or NULL if there is 1525 * no icon or if the icon was set by some other method (e.g., by 1526 * stock, pixbuf, or icon name). 1527 * Since 2.16 1528 * Params: 1529 * iconPos = Icon position 1530 * Returns: A GIcon, or NULL if no icon is set or if the icon is not a GIcon. [transfer none] 1531 */ 1532 public IconIF getIconGicon(GtkEntryIconPosition iconPos) 1533 { 1534 // GIcon * gtk_entry_get_icon_gicon (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1535 auto p = gtk_entry_get_icon_gicon(gtkEntry, iconPos); 1536 1537 if(p is null) 1538 { 1539 return null; 1540 } 1541 1542 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 1543 } 1544 1545 /** 1546 * Sets whether the icon is activatable. 1547 * Since 2.16 1548 * Params: 1549 * iconPos = Icon position 1550 * activatable = TRUE if the icon should be activatable 1551 */ 1552 public void setIconActivatable(GtkEntryIconPosition iconPos, int activatable) 1553 { 1554 // void gtk_entry_set_icon_activatable (GtkEntry *entry, GtkEntryIconPosition icon_pos, gboolean activatable); 1555 gtk_entry_set_icon_activatable(gtkEntry, iconPos, activatable); 1556 } 1557 1558 /** 1559 * Returns whether the icon is activatable. 1560 * Since 2.16 1561 * Params: 1562 * iconPos = Icon position 1563 * Returns: TRUE if the icon is activatable. 1564 */ 1565 public int getIconActivatable(GtkEntryIconPosition iconPos) 1566 { 1567 // gboolean gtk_entry_get_icon_activatable (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1568 return gtk_entry_get_icon_activatable(gtkEntry, iconPos); 1569 } 1570 1571 /** 1572 * Sets the sensitivity for the specified icon. 1573 * Since 2.16 1574 * Params: 1575 * iconPos = Icon position 1576 * sensitive = Specifies whether the icon should appear 1577 * sensitive or insensitive 1578 */ 1579 public void setIconSensitive(GtkEntryIconPosition iconPos, int sensitive) 1580 { 1581 // void gtk_entry_set_icon_sensitive (GtkEntry *entry, GtkEntryIconPosition icon_pos, gboolean sensitive); 1582 gtk_entry_set_icon_sensitive(gtkEntry, iconPos, sensitive); 1583 } 1584 1585 /** 1586 * Returns whether the icon appears sensitive or insensitive. 1587 * Since 2.16 1588 * Params: 1589 * iconPos = Icon position 1590 * Returns: TRUE if the icon is sensitive. 1591 */ 1592 public int getIconSensitive(GtkEntryIconPosition iconPos) 1593 { 1594 // gboolean gtk_entry_get_icon_sensitive (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1595 return gtk_entry_get_icon_sensitive(gtkEntry, iconPos); 1596 } 1597 1598 /** 1599 * Finds the icon at the given position and return its index. The 1600 * position's coordinates are relative to the entry's top left corner. 1601 * If x, y doesn't lie inside an icon, -1 is returned. 1602 * This function is intended for use in a "query-tooltip" 1603 * signal handler. 1604 * Since 2.16 1605 * Params: 1606 * x = the x coordinate of the position to find 1607 * y = the y coordinate of the position to find 1608 * Returns: the index of the icon at the given position, or -1 1609 */ 1610 public int getIconAtPos(int x, int y) 1611 { 1612 // gint gtk_entry_get_icon_at_pos (GtkEntry *entry, gint x, gint y); 1613 return gtk_entry_get_icon_at_pos(gtkEntry, x, y); 1614 } 1615 1616 /** 1617 * Sets tooltip as the contents of the tooltip for the icon 1618 * at the specified position. 1619 * Use NULL for tooltip to remove an existing tooltip. 1620 * See also gtk_widget_set_tooltip_text() and 1621 * gtk_entry_set_icon_tooltip_markup(). 1622 * Since 2.16 1623 * Params: 1624 * iconPos = the icon position 1625 * tooltip = the contents of the tooltip for the icon, or NULL. [allow-none] 1626 */ 1627 public void setIconTooltipText(GtkEntryIconPosition iconPos, string tooltip) 1628 { 1629 // void gtk_entry_set_icon_tooltip_text (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *tooltip); 1630 gtk_entry_set_icon_tooltip_text(gtkEntry, iconPos, Str.toStringz(tooltip)); 1631 } 1632 1633 /** 1634 * Gets the contents of the tooltip on the icon at the specified 1635 * position in entry. 1636 * Since 2.16 1637 * Params: 1638 * iconPos = the icon position 1639 * Returns: the tooltip text, or NULL. Free the returned string with g_free() when done. 1640 */ 1641 public string getIconTooltipText(GtkEntryIconPosition iconPos) 1642 { 1643 // gchar * gtk_entry_get_icon_tooltip_text (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1644 return Str.toString(gtk_entry_get_icon_tooltip_text(gtkEntry, iconPos)); 1645 } 1646 1647 /** 1648 * Sets tooltip as the contents of the tooltip for the icon at 1649 * the specified position. tooltip is assumed to be marked up with 1650 * the Pango text markup language. 1651 * Use NULL for tooltip to remove an existing tooltip. 1652 * See also gtk_widget_set_tooltip_markup() and 1653 * gtk_entry_set_icon_tooltip_text(). 1654 * Since 2.16 1655 * Params: 1656 * iconPos = the icon position 1657 * tooltip = the contents of the tooltip for the icon, or NULL. [allow-none] 1658 */ 1659 public void setIconTooltipMarkup(GtkEntryIconPosition iconPos, string tooltip) 1660 { 1661 // void gtk_entry_set_icon_tooltip_markup (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *tooltip); 1662 gtk_entry_set_icon_tooltip_markup(gtkEntry, iconPos, Str.toStringz(tooltip)); 1663 } 1664 1665 /** 1666 * Gets the contents of the tooltip on the icon at the specified 1667 * position in entry. 1668 * Since 2.16 1669 * Params: 1670 * iconPos = the icon position 1671 * Returns: the tooltip text, or NULL. Free the returned string with g_free() when done. 1672 */ 1673 public string getIconTooltipMarkup(GtkEntryIconPosition iconPos) 1674 { 1675 // gchar * gtk_entry_get_icon_tooltip_markup (GtkEntry *entry, GtkEntryIconPosition icon_pos); 1676 return Str.toString(gtk_entry_get_icon_tooltip_markup(gtkEntry, iconPos)); 1677 } 1678 1679 /** 1680 * Sets up the icon at the given position so that GTK+ will start a drag 1681 * operation when the user clicks and drags the icon. 1682 * To handle the drag operation, you need to connect to the usual 1683 * "drag-data-get" (or possibly "drag-data-delete") 1684 * signal, and use gtk_entry_get_current_icon_drag_source() in 1685 * your signal handler to find out if the drag was started from 1686 * an icon. 1687 * By default, GTK+ uses the icon as the drag icon. You can use the 1688 * "drag-begin" signal to set a different icon. Note that you 1689 * have to use g_signal_connect_after() to ensure that your signal handler 1690 * gets executed after the default handler. 1691 * Since 2.16 1692 * Params: 1693 * iconPos = icon position 1694 * targetList = the targets (data formats) in which the data can be provided 1695 * actions = a bitmask of the allowed drag actions 1696 */ 1697 public void setIconDragSource(GtkEntryIconPosition iconPos, TargetList targetList, GdkDragAction actions) 1698 { 1699 // void gtk_entry_set_icon_drag_source (GtkEntry *entry, GtkEntryIconPosition icon_pos, GtkTargetList *target_list, GdkDragAction actions); 1700 gtk_entry_set_icon_drag_source(gtkEntry, iconPos, (targetList is null) ? null : targetList.getTargetListStruct(), actions); 1701 } 1702 1703 /** 1704 * Returns the index of the icon which is the source of the current 1705 * DND operation, or -1. 1706 * This function is meant to be used in a "drag-data-get" 1707 * callback. 1708 * Since 2.16 1709 * Returns: index of the icon which is the source of the current DND operation, or -1. 1710 */ 1711 public int getCurrentIconDragSource() 1712 { 1713 // gint gtk_entry_get_current_icon_drag_source (GtkEntry *entry); 1714 return gtk_entry_get_current_icon_drag_source(gtkEntry); 1715 } 1716 1717 /** 1718 * Gets the area where entry's icon at icon_pos is drawn. 1719 * This function is useful when drawing something to the 1720 * entry in a draw callback. 1721 * If the entry is not realized or has no icon at the given position, 1722 * icon_area is filled with zeros. 1723 * See also gtk_entry_get_text_area() 1724 * Params: 1725 * iconPos = Icon position 1726 * iconArea = Return location for the icon's area. [out] 1727 * Since 3.0 1728 */ 1729 public void getIconArea(GtkEntryIconPosition iconPos, out Rectangle iconArea) 1730 { 1731 // void gtk_entry_get_icon_area (GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkRectangle *icon_area); 1732 gtk_entry_get_icon_area(gtkEntry, iconPos, &iconArea); 1733 } 1734 1735 /** 1736 * Sets the "input-purpose" property which 1737 * can be used by on-screen keyboards and other input 1738 * methods to adjust their behaviour. 1739 * Params: 1740 * purpose = the purpose 1741 * Since 3.6 1742 */ 1743 public void setInputPurpose(GtkInputPurpose purpose) 1744 { 1745 // void gtk_entry_set_input_purpose (GtkEntry *entry, GtkInputPurpose purpose); 1746 gtk_entry_set_input_purpose(gtkEntry, purpose); 1747 } 1748 1749 /** 1750 * Gets the value of the "input-purpose" property. 1751 */ 1752 public GtkInputPurpose getInputPurpose() 1753 { 1754 // GtkInputPurpose gtk_entry_get_input_purpose (GtkEntry *entry); 1755 return gtk_entry_get_input_purpose(gtkEntry); 1756 } 1757 1758 /** 1759 * Sets the "input-hints" property, which 1760 * allows input methods to fine-tune their behaviour. 1761 * Params: 1762 * hints = the hints 1763 * Since 3.6 1764 */ 1765 public void setInputHints(GtkInputHints hints) 1766 { 1767 // void gtk_entry_set_input_hints (GtkEntry *entry, GtkInputHints hints); 1768 gtk_entry_set_input_hints(gtkEntry, hints); 1769 } 1770 1771 /** 1772 * Gets the value of the "input-hints" property. 1773 */ 1774 public GtkInputHints getInputHints() 1775 { 1776 // GtkInputHints gtk_entry_get_input_hints (GtkEntry *entry); 1777 return gtk_entry_get_input_hints(gtkEntry); 1778 } 1779 }