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