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