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