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