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