1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.Entry; 26 27 private import gdk.Event; 28 private import gdkpixbuf.Pixbuf; 29 private import gio.Icon; 30 private import gio.IconIF; 31 private import glib.ConstructionException; 32 private import glib.Str; 33 private import gobject.ObjectG; 34 private import gobject.Signals; 35 private import gtk.Adjustment; 36 private import gtk.Border; 37 private import gtk.CellEditableIF; 38 private import gtk.CellEditableT; 39 private import gtk.EditableIF; 40 private import gtk.EditableT; 41 private import gtk.EntryBuffer; 42 private import gtk.EntryCompletion; 43 private import gtk.TargetList; 44 private import gtk.Widget; 45 public import gtkc.gdktypes; 46 private import gtkc.gtk; 47 public import gtkc.gtktypes; 48 private import pango.PgAttributeList; 49 private import pango.PgLayout; 50 private import pango.PgTabArray; 51 52 53 /** 54 * The #GtkEntry widget is a single line text entry 55 * widget. A fairly large set of key bindings are supported 56 * by default. If the entered text is longer than the allocation 57 * of the widget, the widget will scroll so that the cursor 58 * position is visible. 59 * 60 * When using an entry for passwords and other sensitive information, 61 * it can be put into “password mode” using gtk_entry_set_visibility(). 62 * In this mode, entered text is displayed using a “invisible” character. 63 * By default, GTK+ picks the best invisible character that is available 64 * in the current font, but it can be changed with 65 * gtk_entry_set_invisible_char(). Since 2.16, GTK+ displays a warning 66 * when Caps Lock or input methods might interfere with entering text in 67 * a password entry. The warning can be turned off with the 68 * #GtkEntry:caps-lock-warning property. 69 * 70 * Since 2.16, GtkEntry has the ability to display progress or activity 71 * information behind the text. To make an entry display such information, 72 * use gtk_entry_set_progress_fraction() or gtk_entry_set_progress_pulse_step(). 73 * 74 * Additionally, GtkEntry can show icons at either side of the entry. These 75 * icons can be activatable by clicking, can be set up as drag source and 76 * can have tooltips. To add an icon, use gtk_entry_set_icon_from_gicon() or 77 * one of the various other functions that set an icon from a stock id, an 78 * icon name or a pixbuf. To trigger an action when the user clicks an icon, 79 * connect to the #GtkEntry::icon-press signal. To allow DND operations 80 * from an icon, use gtk_entry_set_icon_drag_source(). To set a tooltip on 81 * an icon, use gtk_entry_set_icon_tooltip_text() or the corresponding function 82 * for markup. 83 * 84 * Note that functionality or information that is only available by clicking 85 * on an icon in an entry may not be accessible at all to users which are not 86 * able to use a mouse or other pointing device. It is therefore recommended 87 * that any such functionality should also be available by other means, e.g. 88 * via the context menu of the entry. 89 * 90 * # 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() 134 { 135 return gtkEntry; 136 } 137 138 /** the main Gtk struct as a void* */ 139 protected override void* getStruct() 140 { 141 return cast(void*)gtkEntry; 142 } 143 144 protected override void setStruct(GObject* obj) 145 { 146 gtkEntry = cast(GtkEntry*)obj; 147 super.setStruct(obj); 148 } 149 150 /** 151 * Sets our main struct and passes it to the parent class. 152 */ 153 public this (GtkEntry* gtkEntry, bool ownedRef = false) 154 { 155 this.gtkEntry = gtkEntry; 156 super(cast(GtkWidget*)gtkEntry, ownedRef); 157 } 158 159 // add the CellEditable capabilities 160 mixin CellEditableT!(GtkEntry); 161 162 // add the Editable capabilities 163 mixin EditableT!(GtkEntry); 164 165 /** */ 166 public this (string text) 167 { 168 this(); 169 setText(text); 170 } 171 172 /** */ 173 public this (string text, int max) 174 { 175 this(text); 176 setMaxLength(max); 177 } 178 179 /** 180 * Gets the stock id of action. 181 * Since 2.16 182 * Returns: the stock id 183 */ 184 public StockID getStockId(GtkEntryIconPosition iconPos) 185 { 186 return cast(StockID)Str.toString(gtk_entry_get_icon_stock(gtkEntry, iconPos)); 187 } 188 189 /** 190 * Sets the stock id on action 191 * Since 2.16 192 * Params: 193 * stockId = the stock id 194 */ 195 public void setStockId(GtkEntryIconPosition iconPos, StockID stockId) 196 { 197 // void gtk_entry_set_icon_from_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id); 198 gtk_entry_set_icon_from_stock(gtkEntry, iconPos, Str.toStringz(stockId)); 199 } 200 201 /** 202 */ 203 204 /** */ 205 public static GType getType() 206 { 207 return gtk_entry_get_type(); 208 } 209 210 /** 211 * Creates a new entry. 212 * 213 * Return: a new #GtkEntry. 214 * 215 * Throws: ConstructionException GTK+ fails to create the object. 216 */ 217 public this() 218 { 219 auto p = gtk_entry_new(); 220 221 if(p is null) 222 { 223 throw new ConstructionException("null returned by new"); 224 } 225 226 this(cast(GtkEntry*) p); 227 } 228 229 /** 230 * Creates a new entry with the specified text buffer. 231 * 232 * Params: 233 * buffer = The buffer to use for the new #GtkEntry. 234 * 235 * Return: a new #GtkEntry 236 * 237 * Since: 2.18 238 * 239 * Throws: ConstructionException GTK+ fails to create the object. 240 */ 241 public this(EntryBuffer buffer) 242 { 243 auto p = gtk_entry_new_with_buffer((buffer is null) ? null : buffer.getEntryBufferStruct()); 244 245 if(p is null) 246 { 247 throw new ConstructionException("null returned by new_with_buffer"); 248 } 249 250 this(cast(GtkEntry*) p); 251 } 252 253 /** 254 * Retrieves the value set by gtk_entry_set_activates_default(). 255 * 256 * Return: %TRUE if the entry will activate the default widget 257 */ 258 public bool getActivatesDefault() 259 { 260 return gtk_entry_get_activates_default(gtkEntry) != 0; 261 } 262 263 /** 264 * Gets the value set by gtk_entry_set_alignment(). 265 * 266 * Return: the alignment 267 * 268 * Since: 2.4 269 */ 270 public float getAlignment() 271 { 272 return gtk_entry_get_alignment(gtkEntry); 273 } 274 275 /** 276 * Gets the attribute list that was set on the entry using 277 * gtk_entry_set_attributes(), if any. 278 * 279 * Return: the attribute list, or %NULL 280 * if none was set. 281 * 282 * Since: 3.6 283 */ 284 public PgAttributeList getAttributes() 285 { 286 auto p = gtk_entry_get_attributes(gtkEntry); 287 288 if(p is null) 289 { 290 return null; 291 } 292 293 return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) p); 294 } 295 296 /** 297 * Get the #GtkEntryBuffer object which holds the text for 298 * this widget. 299 * 300 * Return: A #GtkEntryBuffer object. 301 * 302 * Since: 2.18 303 */ 304 public EntryBuffer getBuffer() 305 { 306 auto p = gtk_entry_get_buffer(gtkEntry); 307 308 if(p is null) 309 { 310 return null; 311 } 312 313 return ObjectG.getDObject!(EntryBuffer)(cast(GtkEntryBuffer*) p); 314 } 315 316 /** 317 * Returns the auxiliary completion object currently in use by @entry. 318 * 319 * Return: The auxiliary completion object currently 320 * in use by @entry. 321 * 322 * Since: 2.4 323 */ 324 public EntryCompletion getCompletion() 325 { 326 auto p = gtk_entry_get_completion(gtkEntry); 327 328 if(p is null) 329 { 330 return null; 331 } 332 333 return ObjectG.getDObject!(EntryCompletion)(cast(GtkEntryCompletion*) p); 334 } 335 336 /** 337 * Returns the index of the icon which is the source of the current 338 * DND operation, or -1. 339 * 340 * This function is meant to be used in a #GtkWidget::drag-data-get 341 * callback. 342 * 343 * Return: index of the icon which is the source of the current 344 * DND operation, or -1. 345 * 346 * Since: 2.16 347 */ 348 public int getCurrentIconDragSource() 349 { 350 return gtk_entry_get_current_icon_drag_source(gtkEntry); 351 } 352 353 /** 354 * Retrieves the horizontal cursor adjustment for the entry. 355 * See gtk_entry_set_cursor_hadjustment(). 356 * 357 * Return: the horizontal cursor adjustment, or %NULL 358 * if none has been set. 359 * 360 * Since: 2.12 361 */ 362 public Adjustment getCursorHadjustment() 363 { 364 auto p = gtk_entry_get_cursor_hadjustment(gtkEntry); 365 366 if(p is null) 367 { 368 return null; 369 } 370 371 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 372 } 373 374 /** 375 * Gets the value set by gtk_entry_set_has_frame(). 376 * 377 * Return: whether the entry has a beveled frame 378 */ 379 public bool getHasFrame() 380 { 381 return gtk_entry_get_has_frame(gtkEntry) != 0; 382 } 383 384 /** 385 * Returns whether the icon is activatable. 386 * 387 * Params: 388 * iconPos = Icon position 389 * 390 * Return: %TRUE if the icon is activatable. 391 * 392 * Since: 2.16 393 */ 394 public bool getIconActivatable(GtkEntryIconPosition iconPos) 395 { 396 return gtk_entry_get_icon_activatable(gtkEntry, iconPos) != 0; 397 } 398 399 /** 400 * Gets the area where entry’s icon at @icon_pos is drawn. 401 * This function is useful when drawing something to the 402 * entry in a draw callback. 403 * 404 * If the entry is not realized or has no icon at the given position, 405 * @icon_area is filled with zeros. 406 * 407 * See also gtk_entry_get_text_area() 408 * 409 * Params: 410 * iconPos = Icon position 411 * iconArea = Return location for the icon’s area 412 * 413 * Since: 3.0 414 */ 415 public void getIconArea(GtkEntryIconPosition iconPos, out GdkRectangle iconArea) 416 { 417 gtk_entry_get_icon_area(gtkEntry, iconPos, &iconArea); 418 } 419 420 /** 421 * Finds the icon at the given position and return its index. The 422 * position’s coordinates are relative to the @entry’s top left corner. 423 * If @x, @y doesn’t lie inside an icon, -1 is returned. 424 * This function is intended for use in a #GtkWidget::query-tooltip 425 * signal handler. 426 * 427 * Params: 428 * x = the x coordinate of the position to find 429 * y = the y coordinate of the position to find 430 * 431 * Return: the index of the icon at the given position, or -1 432 * 433 * Since: 2.16 434 */ 435 public int getIconAtPos(int x, int y) 436 { 437 return gtk_entry_get_icon_at_pos(gtkEntry, x, y); 438 } 439 440 /** 441 * Retrieves the #GIcon used for the icon, or %NULL if there is 442 * no icon or if the icon was set by some other method (e.g., by 443 * stock, pixbuf, or icon name). 444 * 445 * Params: 446 * iconPos = Icon position 447 * 448 * Return: A #GIcon, or %NULL if no icon is set 449 * or if the icon is not a #GIcon 450 * 451 * Since: 2.16 452 */ 453 public IconIF getIconGicon(GtkEntryIconPosition iconPos) 454 { 455 auto p = gtk_entry_get_icon_gicon(gtkEntry, iconPos); 456 457 if(p is null) 458 { 459 return null; 460 } 461 462 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 463 } 464 465 /** 466 * Retrieves the icon name used for the icon, or %NULL if there is 467 * no icon or if the icon was set by some other method (e.g., by 468 * pixbuf, stock or gicon). 469 * 470 * Params: 471 * iconPos = Icon position 472 * 473 * Return: An icon name, or %NULL if no icon is set or if the icon 474 * wasn’t set from an icon name 475 * 476 * Since: 2.16 477 */ 478 public string getIconName(GtkEntryIconPosition iconPos) 479 { 480 return Str.toString(gtk_entry_get_icon_name(gtkEntry, iconPos)); 481 } 482 483 /** 484 * Retrieves the image used for the icon. 485 * 486 * Unlike the other methods of setting and getting icon data, this 487 * method will work regardless of whether the icon was set using a 488 * #GdkPixbuf, a #GIcon, a stock item, or an icon name. 489 * 490 * Params: 491 * iconPos = Icon position 492 * 493 * Return: A #GdkPixbuf, or %NULL if no icon is 494 * set for this position. 495 * 496 * Since: 2.16 497 */ 498 public Pixbuf getIconPixbuf(GtkEntryIconPosition iconPos) 499 { 500 auto p = gtk_entry_get_icon_pixbuf(gtkEntry, iconPos); 501 502 if(p is null) 503 { 504 return null; 505 } 506 507 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 508 } 509 510 /** 511 * Returns whether the icon appears sensitive or insensitive. 512 * 513 * Params: 514 * iconPos = Icon position 515 * 516 * Return: %TRUE if the icon is sensitive. 517 * 518 * Since: 2.16 519 */ 520 public bool getIconSensitive(GtkEntryIconPosition iconPos) 521 { 522 return gtk_entry_get_icon_sensitive(gtkEntry, iconPos) != 0; 523 } 524 525 /** 526 * Retrieves the stock id used for the icon, or %NULL if there is 527 * no icon or if the icon was set by some other method (e.g., by 528 * pixbuf, icon name or gicon). 529 * 530 * Deprecated: Use gtk_entry_get_icon_name() instead. 531 * 532 * Params: 533 * iconPos = Icon position 534 * 535 * Return: A stock id, or %NULL if no icon is set or if the icon 536 * wasn’t set from a stock id 537 * 538 * Since: 2.16 539 */ 540 public string getIconStock(GtkEntryIconPosition iconPos) 541 { 542 return Str.toString(gtk_entry_get_icon_stock(gtkEntry, iconPos)); 543 } 544 545 /** 546 * Gets the type of representation being used by the icon 547 * to store image data. If the icon has no image data, 548 * the return value will be %GTK_IMAGE_EMPTY. 549 * 550 * Params: 551 * iconPos = Icon position 552 * 553 * Return: image representation being used 554 * 555 * Since: 2.16 556 */ 557 public GtkImageType getIconStorageType(GtkEntryIconPosition iconPos) 558 { 559 return gtk_entry_get_icon_storage_type(gtkEntry, iconPos); 560 } 561 562 /** 563 * Gets the contents of the tooltip on the icon at the specified 564 * position in @entry. 565 * 566 * Params: 567 * iconPos = the icon position 568 * 569 * Return: the tooltip text, or %NULL. Free the returned 570 * string with g_free() when done. 571 * 572 * Since: 2.16 573 */ 574 public string getIconTooltipMarkup(GtkEntryIconPosition iconPos) 575 { 576 auto retStr = gtk_entry_get_icon_tooltip_markup(gtkEntry, iconPos); 577 578 scope(exit) Str.freeString(retStr); 579 return Str.toString(retStr); 580 } 581 582 /** 583 * Gets the contents of the tooltip on the icon at the specified 584 * position in @entry. 585 * 586 * Params: 587 * iconPos = the icon position 588 * 589 * Return: the tooltip text, or %NULL. Free the returned 590 * string with g_free() when done. 591 * 592 * Since: 2.16 593 */ 594 public string getIconTooltipText(GtkEntryIconPosition iconPos) 595 { 596 auto retStr = gtk_entry_get_icon_tooltip_text(gtkEntry, iconPos); 597 598 scope(exit) Str.freeString(retStr); 599 return Str.toString(retStr); 600 } 601 602 /** 603 * This function returns the entry’s #GtkEntry:inner-border property. See 604 * gtk_entry_set_inner_border() for more information. 605 * 606 * Deprecated: Use the standard border and padding CSS properties (through 607 * objects like #GtkStyleContext and #GtkCssProvider); the value returned by 608 * this function is ignored by #GtkEntry. 609 * 610 * Return: the entry’s #GtkBorder, or 611 * %NULL if none was set. 612 * 613 * Since: 2.10 614 */ 615 public Border getInnerBorder() 616 { 617 auto p = gtk_entry_get_inner_border(gtkEntry); 618 619 if(p is null) 620 { 621 return null; 622 } 623 624 return ObjectG.getDObject!(Border)(cast(GtkBorder*) p); 625 } 626 627 /** 628 * Gets the value of the #GtkEntry:input-hints property. 629 * 630 * Since: 3.6 631 */ 632 public GtkInputHints getInputHints() 633 { 634 return gtk_entry_get_input_hints(gtkEntry); 635 } 636 637 /** 638 * Gets the value of the #GtkEntry:input-purpose property. 639 * 640 * Since: 3.6 641 */ 642 public GtkInputPurpose getInputPurpose() 643 { 644 return gtk_entry_get_input_purpose(gtkEntry); 645 } 646 647 /** 648 * Retrieves the character displayed in place of the real characters 649 * for entries with visibility set to false. See gtk_entry_set_invisible_char(). 650 * 651 * Return: the current invisible char, or 0, if the entry does not 652 * show invisible text at all. 653 */ 654 public dchar getInvisibleChar() 655 { 656 return gtk_entry_get_invisible_char(gtkEntry); 657 } 658 659 /** 660 * Gets the #PangoLayout used to display the entry. 661 * The layout is useful to e.g. convert text positions to 662 * pixel positions, in combination with gtk_entry_get_layout_offsets(). 663 * The returned layout is owned by the entry and must not be 664 * modified or freed by the caller. 665 * 666 * Keep in mind that the layout text may contain a preedit string, so 667 * gtk_entry_layout_index_to_text_index() and 668 * gtk_entry_text_index_to_layout_index() are needed to convert byte 669 * indices in the layout to byte indices in the entry contents. 670 * 671 * Return: the #PangoLayout for this entry 672 */ 673 public PgLayout getLayout() 674 { 675 auto p = gtk_entry_get_layout(gtkEntry); 676 677 if(p is null) 678 { 679 return null; 680 } 681 682 return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) p); 683 } 684 685 /** 686 * Obtains the position of the #PangoLayout used to render text 687 * in the entry, in widget coordinates. Useful if you want to line 688 * up the text in an entry with some other text, e.g. when using the 689 * entry to implement editable cells in a sheet widget. 690 * 691 * Also useful to convert mouse events into coordinates inside the 692 * #PangoLayout, e.g. to take some action if some part of the entry text 693 * is clicked. 694 * 695 * Note that as the user scrolls around in the entry the offsets will 696 * change; you’ll need to connect to the “notify::scroll-offset” 697 * signal to track this. Remember when using the #PangoLayout 698 * functions you need to convert to and from pixels using 699 * PANGO_PIXELS() or #PANGO_SCALE. 700 * 701 * Keep in mind that the layout text may contain a preedit string, so 702 * gtk_entry_layout_index_to_text_index() and 703 * gtk_entry_text_index_to_layout_index() are needed to convert byte 704 * indices in the layout to byte indices in the entry contents. 705 * 706 * Params: 707 * x = location to store X offset of layout, or %NULL 708 * y = location to store Y offset of layout, or %NULL 709 */ 710 public void getLayoutOffsets(out int x, out int y) 711 { 712 gtk_entry_get_layout_offsets(gtkEntry, &x, &y); 713 } 714 715 /** 716 * Retrieves the maximum allowed length of the text in 717 * @entry. See gtk_entry_set_max_length(). 718 * 719 * This is equivalent to: 720 * 721 * |[<!-- language="C" --> 722 * GtkEntryBuffer *buffer; 723 * buffer = gtk_entry_get_buffer (entry); 724 * gtk_entry_buffer_get_max_length (buffer); 725 * ]| 726 * 727 * Return: the maximum allowed number of characters 728 * in #GtkEntry, or 0 if there is no maximum. 729 */ 730 public int getMaxLength() 731 { 732 return gtk_entry_get_max_length(gtkEntry); 733 } 734 735 /** 736 * Retrieves the desired maximum width of @entry, in characters. 737 * See gtk_entry_set_max_width_chars(). 738 * 739 * Return: the maximum width of the entry, in characters 740 * 741 * Since: 3.12 742 */ 743 public int getMaxWidthChars() 744 { 745 return gtk_entry_get_max_width_chars(gtkEntry); 746 } 747 748 /** 749 * Gets the value set by gtk_entry_set_overwrite_mode(). 750 * 751 * Return: whether the text is overwritten when typing. 752 * 753 * Since: 2.14 754 */ 755 public bool getOverwriteMode() 756 { 757 return gtk_entry_get_overwrite_mode(gtkEntry) != 0; 758 } 759 760 /** 761 * Retrieves the text that will be displayed when @entry is empty and unfocused 762 * 763 * Return: a pointer to the placeholder text as a string. This string points to internally allocated 764 * storage in the widget and must not be freed, modified or stored. 765 * 766 * Since: 3.2 767 */ 768 public string getPlaceholderText() 769 { 770 return Str.toString(gtk_entry_get_placeholder_text(gtkEntry)); 771 } 772 773 /** 774 * Returns the current fraction of the task that’s been completed. 775 * See gtk_entry_set_progress_fraction(). 776 * 777 * Return: a fraction from 0.0 to 1.0 778 * 779 * Since: 2.16 780 */ 781 public double getProgressFraction() 782 { 783 return gtk_entry_get_progress_fraction(gtkEntry); 784 } 785 786 /** 787 * Retrieves the pulse step set with gtk_entry_set_progress_pulse_step(). 788 * 789 * Return: a fraction from 0.0 to 1.0 790 * 791 * Since: 2.16 792 */ 793 public double getProgressPulseStep() 794 { 795 return gtk_entry_get_progress_pulse_step(gtkEntry); 796 } 797 798 /** 799 * Gets the tabstops that were set on the entry using gtk_entry_set_tabs(), if 800 * any. 801 * 802 * Return: the tabstops, or %NULL if none was set. 803 * 804 * Since: 3.10 805 */ 806 public PgTabArray getTabs() 807 { 808 auto p = gtk_entry_get_tabs(gtkEntry); 809 810 if(p is null) 811 { 812 return null; 813 } 814 815 return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) p); 816 } 817 818 /** 819 * Retrieves the contents of the entry widget. 820 * See also gtk_editable_get_chars(). 821 * 822 * This is equivalent to: 823 * 824 * |[<!-- language="C" --> 825 * GtkEntryBuffer *buffer; 826 * buffer = gtk_entry_get_buffer (entry); 827 * gtk_entry_buffer_get_text (buffer); 828 * ]| 829 * 830 * Return: a pointer to the contents of the widget as a 831 * string. This string points to internally allocated 832 * storage in the widget and must not be freed, modified or 833 * stored. 834 */ 835 public string getText() 836 { 837 return Str.toString(gtk_entry_get_text(gtkEntry)); 838 } 839 840 /** 841 * Gets the area where the entry’s text is drawn. This function is 842 * useful when drawing something to the entry in a draw callback. 843 * 844 * If the entry is not realized, @text_area is filled with zeros. 845 * 846 * See also gtk_entry_get_icon_area(). 847 * 848 * Params: 849 * textArea = Return location for the text area. 850 * 851 * Since: 3.0 852 */ 853 public void getTextArea(out GdkRectangle textArea) 854 { 855 gtk_entry_get_text_area(gtkEntry, &textArea); 856 } 857 858 /** 859 * Retrieves the current length of the text in 860 * @entry. 861 * 862 * This is equivalent to: 863 * 864 * |[<!-- language="C" --> 865 * GtkEntryBuffer *buffer; 866 * buffer = gtk_entry_get_buffer (entry); 867 * gtk_entry_buffer_get_length (buffer); 868 * ]| 869 * 870 * Return: the current number of characters 871 * in #GtkEntry, or 0 if there are none. 872 * 873 * Since: 2.14 874 */ 875 public ushort getTextLength() 876 { 877 return gtk_entry_get_text_length(gtkEntry); 878 } 879 880 /** 881 * Retrieves whether the text in @entry is visible. See 882 * gtk_entry_set_visibility(). 883 * 884 * Return: %TRUE if the text is currently visible 885 */ 886 public bool getVisibility() 887 { 888 return gtk_entry_get_visibility(gtkEntry) != 0; 889 } 890 891 /** 892 * Gets the value set by gtk_entry_set_width_chars(). 893 * 894 * Return: number of chars to request space for, or negative if unset 895 */ 896 public int getWidthChars() 897 { 898 return gtk_entry_get_width_chars(gtkEntry); 899 } 900 901 /** 902 * Causes @entry to have keyboard focus. 903 * 904 * It behaves like gtk_widget_grab_focus(), 905 * except that it doesn't select the contents of the entry. 906 * You only want to call this on some special entries 907 * which the user usually doesn't want to replace all text in, 908 * such as search-as-you-type entries. 909 * 910 * Since: 3.16 911 */ 912 public void grabFocusWithoutSelecting() 913 { 914 gtk_entry_grab_focus_without_selecting(gtkEntry); 915 } 916 917 /** 918 * Allow the #GtkEntry input method to internally handle key press 919 * and release events. If this function returns %TRUE, then no further 920 * processing should be done for this key event. See 921 * gtk_im_context_filter_keypress(). 922 * 923 * Note that you are expected to call this function from your handler 924 * when overriding key event handling. This is needed in the case when 925 * you need to insert your own key handling between the input method 926 * and the default key event handling of the #GtkEntry. 927 * See gtk_text_view_reset_im_context() for an example of use. 928 * 929 * Params: 930 * event = the key event 931 * 932 * Return: %TRUE if the input method handled the key event. 933 * 934 * Since: 2.22 935 */ 936 public bool imContextFilterKeypress(GdkEventKey* event) 937 { 938 return gtk_entry_im_context_filter_keypress(gtkEntry, event) != 0; 939 } 940 941 /** 942 * Converts from a position in the entry contents (returned 943 * by gtk_entry_get_text()) to a position in the 944 * entry’s #PangoLayout (returned by gtk_entry_get_layout(), 945 * with text retrieved via pango_layout_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’s #PangoLayout (returned by 1503 * gtk_entry_get_layout()) to a position in the entry contents 1504 * (returned by gtk_entry_get_text()). 1505 * 1506 * Params: 1507 * textIndex = byte index into the entry contents 1508 * 1509 * Return: byte index into the entry layout text 1510 */ 1511 public int textIndexToLayoutIndex(int textIndex) 1512 { 1513 return gtk_entry_text_index_to_layout_index(gtkEntry, textIndex); 1514 } 1515 1516 /** 1517 * Unsets the invisible char previously set with 1518 * gtk_entry_set_invisible_char(). So that the 1519 * default invisible char is used again. 1520 * 1521 * Since: 2.16 1522 */ 1523 public void unsetInvisibleChar() 1524 { 1525 gtk_entry_unset_invisible_char(gtkEntry); 1526 } 1527 1528 int[string] connectedSignals; 1529 1530 void delegate(Entry)[] onActivateListeners; 1531 /** 1532 * The ::activate signal is emitted when the user hits 1533 * the Enter key. 1534 * 1535 * While this signal is used as a 1536 * [keybinding signal][GtkBindingSignal], 1537 * it is also commonly used by applications to intercept 1538 * activation of entries. 1539 * 1540 * The default bindings for this signal are all forms of the Enter key. 1541 */ 1542 void addOnActivate(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1543 { 1544 if ( "activate" !in connectedSignals ) 1545 { 1546 Signals.connectData( 1547 this, 1548 "activate", 1549 cast(GCallback)&callBackActivate, 1550 cast(void*)this, 1551 null, 1552 connectFlags); 1553 connectedSignals["activate"] = 1; 1554 } 1555 onActivateListeners ~= dlg; 1556 } 1557 extern(C) static void callBackActivate(GtkEntry* entryStruct, Entry _entry) 1558 { 1559 foreach ( void delegate(Entry) dlg; _entry.onActivateListeners ) 1560 { 1561 dlg(_entry); 1562 } 1563 } 1564 1565 void delegate(Entry)[] onBackspaceListeners; 1566 /** 1567 * The ::backspace signal is a 1568 * [keybinding signal][GtkBindingSignal] 1569 * which gets emitted when the user asks for it. 1570 * 1571 * The default bindings for this signal are 1572 * Backspace and Shift-Backspace. 1573 */ 1574 void addOnBackspace(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1575 { 1576 if ( "backspace" !in connectedSignals ) 1577 { 1578 Signals.connectData( 1579 this, 1580 "backspace", 1581 cast(GCallback)&callBackBackspace, 1582 cast(void*)this, 1583 null, 1584 connectFlags); 1585 connectedSignals["backspace"] = 1; 1586 } 1587 onBackspaceListeners ~= dlg; 1588 } 1589 extern(C) static void callBackBackspace(GtkEntry* entryStruct, Entry _entry) 1590 { 1591 foreach ( void delegate(Entry) dlg; _entry.onBackspaceListeners ) 1592 { 1593 dlg(_entry); 1594 } 1595 } 1596 1597 void delegate(Entry)[] onCopyClipboardListeners; 1598 /** 1599 * The ::copy-clipboard signal is a 1600 * [keybinding signal][GtkBindingSignal] 1601 * which gets emitted to copy the selection to the clipboard. 1602 * 1603 * The default bindings for this signal are 1604 * Ctrl-c and Ctrl-Insert. 1605 */ 1606 void addOnCopyClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1607 { 1608 if ( "copy-clipboard" !in connectedSignals ) 1609 { 1610 Signals.connectData( 1611 this, 1612 "copy-clipboard", 1613 cast(GCallback)&callBackCopyClipboard, 1614 cast(void*)this, 1615 null, 1616 connectFlags); 1617 connectedSignals["copy-clipboard"] = 1; 1618 } 1619 onCopyClipboardListeners ~= dlg; 1620 } 1621 extern(C) static void callBackCopyClipboard(GtkEntry* entryStruct, Entry _entry) 1622 { 1623 foreach ( void delegate(Entry) dlg; _entry.onCopyClipboardListeners ) 1624 { 1625 dlg(_entry); 1626 } 1627 } 1628 1629 void delegate(Entry)[] onCutClipboardListeners; 1630 /** 1631 * The ::cut-clipboard signal is a 1632 * [keybinding signal][GtkBindingSignal] 1633 * which gets emitted to cut the selection to the clipboard. 1634 * 1635 * The default bindings for this signal are 1636 * Ctrl-x and Shift-Delete. 1637 */ 1638 void addOnCutClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1639 { 1640 if ( "cut-clipboard" !in connectedSignals ) 1641 { 1642 Signals.connectData( 1643 this, 1644 "cut-clipboard", 1645 cast(GCallback)&callBackCutClipboard, 1646 cast(void*)this, 1647 null, 1648 connectFlags); 1649 connectedSignals["cut-clipboard"] = 1; 1650 } 1651 onCutClipboardListeners ~= dlg; 1652 } 1653 extern(C) static void callBackCutClipboard(GtkEntry* entryStruct, Entry _entry) 1654 { 1655 foreach ( void delegate(Entry) dlg; _entry.onCutClipboardListeners ) 1656 { 1657 dlg(_entry); 1658 } 1659 } 1660 1661 void delegate(GtkDeleteType, int, Entry)[] onDeleteFromCursorListeners; 1662 /** 1663 * The ::delete-from-cursor signal is a 1664 * [keybinding signal][GtkBindingSignal] 1665 * which gets emitted when the user initiates a text deletion. 1666 * 1667 * If the @type is %GTK_DELETE_CHARS, GTK+ deletes the selection 1668 * if there is one, otherwise it deletes the requested number 1669 * of characters. 1670 * 1671 * The default bindings for this signal are 1672 * Delete for deleting a character and Ctrl-Delete for 1673 * deleting a word. 1674 * 1675 * Params: 1676 * type = the granularity of the deletion, as a #GtkDeleteType 1677 * count = the number of @type units to delete 1678 */ 1679 void addOnDeleteFromCursor(void delegate(GtkDeleteType, int, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1680 { 1681 if ( "delete-from-cursor" !in connectedSignals ) 1682 { 1683 Signals.connectData( 1684 this, 1685 "delete-from-cursor", 1686 cast(GCallback)&callBackDeleteFromCursor, 1687 cast(void*)this, 1688 null, 1689 connectFlags); 1690 connectedSignals["delete-from-cursor"] = 1; 1691 } 1692 onDeleteFromCursorListeners ~= dlg; 1693 } 1694 extern(C) static void callBackDeleteFromCursor(GtkEntry* entryStruct, GtkDeleteType type, int count, Entry _entry) 1695 { 1696 foreach ( void delegate(GtkDeleteType, int, Entry) dlg; _entry.onDeleteFromCursorListeners ) 1697 { 1698 dlg(type, count, _entry); 1699 } 1700 } 1701 1702 void delegate(GtkEntryIconPosition, GdkEventButton*, Entry)[] onIconPressListeners; 1703 /** 1704 * The ::icon-press signal is emitted when an activatable icon 1705 * is clicked. 1706 * 1707 * Params: 1708 * iconPos = The position of the clicked icon 1709 * event = the button press event 1710 * 1711 * Since: 2.16 1712 */ 1713 void addOnIconPress(void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1714 { 1715 if ( "icon-press" !in connectedSignals ) 1716 { 1717 Signals.connectData( 1718 this, 1719 "icon-press", 1720 cast(GCallback)&callBackIconPress, 1721 cast(void*)this, 1722 null, 1723 connectFlags); 1724 connectedSignals["icon-press"] = 1; 1725 } 1726 onIconPressListeners ~= dlg; 1727 } 1728 extern(C) static void callBackIconPress(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEventButton* event, Entry _entry) 1729 { 1730 foreach ( void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg; _entry.onIconPressListeners ) 1731 { 1732 dlg(iconPos, event, _entry); 1733 } 1734 } 1735 1736 void delegate(GtkEntryIconPosition, Event, Entry)[] onIconPressGenericListeners; 1737 /** 1738 * The ::icon-press signal is emitted when an activatable icon 1739 * is clicked. 1740 * 1741 * Params: 1742 * iconPos = The position of the clicked icon 1743 * event = the button press event 1744 * 1745 * Since: 2.16 1746 */ 1747 void addOnIconPress(void delegate(GtkEntryIconPosition, Event, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1748 { 1749 if ( "icon-press-generic-event" !in connectedSignals ) 1750 { 1751 Signals.connectData( 1752 this, 1753 "icon-press", 1754 cast(GCallback)&callBackIconPressGeneric, 1755 cast(void*)this, 1756 null, 1757 connectFlags); 1758 connectedSignals["icon-press-generic-event"] = 1; 1759 } 1760 onIconPressGenericListeners ~= dlg; 1761 } 1762 extern(C) static void callBackIconPressGeneric(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEvent* event, Entry _entry) 1763 { 1764 foreach ( void delegate(GtkEntryIconPosition, Event, Entry) dlg; _entry.onIconPressGenericListeners ) 1765 { 1766 dlg(iconPos, ObjectG.getDObject!(Event)(event), _entry); 1767 } 1768 } 1769 1770 void delegate(GtkEntryIconPosition, GdkEventButton*, Entry)[] onIconReleaseListeners; 1771 /** 1772 * The ::icon-release signal is emitted on the button release from a 1773 * mouse click over an activatable icon. 1774 * 1775 * Params: 1776 * iconPos = The position of the clicked icon 1777 * event = the button release event 1778 * 1779 * Since: 2.16 1780 */ 1781 void addOnIconRelease(void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1782 { 1783 if ( "icon-release" !in connectedSignals ) 1784 { 1785 Signals.connectData( 1786 this, 1787 "icon-release", 1788 cast(GCallback)&callBackIconRelease, 1789 cast(void*)this, 1790 null, 1791 connectFlags); 1792 connectedSignals["icon-release"] = 1; 1793 } 1794 onIconReleaseListeners ~= dlg; 1795 } 1796 extern(C) static void callBackIconRelease(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEventButton* event, Entry _entry) 1797 { 1798 foreach ( void delegate(GtkEntryIconPosition, GdkEventButton*, Entry) dlg; _entry.onIconReleaseListeners ) 1799 { 1800 dlg(iconPos, event, _entry); 1801 } 1802 } 1803 1804 void delegate(GtkEntryIconPosition, Event, Entry)[] onIconReleaseGenericListeners; 1805 /** 1806 * The ::icon-release signal is emitted on the button release from a 1807 * mouse click over an activatable icon. 1808 * 1809 * Params: 1810 * iconPos = The position of the clicked icon 1811 * event = the button release event 1812 * 1813 * Since: 2.16 1814 */ 1815 void addOnIconRelease(void delegate(GtkEntryIconPosition, Event, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1816 { 1817 if ( "icon-release-generic-event" !in connectedSignals ) 1818 { 1819 Signals.connectData( 1820 this, 1821 "icon-release", 1822 cast(GCallback)&callBackIconReleaseGeneric, 1823 cast(void*)this, 1824 null, 1825 connectFlags); 1826 connectedSignals["icon-release-generic-event"] = 1; 1827 } 1828 onIconReleaseGenericListeners ~= dlg; 1829 } 1830 extern(C) static void callBackIconReleaseGeneric(GtkEntry* entryStruct, GtkEntryIconPosition iconPos, GdkEvent* event, Entry _entry) 1831 { 1832 foreach ( void delegate(GtkEntryIconPosition, Event, Entry) dlg; _entry.onIconReleaseGenericListeners ) 1833 { 1834 dlg(iconPos, ObjectG.getDObject!(Event)(event), _entry); 1835 } 1836 } 1837 1838 void delegate(string, Entry)[] onInsertAtCursorListeners; 1839 /** 1840 * The ::insert-at-cursor signal is a 1841 * [keybinding signal][GtkBindingSignal] 1842 * which gets emitted when the user initiates the insertion of a 1843 * fixed string at the cursor. 1844 * 1845 * This signal has no default bindings. 1846 * 1847 * Params: 1848 * str = the string to insert 1849 */ 1850 void addOnInsertAtCursor(void delegate(string, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1851 { 1852 if ( "insert-at-cursor" !in connectedSignals ) 1853 { 1854 Signals.connectData( 1855 this, 1856 "insert-at-cursor", 1857 cast(GCallback)&callBackInsertAtCursor, 1858 cast(void*)this, 1859 null, 1860 connectFlags); 1861 connectedSignals["insert-at-cursor"] = 1; 1862 } 1863 onInsertAtCursorListeners ~= dlg; 1864 } 1865 extern(C) static void callBackInsertAtCursor(GtkEntry* entryStruct, char* str, Entry _entry) 1866 { 1867 foreach ( void delegate(string, Entry) dlg; _entry.onInsertAtCursorListeners ) 1868 { 1869 dlg(Str.toString(str), _entry); 1870 } 1871 } 1872 1873 void delegate(GtkMovementStep, int, bool, Entry)[] onMoveCursorListeners; 1874 /** 1875 * The ::move-cursor signal is a 1876 * [keybinding signal][GtkBindingSignal] 1877 * which gets emitted when the user initiates a cursor movement. 1878 * If the cursor is not visible in @entry, this signal causes 1879 * the viewport to be moved instead. 1880 * 1881 * Applications should not connect to it, but may emit it with 1882 * g_signal_emit_by_name() if they need to control the cursor 1883 * programmatically. 1884 * 1885 * The default bindings for this signal come in two variants, 1886 * the variant with the Shift modifier extends the selection, 1887 * the variant without the Shift modifer does not. 1888 * There are too many key combinations to list them all here. 1889 * - Arrow keys move by individual characters/lines 1890 * - Ctrl-arrow key combinations move by words/paragraphs 1891 * - Home/End keys move to the ends of the buffer 1892 * 1893 * Params: 1894 * step = the granularity of the move, as a #GtkMovementStep 1895 * count = the number of @step units to move 1896 * extendSelection = %TRUE if the move should extend the selection 1897 */ 1898 void addOnMoveCursor(void delegate(GtkMovementStep, int, bool, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1899 { 1900 if ( "move-cursor" !in connectedSignals ) 1901 { 1902 Signals.connectData( 1903 this, 1904 "move-cursor", 1905 cast(GCallback)&callBackMoveCursor, 1906 cast(void*)this, 1907 null, 1908 connectFlags); 1909 connectedSignals["move-cursor"] = 1; 1910 } 1911 onMoveCursorListeners ~= dlg; 1912 } 1913 extern(C) static void callBackMoveCursor(GtkEntry* entryStruct, GtkMovementStep step, int count, bool extendSelection, Entry _entry) 1914 { 1915 foreach ( void delegate(GtkMovementStep, int, bool, Entry) dlg; _entry.onMoveCursorListeners ) 1916 { 1917 dlg(step, count, extendSelection, _entry); 1918 } 1919 } 1920 1921 void delegate(Entry)[] onPasteClipboardListeners; 1922 /** 1923 * The ::paste-clipboard signal is a 1924 * [keybinding signal][GtkBindingSignal] 1925 * which gets emitted to paste the contents of the clipboard 1926 * into the text view. 1927 * 1928 * The default bindings for this signal are 1929 * Ctrl-v and Shift-Insert. 1930 */ 1931 void addOnPasteClipboard(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1932 { 1933 if ( "paste-clipboard" !in connectedSignals ) 1934 { 1935 Signals.connectData( 1936 this, 1937 "paste-clipboard", 1938 cast(GCallback)&callBackPasteClipboard, 1939 cast(void*)this, 1940 null, 1941 connectFlags); 1942 connectedSignals["paste-clipboard"] = 1; 1943 } 1944 onPasteClipboardListeners ~= dlg; 1945 } 1946 extern(C) static void callBackPasteClipboard(GtkEntry* entryStruct, Entry _entry) 1947 { 1948 foreach ( void delegate(Entry) dlg; _entry.onPasteClipboardListeners ) 1949 { 1950 dlg(_entry); 1951 } 1952 } 1953 1954 void delegate(Widget, Entry)[] onPopulatePopupListeners; 1955 /** 1956 * The ::populate-popup signal gets emitted before showing the 1957 * context menu of the entry. 1958 * 1959 * If you need to add items to the context menu, connect 1960 * to this signal and append your items to the @widget, which 1961 * will be a #GtkMenu in this case. 1962 * 1963 * If #GtkEntry:populate-all is %TRUE, this signal will 1964 * also be emitted to populate touch popups. In this case, 1965 * @widget will be a different container, e.g. a #GtkToolbar. 1966 * The signal handler should not make assumptions about the 1967 * type of @widget. 1968 * 1969 * Params: 1970 * popup = the container that is being populated 1971 */ 1972 void addOnPopulatePopup(void delegate(Widget, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1973 { 1974 if ( "populate-popup" !in connectedSignals ) 1975 { 1976 Signals.connectData( 1977 this, 1978 "populate-popup", 1979 cast(GCallback)&callBackPopulatePopup, 1980 cast(void*)this, 1981 null, 1982 connectFlags); 1983 connectedSignals["populate-popup"] = 1; 1984 } 1985 onPopulatePopupListeners ~= dlg; 1986 } 1987 extern(C) static void callBackPopulatePopup(GtkEntry* entryStruct, GtkWidget* popup, Entry _entry) 1988 { 1989 foreach ( void delegate(Widget, Entry) dlg; _entry.onPopulatePopupListeners ) 1990 { 1991 dlg(ObjectG.getDObject!(Widget)(popup), _entry); 1992 } 1993 } 1994 1995 void delegate(string, Entry)[] onPreeditChangedListeners; 1996 /** 1997 * If an input method is used, the typed text will not immediately 1998 * be committed to the buffer. So if you are interested in the text, 1999 * connect to this signal. 2000 * 2001 * Params: 2002 * preedit = the current preedit string 2003 * 2004 * Since: 2.20 2005 */ 2006 void addOnPreeditChanged(void delegate(string, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2007 { 2008 if ( "preedit-changed" !in connectedSignals ) 2009 { 2010 Signals.connectData( 2011 this, 2012 "preedit-changed", 2013 cast(GCallback)&callBackPreeditChanged, 2014 cast(void*)this, 2015 null, 2016 connectFlags); 2017 connectedSignals["preedit-changed"] = 1; 2018 } 2019 onPreeditChangedListeners ~= dlg; 2020 } 2021 extern(C) static void callBackPreeditChanged(GtkEntry* entryStruct, char* preedit, Entry _entry) 2022 { 2023 foreach ( void delegate(string, Entry) dlg; _entry.onPreeditChangedListeners ) 2024 { 2025 dlg(Str.toString(preedit), _entry); 2026 } 2027 } 2028 2029 void delegate(Entry)[] onToggleOverwriteListeners; 2030 /** 2031 * The ::toggle-overwrite signal is a 2032 * [keybinding signal][GtkBindingSignal] 2033 * which gets emitted to toggle the overwrite mode of the entry. 2034 * 2035 * The default bindings for this signal is Insert. 2036 */ 2037 void addOnToggleOverwrite(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2038 { 2039 if ( "toggle-overwrite" !in connectedSignals ) 2040 { 2041 Signals.connectData( 2042 this, 2043 "toggle-overwrite", 2044 cast(GCallback)&callBackToggleOverwrite, 2045 cast(void*)this, 2046 null, 2047 connectFlags); 2048 connectedSignals["toggle-overwrite"] = 1; 2049 } 2050 onToggleOverwriteListeners ~= dlg; 2051 } 2052 extern(C) static void callBackToggleOverwrite(GtkEntry* entryStruct, Entry _entry) 2053 { 2054 foreach ( void delegate(Entry) dlg; _entry.onToggleOverwriteListeners ) 2055 { 2056 dlg(_entry); 2057 } 2058 } 2059 }