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