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