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 * Allow the #GtkEntry input method to internally handle key press 859 * and release events. If this function returns %TRUE, then no further 860 * processing should be done for this key event. See 861 * gtk_im_context_filter_keypress(). 862 * 863 * Note that you are expected to call this function from your handler 864 * when overriding key event handling. This is needed in the case when 865 * you need to insert your own key handling between the input method 866 * and the default key event handling of the #GtkEntry. 867 * See gtk_text_view_reset_im_context() for an example of use. 868 * 869 * Params: 870 * event = the key event 871 * 872 * Return: %TRUE if the input method handled the key event. 873 * 874 * Since: 2.22 875 */ 876 public bool imContextFilterKeypress(GdkEventKey* event) 877 { 878 return gtk_entry_im_context_filter_keypress(gtkEntry, event) != 0; 879 } 880 881 /** 882 * Converts from a position in the entry contents (returned 883 * by gtk_entry_get_text()) to a position in the 884 * entry’s #PangoLayout (returned by gtk_entry_get_layout(), 885 * with text retrieved via pango_layout_get_text()). 886 * 887 * Params: 888 * layoutIndex = byte index into the entry layout text 889 * 890 * Return: byte index into the entry contents 891 */ 892 public int layoutIndexToTextIndex(int layoutIndex) 893 { 894 return gtk_entry_layout_index_to_text_index(gtkEntry, layoutIndex); 895 } 896 897 /** 898 * Indicates that some progress is made, but you don’t know how much. 899 * Causes the entry’s progress indicator to enter “activity mode,” 900 * where a block bounces back and forth. Each call to 901 * gtk_entry_progress_pulse() causes the block to move by a little bit 902 * (the amount of movement per pulse is determined by 903 * gtk_entry_set_progress_pulse_step()). 904 * 905 * Since: 2.16 906 */ 907 public void progressPulse() 908 { 909 gtk_entry_progress_pulse(gtkEntry); 910 } 911 912 /** 913 * Reset the input method context of the entry if needed. 914 * 915 * This can be necessary in the case where modifying the buffer 916 * would confuse on-going input method behavior. 917 * 918 * Since: 2.22 919 */ 920 public void resetImContext() 921 { 922 gtk_entry_reset_im_context(gtkEntry); 923 } 924 925 /** 926 * If @setting is %TRUE, pressing Enter in the @entry will activate the default 927 * widget for the window containing the entry. This usually means that 928 * the dialog box containing the entry will be closed, since the default 929 * widget is usually one of the dialog buttons. 930 * 931 * (For experts: if @setting is %TRUE, the entry calls 932 * gtk_window_activate_default() on the window containing the entry, in 933 * the default handler for the #GtkEntry::activate signal.) 934 * 935 * Params: 936 * setting = %TRUE to activate window’s default widget on Enter keypress 937 */ 938 public void setActivatesDefault(bool setting) 939 { 940 gtk_entry_set_activates_default(gtkEntry, setting); 941 } 942 943 /** 944 * Sets the alignment for the contents of the entry. This controls 945 * the horizontal positioning of the contents when the displayed 946 * text is shorter than the width of the entry. 947 * 948 * Params: 949 * xalign = The horizontal alignment, from 0 (left) to 1 (right). 950 * Reversed for RTL layouts 951 * 952 * Since: 2.4 953 */ 954 public void setAlignment(float xalign) 955 { 956 gtk_entry_set_alignment(gtkEntry, xalign); 957 } 958 959 /** 960 * Sets a #PangoAttrList; the attributes in the list are applied to the 961 * entry text. 962 * 963 * Params: 964 * attrs = a #PangoAttrList 965 * 966 * Since: 3.6 967 */ 968 public void setAttributes(PgAttributeList attrs) 969 { 970 gtk_entry_set_attributes(gtkEntry, (attrs is null) ? null : attrs.getPgAttributeListStruct()); 971 } 972 973 /** 974 * Set the #GtkEntryBuffer object which holds the text for 975 * this widget. 976 * 977 * Params: 978 * buffer = a #GtkEntryBuffer 979 * 980 * Since: 2.18 981 */ 982 public void setBuffer(EntryBuffer buffer) 983 { 984 gtk_entry_set_buffer(gtkEntry, (buffer is null) ? null : buffer.getEntryBufferStruct()); 985 } 986 987 /** 988 * Sets @completion to be the auxiliary completion object to use with @entry. 989 * All further configuration of the completion mechanism is done on 990 * @completion using the #GtkEntryCompletion API. Completion is disabled if 991 * @completion is set to %NULL. 992 * 993 * Params: 994 * completion = The #GtkEntryCompletion or %NULL 995 * 996 * Since: 2.4 997 */ 998 public void setCompletion(EntryCompletion completion) 999 { 1000 gtk_entry_set_completion(gtkEntry, (completion is null) ? null : completion.getEntryCompletionStruct()); 1001 } 1002 1003 /** 1004 * Hooks up an adjustment to the cursor position in an entry, so that when 1005 * the cursor is moved, the adjustment is scrolled to show that position. 1006 * See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining 1007 * the adjustment. 1008 * 1009 * The adjustment has to be in pixel units and in the same coordinate system 1010 * as the entry. 1011 * 1012 * Params: 1013 * adjustment = an adjustment which should be adjusted when the cursor 1014 * is moved, or %NULL 1015 * 1016 * Since: 2.12 1017 */ 1018 public void setCursorHadjustment(Adjustment adjustment) 1019 { 1020 gtk_entry_set_cursor_hadjustment(gtkEntry, (adjustment is null) ? null : adjustment.getAdjustmentStruct()); 1021 } 1022 1023 /** 1024 * Sets whether the entry has a beveled frame around it. 1025 * 1026 * Params: 1027 * setting = new value 1028 */ 1029 public void setHasFrame(bool setting) 1030 { 1031 gtk_entry_set_has_frame(gtkEntry, setting); 1032 } 1033 1034 /** 1035 * Sets whether the icon is activatable. 1036 * 1037 * Params: 1038 * iconPos = Icon position 1039 * activatable = %TRUE if the icon should be activatable 1040 * 1041 * Since: 2.16 1042 */ 1043 public void setIconActivatable(GtkEntryIconPosition iconPos, bool activatable) 1044 { 1045 gtk_entry_set_icon_activatable(gtkEntry, iconPos, activatable); 1046 } 1047 1048 /** 1049 * Sets up the icon at the given position so that GTK+ will start a drag 1050 * operation when the user clicks and drags the icon. 1051 * 1052 * To handle the drag operation, you need to connect to the usual 1053 * #GtkWidget::drag-data-get (or possibly #GtkWidget::drag-data-delete) 1054 * signal, and use gtk_entry_get_current_icon_drag_source() in 1055 * your signal handler to find out if the drag was started from 1056 * an icon. 1057 * 1058 * By default, GTK+ uses the icon as the drag icon. You can use the 1059 * #GtkWidget::drag-begin signal to set a different icon. Note that you 1060 * have to use g_signal_connect_after() to ensure that your signal handler 1061 * gets executed after the default handler. 1062 * 1063 * Params: 1064 * iconPos = icon position 1065 * targetList = the targets (data formats) in which the data can be provided 1066 * actions = a bitmask of the allowed drag actions 1067 * 1068 * Since: 2.16 1069 */ 1070 public void setIconDragSource(GtkEntryIconPosition iconPos, TargetList targetList, GdkDragAction actions) 1071 { 1072 gtk_entry_set_icon_drag_source(gtkEntry, iconPos, (targetList is null) ? null : targetList.getTargetListStruct(), actions); 1073 } 1074 1075 /** 1076 * Sets the icon shown in the entry at the specified position 1077 * from the current icon theme. 1078 * If the icon isn’t known, a “broken image” icon will be displayed 1079 * instead. 1080 * 1081 * If @icon is %NULL, no icon will be shown in the specified position. 1082 * 1083 * Params: 1084 * iconPos = The position at which to set the icon 1085 * icon = The icon to set, or %NULL 1086 * 1087 * Since: 2.16 1088 */ 1089 public void setIconFromGicon(GtkEntryIconPosition iconPos, IconIF icon) 1090 { 1091 gtk_entry_set_icon_from_gicon(gtkEntry, iconPos, (icon is null) ? null : icon.getIconStruct()); 1092 } 1093 1094 /** 1095 * Sets the icon shown in the entry at the specified position 1096 * from the current icon theme. 1097 * 1098 * If the icon name isn’t known, a “broken image” icon will be displayed 1099 * instead. 1100 * 1101 * If @icon_name is %NULL, no icon will be shown in the specified position. 1102 * 1103 * Params: 1104 * iconPos = The position at which to set the icon 1105 * iconName = An icon name, or %NULL 1106 * 1107 * Since: 2.16 1108 */ 1109 public void setIconFromIconName(GtkEntryIconPosition iconPos, string iconName) 1110 { 1111 gtk_entry_set_icon_from_icon_name(gtkEntry, iconPos, Str.toStringz(iconName)); 1112 } 1113 1114 /** 1115 * Sets the icon shown in the specified position using a pixbuf. 1116 * 1117 * If @pixbuf is %NULL, no icon will be shown in the specified position. 1118 * 1119 * Params: 1120 * iconPos = Icon position 1121 * pixbuf = A #GdkPixbuf, or %NULL 1122 * 1123 * Since: 2.16 1124 */ 1125 public void setIconFromPixbuf(GtkEntryIconPosition iconPos, Pixbuf pixbuf) 1126 { 1127 gtk_entry_set_icon_from_pixbuf(gtkEntry, iconPos, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 1128 } 1129 1130 /** 1131 * Sets the icon shown in the entry at the specified position from 1132 * a stock image. 1133 * 1134 * If @stock_id is %NULL, no icon will be shown in the specified position. 1135 * 1136 * Deprecated: Use gtk_entry_set_icon_from_icon_name() instead. 1137 * 1138 * Params: 1139 * iconPos = Icon position 1140 * stockId = The name of the stock item, or %NULL 1141 * 1142 * Since: 2.16 1143 */ 1144 public void setIconFromStock(GtkEntryIconPosition iconPos, string stockId) 1145 { 1146 gtk_entry_set_icon_from_stock(gtkEntry, iconPos, Str.toStringz(stockId)); 1147 } 1148 1149 /** 1150 * Sets the sensitivity for the specified icon. 1151 * 1152 * Params: 1153 * iconPos = Icon position 1154 * sensitive = Specifies whether the icon should appear 1155 * sensitive or insensitive 1156 * 1157 * Since: 2.16 1158 */ 1159 public void setIconSensitive(GtkEntryIconPosition iconPos, bool sensitive) 1160 { 1161 gtk_entry_set_icon_sensitive(gtkEntry, iconPos, sensitive); 1162 } 1163 1164 /** 1165 * Sets @tooltip as the contents of the tooltip for the icon at 1166 * the specified position. @tooltip is assumed to be marked up with 1167 * the [Pango text markup language][PangoMarkupFormat]. 1168 * 1169 * Use %NULL for @tooltip to remove an existing tooltip. 1170 * 1171 * See also gtk_widget_set_tooltip_markup() and 1172 * gtk_entry_set_icon_tooltip_text(). 1173 * 1174 * Params: 1175 * iconPos = the icon position 1176 * tooltip = the contents of the tooltip for the icon, or %NULL 1177 * 1178 * Since: 2.16 1179 */ 1180 public void setIconTooltipMarkup(GtkEntryIconPosition iconPos, string tooltip) 1181 { 1182 gtk_entry_set_icon_tooltip_markup(gtkEntry, iconPos, Str.toStringz(tooltip)); 1183 } 1184 1185 /** 1186 * Sets @tooltip as the contents of the tooltip for the icon 1187 * at the specified position. 1188 * 1189 * Use %NULL for @tooltip to remove an existing tooltip. 1190 * 1191 * See also gtk_widget_set_tooltip_text() and 1192 * gtk_entry_set_icon_tooltip_markup(). 1193 * 1194 * Params: 1195 * iconPos = the icon position 1196 * tooltip = the contents of the tooltip for the icon, or %NULL 1197 * 1198 * Since: 2.16 1199 */ 1200 public void setIconTooltipText(GtkEntryIconPosition iconPos, string tooltip) 1201 { 1202 gtk_entry_set_icon_tooltip_text(gtkEntry, iconPos, Str.toStringz(tooltip)); 1203 } 1204 1205 /** 1206 * Sets %entry’s inner-border property to @border, or clears it if %NULL 1207 * is passed. The inner-border is the area around the entry’s text, but 1208 * inside its frame. 1209 * 1210 * If set, this property overrides the inner-border style property. 1211 * Overriding the style-provided border is useful when you want to do 1212 * in-place editing of some text in a canvas or list widget, where 1213 * pixel-exact positioning of the entry is important. 1214 * 1215 * Deprecated: Use the standard border and padding CSS properties (through 1216 * objects like #GtkStyleContext and #GtkCssProvider); the value set with 1217 * this function is ignored by #GtkEntry. 1218 * 1219 * Params: 1220 * border = a #GtkBorder, or %NULL 1221 * 1222 * Since: 2.10 1223 */ 1224 public void setInnerBorder(Border border) 1225 { 1226 gtk_entry_set_inner_border(gtkEntry, (border is null) ? null : border.getBorderStruct()); 1227 } 1228 1229 /** 1230 * Sets the #GtkEntry:input-hints property, which 1231 * allows input methods to fine-tune their behaviour. 1232 * 1233 * Params: 1234 * hints = the hints 1235 * 1236 * Since: 3.6 1237 */ 1238 public void setInputHints(GtkInputHints hints) 1239 { 1240 gtk_entry_set_input_hints(gtkEntry, hints); 1241 } 1242 1243 /** 1244 * Sets the #GtkEntry:input-purpose property which 1245 * can be used by on-screen keyboards and other input 1246 * methods to adjust their behaviour. 1247 * 1248 * Params: 1249 * purpose = the purpose 1250 * 1251 * Since: 3.6 1252 */ 1253 public void setInputPurpose(GtkInputPurpose purpose) 1254 { 1255 gtk_entry_set_input_purpose(gtkEntry, purpose); 1256 } 1257 1258 /** 1259 * Sets the character to use in place of the actual text when 1260 * gtk_entry_set_visibility() has been called to set text visibility 1261 * to %FALSE. i.e. this is the character used in “password mode” to 1262 * show the user how many characters have been typed. By default, GTK+ 1263 * picks the best invisible char available in the current font. If you 1264 * set the invisible char to 0, then the user will get no feedback 1265 * at all; there will be no text on the screen as they type. 1266 * 1267 * Params: 1268 * ch = a Unicode character 1269 */ 1270 public void setInvisibleChar(dchar ch) 1271 { 1272 gtk_entry_set_invisible_char(gtkEntry, ch); 1273 } 1274 1275 /** 1276 * Sets the maximum allowed length of the contents of the widget. If 1277 * the current contents are longer than the given length, then they 1278 * will be truncated to fit. 1279 * 1280 * This is equivalent to: 1281 * 1282 * |[<!-- language="C" --> 1283 * GtkEntryBuffer *buffer; 1284 * buffer = gtk_entry_get_buffer (entry); 1285 * gtk_entry_buffer_set_max_length (buffer, max); 1286 * ]| 1287 * 1288 * Params: 1289 * max = the maximum length of the entry, or 0 for no maximum. 1290 * (other than the maximum length of entries.) The value passed in will 1291 * be clamped to the range 0-65536. 1292 */ 1293 public void setMaxLength(int max) 1294 { 1295 gtk_entry_set_max_length(gtkEntry, max); 1296 } 1297 1298 /** 1299 * Sets the desired maximum width in characters of @entry. 1300 * 1301 * Params: 1302 * nChars = the new desired maximum width, in characters 1303 * 1304 * Since: 3.12 1305 */ 1306 public void setMaxWidthChars(int nChars) 1307 { 1308 gtk_entry_set_max_width_chars(gtkEntry, nChars); 1309 } 1310 1311 /** 1312 * Sets whether the text is overwritten when typing in the #GtkEntry. 1313 * 1314 * Params: 1315 * overwrite = new value 1316 * 1317 * Since: 2.14 1318 */ 1319 public void setOverwriteMode(bool overwrite) 1320 { 1321 gtk_entry_set_overwrite_mode(gtkEntry, overwrite); 1322 } 1323 1324 /** 1325 * Sets text to be displayed in @entry when it is empty and unfocused. 1326 * This can be used to give a visual hint of the expected contents of 1327 * the #GtkEntry. 1328 * 1329 * Note that since the placeholder text gets removed when the entry 1330 * received focus, using this feature is a bit problematic if the entry 1331 * is given the initial focus in a window. Sometimes this can be 1332 * worked around by delaying the initial focus setting until the 1333 * first key event arrives. 1334 * 1335 * Params: 1336 * text = a string to be displayed when @entry is empty an unfocused, or %NULL 1337 * 1338 * Since: 3.2 1339 */ 1340 public void setPlaceholderText(string text) 1341 { 1342 gtk_entry_set_placeholder_text(gtkEntry, Str.toStringz(text)); 1343 } 1344 1345 /** 1346 * Causes the entry’s progress indicator to “fill in” the given 1347 * fraction of the bar. The fraction should be between 0.0 and 1.0, 1348 * inclusive. 1349 * 1350 * Params: 1351 * fraction = fraction of the task that’s been completed 1352 * 1353 * Since: 2.16 1354 */ 1355 public void setProgressFraction(double fraction) 1356 { 1357 gtk_entry_set_progress_fraction(gtkEntry, fraction); 1358 } 1359 1360 /** 1361 * Sets the fraction of total entry width to move the progress 1362 * bouncing block for each call to gtk_entry_progress_pulse(). 1363 * 1364 * Params: 1365 * fraction = fraction between 0.0 and 1.0 1366 * 1367 * Since: 2.16 1368 */ 1369 public void setProgressPulseStep(double fraction) 1370 { 1371 gtk_entry_set_progress_pulse_step(gtkEntry, fraction); 1372 } 1373 1374 /** 1375 * Sets a #PangoTabArray; the tabstops in the array are applied to the entry 1376 * text. 1377 * 1378 * Params: 1379 * tabs = a #PangoTabArray 1380 * 1381 * Since: 3.10 1382 */ 1383 public void setTabs(PgTabArray tabs) 1384 { 1385 gtk_entry_set_tabs(gtkEntry, (tabs is null) ? null : tabs.getPgTabArrayStruct()); 1386 } 1387 1388 /** 1389 * Sets the text in the widget to the given 1390 * value, replacing the current contents. 1391 * 1392 * See gtk_entry_buffer_set_text(). 1393 * 1394 * Params: 1395 * text = the new text 1396 */ 1397 public void setText(string text) 1398 { 1399 gtk_entry_set_text(gtkEntry, Str.toStringz(text)); 1400 } 1401 1402 /** 1403 * Sets whether the contents of the entry are visible or not. 1404 * When visibility is set to %FALSE, characters are displayed 1405 * as the invisible char, and will also appear that way when 1406 * the text in the entry widget is copied elsewhere. 1407 * 1408 * By default, GTK+ picks the best invisible character available 1409 * in the current font, but it can be changed with 1410 * gtk_entry_set_invisible_char(). 1411 * 1412 * Note that you probably want to set #GtkEntry:input-purpose 1413 * to %GTK_INPUT_PURPOSE_PASSWORD or %GTK_INPUT_PURPOSE_PIN to 1414 * inform input methods about the purpose of this entry, 1415 * in addition to setting visibility to %FALSE. 1416 * 1417 * Params: 1418 * visible = %TRUE if the contents of the entry are displayed 1419 * as plaintext 1420 */ 1421 public void setVisibility(bool visible) 1422 { 1423 gtk_entry_set_visibility(gtkEntry, visible); 1424 } 1425 1426 /** 1427 * Changes the size request of the entry to be about the right size 1428 * for @n_chars characters. Note that it changes the size 1429 * request, the size can still be affected by 1430 * how you pack the widget into containers. If @n_chars is -1, the 1431 * size reverts to the default entry size. 1432 * 1433 * Params: 1434 * nChars = width in chars 1435 */ 1436 public void setWidthChars(int nChars) 1437 { 1438 gtk_entry_set_width_chars(gtkEntry, nChars); 1439 } 1440 1441 /** 1442 * Converts from a position in the entry’s #PangoLayout (returned by 1443 * gtk_entry_get_layout()) to a position in the entry contents 1444 * (returned by gtk_entry_get_text()). 1445 * 1446 * Params: 1447 * textIndex = byte index into the entry contents 1448 * 1449 * Return: byte index into the entry layout text 1450 */ 1451 public int textIndexToLayoutIndex(int textIndex) 1452 { 1453 return gtk_entry_text_index_to_layout_index(gtkEntry, textIndex); 1454 } 1455 1456 /** 1457 * Unsets the invisible char previously set with 1458 * gtk_entry_set_invisible_char(). So that the 1459 * default invisible char is used again. 1460 * 1461 * Since: 2.16 1462 */ 1463 public void unsetInvisibleChar() 1464 { 1465 gtk_entry_unset_invisible_char(gtkEntry); 1466 } 1467 1468 int[string] connectedSignals; 1469 1470 void delegate(Entry)[] onActivateListeners; 1471 /** 1472 * The ::activate signal is emitted when the user hits 1473 * the Enter key. 1474 * 1475 * While this signal is used as a 1476 * [keybinding signal][GtkBindingSignal], 1477 * it is also commonly used by applications to intercept 1478 * activation of entries. 1479 * 1480 * The default bindings for this signal are all forms of the Enter key. 1481 */ 1482 void addOnActivate(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1483 { 1484 if ( "activate" !in connectedSignals ) 1485 { 1486 Signals.connectData( 1487 this, 1488 "activate", 1489 cast(GCallback)&callBackActivate, 1490 cast(void*)this, 1491 null, 1492 connectFlags); 1493 connectedSignals["activate"] = 1; 1494 } 1495 onActivateListeners ~= dlg; 1496 } 1497 extern(C) static void callBackActivate(GtkEntry* entryStruct, Entry _entry) 1498 { 1499 foreach ( void delegate(Entry) dlg; _entry.onActivateListeners ) 1500 { 1501 dlg(_entry); 1502 } 1503 } 1504 1505 void delegate(Entry)[] onBackspaceListeners; 1506 /** 1507 * The ::backspace signal is a 1508 * [keybinding signal][GtkBindingSignal] 1509 * which gets emitted when the user asks for it. 1510 * 1511 * The default bindings for this signal are 1512 * Backspace and Shift-Backspace. 1513 */ 1514 void addOnBackspace(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1515 { 1516 if ( "backspace" !in connectedSignals ) 1517 { 1518 Signals.connectData( 1519 this, 1520 "backspace", 1521 cast(GCallback)&callBackBackspace, 1522 cast(void*)this, 1523 null, 1524 connectFlags); 1525 connectedSignals["backspace"] = 1; 1526 } 1527 onBackspaceListeners ~= dlg; 1528 } 1529 extern(C) static void callBackBackspace(GtkEntry* entryStruct, Entry _entry) 1530 { 1531 foreach ( void delegate(Entry) dlg; _entry.onBackspaceListeners ) 1532 { 1533 dlg(_entry); 1534 } 1535 } 1536 1537 void delegate(Entry)[] onCopyClipboardListeners; 1538 /** 1539 * The ::copy-clipboard signal is a 1540 * [keybinding signal][GtkBindingSignal] 1541 * which gets emitted to copy the selection to the clipboard. 1542 * 1543 * The default bindings for this signal are 1544 * Ctrl-c and Ctrl-Insert. 1545 */ 1546 void addOnCopyClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1547 { 1548 if ( "copy-clipboard" !in connectedSignals ) 1549 { 1550 Signals.connectData( 1551 this, 1552 "copy-clipboard", 1553 cast(GCallback)&callBackCopyClipboard, 1554 cast(void*)this, 1555 null, 1556 connectFlags); 1557 connectedSignals["copy-clipboard"] = 1; 1558 } 1559 onCopyClipboardListeners ~= dlg; 1560 } 1561 extern(C) static void callBackCopyClipboard(GtkEntry* entryStruct, Entry _entry) 1562 { 1563 foreach ( void delegate(Entry) dlg; _entry.onCopyClipboardListeners ) 1564 { 1565 dlg(_entry); 1566 } 1567 } 1568 1569 void delegate(Entry)[] onCutClipboardListeners; 1570 /** 1571 * The ::cut-clipboard signal is a 1572 * [keybinding signal][GtkBindingSignal] 1573 * which gets emitted to cut the selection to the clipboard. 1574 * 1575 * The default bindings for this signal are 1576 * Ctrl-x and Shift-Delete. 1577 */ 1578 void addOnCutClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1579 { 1580 if ( "cut-clipboard" !in connectedSignals ) 1581 { 1582 Signals.connectData( 1583 this, 1584 "cut-clipboard", 1585 cast(GCallback)&callBackCutClipboard, 1586 cast(void*)this, 1587 null, 1588 connectFlags); 1589 connectedSignals["cut-clipboard"] = 1; 1590 } 1591 onCutClipboardListeners ~= dlg; 1592 } 1593 extern(C) static void callBackCutClipboard(GtkEntry* entryStruct, Entry _entry) 1594 { 1595 foreach ( void delegate(Entry) dlg; _entry.onCutClipboardListeners ) 1596 { 1597 dlg(_entry); 1598 } 1599 } 1600 1601 void delegate(GtkDeleteType, int, Entry)[] onDeleteFromCursorListeners; 1602 /** 1603 * The ::delete-from-cursor signal is a 1604 * [keybinding signal][GtkBindingSignal] 1605 * which gets emitted when the user initiates a text deletion. 1606 * 1607 * If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection 1608 * if there is one, otherwise it deletes the requested number 1609 * of characters. 1610 * 1611 * The default bindings for this signal are 1612 * Delete for deleting a character and Ctrl-Delete for 1613 * deleting a word. 1614 * 1615 * Params: 1616 * type = the granularity of the deletion, as a #GtkDeleteType 1617 * count = the number of @type units to delete 1618 */ 1619 void addOnDeleteFromCursor(void delegate(GtkDeleteType, int, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1620 { 1621 if ( "delete-from-cursor" !in connectedSignals ) 1622 { 1623 Signals.connectData( 1624 this, 1625 "delete-from-cursor", 1626 cast(GCallback)&callBackDeleteFromCursor, 1627 cast(void*)this, 1628 null, 1629 connectFlags); 1630 connectedSignals["delete-from-cursor"] = 1; 1631 } 1632 onDeleteFromCursorListeners ~= dlg; 1633 } 1634 extern(C) static void callBackDeleteFromCursor(GtkEntry* entryStruct, GtkDeleteType type, int count, Entry _entry) 1635 { 1636 foreach ( void delegate(GtkDeleteType, int, Entry) dlg; _entry.onDeleteFromCursorListeners ) 1637 { 1638 dlg(type, count, _entry); 1639 } 1640 } 1641 1642 void delegate(GtkEntryIconPosition, GdkEventButton*, Entry)[] onIconPressListeners; 1643 /** 1644 * The ::icon-press signal is emitted when an activatable icon 1645 * is clicked. 1646 * 1647 * Params: 1648 * iconPos = The position of the clicked icon 1649 * event = the button press event 1650 * 1651 * Since: 2.16 1652 */ 1653 void addOnIconPress(void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1654 { 1655 if ( "icon-press" !in connectedSignals ) 1656 { 1657 Signals.connectData( 1658 this, 1659 "icon-press", 1660 cast(GCallback)&callBackIconPress, 1661 cast(void*)this, 1662 null, 1663 connectFlags); 1664 connectedSignals["icon-press"] = 1; 1665 } 1666 onIconPressListeners ~= dlg; 1667 } 1668 extern(C) static void callBackIconPress(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEventButton* event, Entry _entry) 1669 { 1670 foreach ( void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg; _entry.onIconPressListeners ) 1671 { 1672 dlg(iconPos, event, _entry); 1673 } 1674 } 1675 1676 void delegate(GtkEntryIconPosition, Event, Entry)[] onIconPressGenericListeners; 1677 /** 1678 * The ::icon-press signal is emitted when an activatable icon 1679 * is clicked. 1680 * 1681 * Params: 1682 * iconPos = The position of the clicked icon 1683 * event = the button press event 1684 * 1685 * Since: 2.16 1686 */ 1687 void addOnIconPress(void delegate(GtkEntryIconPosition, Event, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1688 { 1689 if ( "icon-press-generic-event" !in connectedSignals ) 1690 { 1691 Signals.connectData( 1692 this, 1693 "icon-press", 1694 cast(GCallback)&callBackIconPressGeneric, 1695 cast(void*)this, 1696 null, 1697 connectFlags); 1698 connectedSignals["icon-press-generic-event"] = 1; 1699 } 1700 onIconPressGenericListeners ~= dlg; 1701 } 1702 extern(C) static void callBackIconPressGeneric(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEvent* event, Entry _entry) 1703 { 1704 foreach ( void delegate(GtkEntryIconPosition, Event, Entry) dlg; _entry.onIconPressGenericListeners ) 1705 { 1706 dlg(iconPos, ObjectG.getDObject!(Event)(event), _entry); 1707 } 1708 } 1709 1710 void delegate(GtkEntryIconPosition, GdkEventButton*, Entry)[] onIconReleaseListeners; 1711 /** 1712 * The ::icon-release signal is emitted on the button release from a 1713 * mouse click over an activatable icon. 1714 * 1715 * Params: 1716 * iconPos = The position of the clicked icon 1717 * event = the button release event 1718 * 1719 * Since: 2.16 1720 */ 1721 void addOnIconRelease(void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1722 { 1723 if ( "icon-release" !in connectedSignals ) 1724 { 1725 Signals.connectData( 1726 this, 1727 "icon-release", 1728 cast(GCallback)&callBackIconRelease, 1729 cast(void*)this, 1730 null, 1731 connectFlags); 1732 connectedSignals["icon-release"] = 1; 1733 } 1734 onIconReleaseListeners ~= dlg; 1735 } 1736 extern(C) static void callBackIconRelease(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEventButton* event, Entry _entry) 1737 { 1738 foreach ( void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg; _entry.onIconReleaseListeners ) 1739 { 1740 dlg(iconPos, event, _entry); 1741 } 1742 } 1743 1744 void delegate(GtkEntryIconPosition, Event, Entry)[] onIconReleaseGenericListeners; 1745 /** 1746 * The ::icon-release signal is emitted on the button release from a 1747 * mouse click over an activatable icon. 1748 * 1749 * Params: 1750 * iconPos = The position of the clicked icon 1751 * event = the button release event 1752 * 1753 * Since: 2.16 1754 */ 1755 void addOnIconRelease(void delegate(GtkEntryIconPosition, Event, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1756 { 1757 if ( "icon-release-generic-event" !in connectedSignals ) 1758 { 1759 Signals.connectData( 1760 this, 1761 "icon-release", 1762 cast(GCallback)&callBackIconReleaseGeneric, 1763 cast(void*)this, 1764 null, 1765 connectFlags); 1766 connectedSignals["icon-release-generic-event"] = 1; 1767 } 1768 onIconReleaseGenericListeners ~= dlg; 1769 } 1770 extern(C) static void callBackIconReleaseGeneric(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEvent* event, Entry _entry) 1771 { 1772 foreach ( void delegate(GtkEntryIconPosition, Event, Entry) dlg; _entry.onIconReleaseGenericListeners ) 1773 { 1774 dlg(iconPos, ObjectG.getDObject!(Event)(event), _entry); 1775 } 1776 } 1777 1778 void delegate(string, Entry)[] onInsertAtCursorListeners; 1779 /** 1780 * The ::insert-at-cursor signal is a 1781 * [keybinding signal][GtkBindingSignal] 1782 * which gets emitted when the user initiates the insertion of a 1783 * fixed string at the cursor. 1784 * 1785 * This signal has no default bindings. 1786 * 1787 * Params: 1788 * str = the string to insert 1789 */ 1790 void addOnInsertAtCursor(void delegate(string, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1791 { 1792 if ( "insert-at-cursor" !in connectedSignals ) 1793 { 1794 Signals.connectData( 1795 this, 1796 "insert-at-cursor", 1797 cast(GCallback)&callBackInsertAtCursor, 1798 cast(void*)this, 1799 null, 1800 connectFlags); 1801 connectedSignals["insert-at-cursor"] = 1; 1802 } 1803 onInsertAtCursorListeners ~= dlg; 1804 } 1805 extern(C) static void callBackInsertAtCursor(GtkEntry* entryStruct, char* str, Entry _entry) 1806 { 1807 foreach ( void delegate(string, Entry) dlg; _entry.onInsertAtCursorListeners ) 1808 { 1809 dlg(Str.toString(str), _entry); 1810 } 1811 } 1812 1813 void delegate(GtkMovementStep, int, bool, Entry)[] onMoveCursorListeners; 1814 /** 1815 * The ::move-cursor signal is a 1816 * [keybinding signal][GtkBindingSignal] 1817 * which gets emitted when the user initiates a cursor movement. 1818 * If the cursor is not visible in @entry, this signal causes 1819 * the viewport to be moved instead. 1820 * 1821 * Applications should not connect to it, but may emit it with 1822 * g_signal_emit_by_name() if they need to control the cursor 1823 * programmatically. 1824 * 1825 * The default bindings for this signal come in two variants, 1826 * the variant with the Shift modifier extends the selection, 1827 * the variant without the Shift modifer does not. 1828 * There are too many key combinations to list them all here. 1829 * - Arrow keys move by individual characters/lines 1830 * - Ctrl-arrow key combinations move by words/paragraphs 1831 * - Home/End keys move to the ends of the buffer 1832 * 1833 * Params: 1834 * step = the granularity of the move, as a #GtkMovementStep 1835 * count = the number of @step units to move 1836 * extendSelection = %TRUE if the move should extend the selection 1837 */ 1838 void addOnMoveCursor(void delegate(GtkMovementStep, int, bool, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1839 { 1840 if ( "move-cursor" !in connectedSignals ) 1841 { 1842 Signals.connectData( 1843 this, 1844 "move-cursor", 1845 cast(GCallback)&callBackMoveCursor, 1846 cast(void*)this, 1847 null, 1848 connectFlags); 1849 connectedSignals["move-cursor"] = 1; 1850 } 1851 onMoveCursorListeners ~= dlg; 1852 } 1853 extern(C) static void callBackMoveCursor(GtkEntry* entryStruct, GtkMovementStep step, int count, bool extendSelection, Entry _entry) 1854 { 1855 foreach ( void delegate(GtkMovementStep, int, bool, Entry) dlg; _entry.onMoveCursorListeners ) 1856 { 1857 dlg(step, count, extendSelection, _entry); 1858 } 1859 } 1860 1861 void delegate(Entry)[] onPasteClipboardListeners; 1862 /** 1863 * The ::paste-clipboard signal is a 1864 * [keybinding signal][GtkBindingSignal] 1865 * which gets emitted to paste the contents of the clipboard 1866 * into the text view. 1867 * 1868 * The default bindings for this signal are 1869 * Ctrl-v and Shift-Insert. 1870 */ 1871 void addOnPasteClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1872 { 1873 if ( "paste-clipboard" !in connectedSignals ) 1874 { 1875 Signals.connectData( 1876 this, 1877 "paste-clipboard", 1878 cast(GCallback)&callBackPasteClipboard, 1879 cast(void*)this, 1880 null, 1881 connectFlags); 1882 connectedSignals["paste-clipboard"] = 1; 1883 } 1884 onPasteClipboardListeners ~= dlg; 1885 } 1886 extern(C) static void callBackPasteClipboard(GtkEntry* entryStruct, Entry _entry) 1887 { 1888 foreach ( void delegate(Entry) dlg; _entry.onPasteClipboardListeners ) 1889 { 1890 dlg(_entry); 1891 } 1892 } 1893 1894 void delegate(Widget, Entry)[] onPopulatePopupListeners; 1895 /** 1896 * The ::populate-popup signal gets emitted before showing the 1897 * context menu of the entry. 1898 * 1899 * If you need to add items to the context menu, connect 1900 * to this signal and append your items to the @widget, which 1901 * will be a #GtkMenu in this case. 1902 * 1903 * If #GtkEntry:populate-all is %TRUE, this signal will 1904 * also be emitted to populate touch popups. In this case, 1905 * @widget will be a different container, e.g. a #GtkToolbar. 1906 * The signal handler should not make assumptions about the 1907 * type of @widget. 1908 * 1909 * Params: 1910 * popup = the container that is being populated 1911 */ 1912 void addOnPopulatePopup(void delegate(Widget, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1913 { 1914 if ( "populate-popup" !in connectedSignals ) 1915 { 1916 Signals.connectData( 1917 this, 1918 "populate-popup", 1919 cast(GCallback)&callBackPopulatePopup, 1920 cast(void*)this, 1921 null, 1922 connectFlags); 1923 connectedSignals["populate-popup"] = 1; 1924 } 1925 onPopulatePopupListeners ~= dlg; 1926 } 1927 extern(C) static void callBackPopulatePopup(GtkEntry* entryStruct, GtkWidget* popup, Entry _entry) 1928 { 1929 foreach ( void delegate(Widget, Entry) dlg; _entry.onPopulatePopupListeners ) 1930 { 1931 dlg(ObjectG.getDObject!(Widget)(popup), _entry); 1932 } 1933 } 1934 1935 void delegate(string, Entry)[] onPreeditChangedListeners; 1936 /** 1937 * If an input method is used, the typed text will not immediately 1938 * be committed to the buffer. So if you are interested in the text, 1939 * connect to this signal. 1940 * 1941 * Params: 1942 * preedit = the current preedit string 1943 * 1944 * Since: 2.20 1945 */ 1946 void addOnPreeditChanged(void delegate(string, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1947 { 1948 if ( "preedit-changed" !in connectedSignals ) 1949 { 1950 Signals.connectData( 1951 this, 1952 "preedit-changed", 1953 cast(GCallback)&callBackPreeditChanged, 1954 cast(void*)this, 1955 null, 1956 connectFlags); 1957 connectedSignals["preedit-changed"] = 1; 1958 } 1959 onPreeditChangedListeners ~= dlg; 1960 } 1961 extern(C) static void callBackPreeditChanged(GtkEntry* entryStruct, char* preedit, Entry _entry) 1962 { 1963 foreach ( void delegate(string, Entry) dlg; _entry.onPreeditChangedListeners ) 1964 { 1965 dlg(Str.toString(preedit), _entry); 1966 } 1967 } 1968 1969 void delegate(Entry)[] onToggleOverwriteListeners; 1970 /** 1971 * The ::toggle-overwrite signal is a 1972 * [keybinding signal][GtkBindingSignal] 1973 * which gets emitted to toggle the overwrite mode of the entry. 1974 * 1975 * The default bindings for this signal is Insert. 1976 */ 1977 void addOnToggleOverwrite(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1978 { 1979 if ( "toggle-overwrite" !in connectedSignals ) 1980 { 1981 Signals.connectData( 1982 this, 1983 "toggle-overwrite", 1984 cast(GCallback)&callBackToggleOverwrite, 1985 cast(void*)this, 1986 null, 1987 connectFlags); 1988 connectedSignals["toggle-overwrite"] = 1; 1989 } 1990 onToggleOverwriteListeners ~= dlg; 1991 } 1992 extern(C) static void callBackToggleOverwrite(GtkEntry* entryStruct, Entry _entry) 1993 { 1994 foreach ( void delegate(Entry) dlg; _entry.onToggleOverwriteListeners ) 1995 { 1996 dlg(_entry); 1997 } 1998 } 1999 }