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.ContentProvider;
28 private import gdk.PaintableIF;
29 private import gio.IconIF;
30 private import gio.MenuModel;
31 private import glib.ConstructionException;
32 private import glib.Str;
33 private import glib.c.functions;
34 private import gobject.ObjectG;
35 private import gobject.Signals;
36 private import gtk.CellEditableIF;
37 private import gtk.CellEditableT;
38 private import gtk.EditableIF;
39 private import gtk.EditableT;
40 private import gtk.EntryBuffer;
41 private import gtk.EntryCompletion;
42 private import gtk.Widget;
43 private import gtk.c.functions;
44 public  import gtk.c.types;
45 private import pango.PgAttributeList;
46 private import pango.PgTabArray;
47 private import std.algorithm;
48 
49 
50 /**
51  * `GtkEntry` is a single line text entry widget.
52  * 
53  * ![An example GtkEntry](entry.png)
54  * 
55  * A fairly large set of key bindings are supported by default. If the
56  * entered text is longer than the allocation of the widget, the widget
57  * will scroll so that the cursor position is visible.
58  * 
59  * When using an entry for passwords and other sensitive information, it
60  * can be put into “password mode” using [method@Gtk.Entry.set_visibility].
61  * In this mode, entered text is displayed using a “invisible” character.
62  * By default, GTK picks the best invisible character that is available
63  * in the current font, but it can be changed with
64  * [method@Gtk.Entry.set_invisible_char].
65  * 
66  * `GtkEntry` has the ability to display progress or activity
67  * information behind the text. To make an entry display such information,
68  * use [method@Gtk.Entry.set_progress_fraction] or
69  * [method@Gtk.Entry.set_progress_pulse_step].
70  * 
71  * Additionally, `GtkEntry` can show icons at either side of the entry.
72  * These icons can be activatable by clicking, can be set up as drag source
73  * and can have tooltips. To add an icon, use
74  * [method@Gtk.Entry.set_icon_from_gicon] or one of the various other functions
75  * that set an icon from an icon name or a paintable. To trigger an action when
76  * the user clicks an icon, connect to the [signal@Gtk.Entry::icon-press] signal.
77  * To allow DND operations from an icon, use
78  * [method@Gtk.Entry.set_icon_drag_source]. To set a tooltip on an icon, use
79  * [method@Gtk.Entry.set_icon_tooltip_text] or the corresponding function
80  * for markup.
81  * 
82  * Note that functionality or information that is only available by clicking
83  * on an icon in an entry may not be accessible at all to users which are not
84  * able to use a mouse or other pointing device. It is therefore recommended
85  * that any such functionality should also be available by other means, e.g.
86  * via the context menu of the entry.
87  * 
88  * # CSS nodes
89  * 
90  * ```
91  * entry[.flat][.warning][.error]
92  * ├── text[.readonly]
93  * ├── image.left
94  * ├── image.right
95  * ╰── [progress[.pulse]]
96  * ```
97  * 
98  * `GtkEntry` has a main node with the name entry. Depending on the properties
99  * of the entry, the style classes .read-only and .flat may appear. The style
100  * classes .warning and .error may also be used with entries.
101  * 
102  * When the entry shows icons, it adds subnodes with the name image and the
103  * style class .left or .right, depending on where the icon appears.
104  * 
105  * When the entry shows progress, it adds a subnode with the name progress.
106  * The node has the style class .pulse when the shown progress is pulsing.
107  * 
108  * For all the subnodes added to the text node in various situations,
109  * see [class@Gtk.Text].
110  * 
111  * # GtkEntry as GtkBuildable
112  * 
113  * The `GtkEntry` implementation of the `GtkBuildable` interface supports a
114  * custom <attributes> element, which supports any number of <attribute>
115  * elements. The <attribute> element has attributes named “name“, “value“,
116  * “start“ and “end“ and allows you to specify #PangoAttribute values for
117  * this label.
118  * 
119  * An example of a UI definition fragment specifying Pango attributes:
120  * ```xml
121  * <object class="GtkEnry">
122  * <attributes>
123  * <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
124  * <attribute name="background" value="red" start="5" end="10"/>
125  * </attributes>
126  * </object>
127  * ```
128  * 
129  * The start and end attributes specify the range of characters to which the
130  * Pango attribute applies. If start and end are not specified, the attribute
131  * is applied to the whole text. Note that specifying ranges does not make much
132  * sense with translatable attributes. Use markup embedded in the translatable
133  * content instead.
134  * 
135  * # Accessibility
136  * 
137  * `GtkEntry` uses the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role.
138  */
139 public class Entry : Widget, CellEditableIF, EditableIF
140 {
141 	/** the main Gtk struct */
142 	protected GtkEntry* gtkEntry;
143 
144 	/** Get the main Gtk struct */
145 	public GtkEntry* getEntryStruct(bool transferOwnership = false)
146 	{
147 		if (transferOwnership)
148 			ownedRef = false;
149 		return gtkEntry;
150 	}
151 
152 	/** the main Gtk struct as a void* */
153 	protected override void* getStruct()
154 	{
155 		return cast(void*)gtkEntry;
156 	}
157 
158 	/**
159 	 * Sets our main struct and passes it to the parent class.
160 	 */
161 	public this (GtkEntry* gtkEntry, bool ownedRef = false)
162 	{
163 		this.gtkEntry = gtkEntry;
164 		super(cast(GtkWidget*)gtkEntry, ownedRef);
165 	}
166 
167 	// add the CellEditable capabilities
168 	mixin CellEditableT!(GtkEntry);
169 
170 	// add the Editable capabilities
171 	mixin EditableT!(GtkEntry);
172 
173 
174 	/** */
175 	public static GType getType()
176 	{
177 		return gtk_entry_get_type();
178 	}
179 
180 	/**
181 	 * Creates a new entry.
182 	 *
183 	 * Returns: a new `GtkEntry`.
184 	 *
185 	 * Throws: ConstructionException GTK+ fails to create the object.
186 	 */
187 	public this()
188 	{
189 		auto __p = gtk_entry_new();
190 
191 		if(__p is null)
192 		{
193 			throw new ConstructionException("null returned by new");
194 		}
195 
196 		this(cast(GtkEntry*) __p);
197 	}
198 
199 	/**
200 	 * Creates a new entry with the specified text buffer.
201 	 *
202 	 * Params:
203 	 *     buffer = The buffer to use for the new `GtkEntry`.
204 	 *
205 	 * Returns: a new `GtkEntry`
206 	 *
207 	 * Throws: ConstructionException GTK+ fails to create the object.
208 	 */
209 	public this(EntryBuffer buffer)
210 	{
211 		auto __p = gtk_entry_new_with_buffer((buffer is null) ? null : buffer.getEntryBufferStruct());
212 
213 		if(__p is null)
214 		{
215 			throw new ConstructionException("null returned by new_with_buffer");
216 		}
217 
218 		this(cast(GtkEntry*) __p);
219 	}
220 
221 	/**
222 	 * Retrieves the value set by gtk_entry_set_activates_default().
223 	 *
224 	 * Returns: %TRUE if the entry will activate the default widget
225 	 */
226 	public bool getActivatesDefault()
227 	{
228 		return gtk_entry_get_activates_default(gtkEntry) != 0;
229 	}
230 
231 	/**
232 	 * Gets the value set by gtk_entry_set_alignment().
233 	 *
234 	 * See also: [property@Gtk.Editable:xalign]
235 	 *
236 	 * Returns: the alignment
237 	 */
238 	public float getAlignment()
239 	{
240 		return gtk_entry_get_alignment(gtkEntry);
241 	}
242 
243 	/**
244 	 * Gets the attribute list of the `GtkEntry`.
245 	 *
246 	 * See [method@Gtk.Entry.set_attributes].
247 	 *
248 	 * Returns: the attribute list,
249 	 *     or %NULL if none was set.
250 	 */
251 	public PgAttributeList getAttributes()
252 	{
253 		auto __p = gtk_entry_get_attributes(gtkEntry);
254 
255 		if(__p is null)
256 		{
257 			return null;
258 		}
259 
260 		return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) __p);
261 	}
262 
263 	/**
264 	 * Get the `GtkEntryBuffer` object which holds the text for
265 	 * this widget.
266 	 *
267 	 * Returns: A `GtkEntryBuffer` object.
268 	 */
269 	public EntryBuffer getBuffer()
270 	{
271 		auto __p = gtk_entry_get_buffer(gtkEntry);
272 
273 		if(__p is null)
274 		{
275 			return null;
276 		}
277 
278 		return ObjectG.getDObject!(EntryBuffer)(cast(GtkEntryBuffer*) __p);
279 	}
280 
281 	/**
282 	 * Returns the auxiliary completion object currently
283 	 * in use by @entry.
284 	 *
285 	 * Returns: The auxiliary
286 	 *     completion object currently in use by @entry
287 	 */
288 	public EntryCompletion getCompletion()
289 	{
290 		auto __p = gtk_entry_get_completion(gtkEntry);
291 
292 		if(__p is null)
293 		{
294 			return null;
295 		}
296 
297 		return ObjectG.getDObject!(EntryCompletion)(cast(GtkEntryCompletion*) __p);
298 	}
299 
300 	/**
301 	 * Returns the index of the icon which is the source of the
302 	 * current  DND operation, or -1.
303 	 *
304 	 * Returns: index of the icon which is the source of the
305 	 *     current DND operation, or -1.
306 	 */
307 	public int getCurrentIconDragSource()
308 	{
309 		return gtk_entry_get_current_icon_drag_source(gtkEntry);
310 	}
311 
312 	/**
313 	 * Gets the menu model set with gtk_entry_set_extra_menu().
314 	 *
315 	 * Returns: the menu model
316 	 */
317 	public MenuModel getExtraMenu()
318 	{
319 		auto __p = gtk_entry_get_extra_menu(gtkEntry);
320 
321 		if(__p is null)
322 		{
323 			return null;
324 		}
325 
326 		return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) __p);
327 	}
328 
329 	/**
330 	 * Gets the value set by gtk_entry_set_has_frame().
331 	 *
332 	 * Returns: whether the entry has a beveled frame
333 	 */
334 	public bool getHasFrame()
335 	{
336 		return gtk_entry_get_has_frame(gtkEntry) != 0;
337 	}
338 
339 	/**
340 	 * Returns whether the icon is activatable.
341 	 *
342 	 * Params:
343 	 *     iconPos = Icon position
344 	 *
345 	 * Returns: %TRUE if the icon is activatable.
346 	 */
347 	public bool getIconActivatable(GtkEntryIconPosition iconPos)
348 	{
349 		return gtk_entry_get_icon_activatable(gtkEntry, iconPos) != 0;
350 	}
351 
352 	/**
353 	 * Gets the area where entry’s icon at @icon_pos is drawn.
354 	 *
355 	 * This function is useful when drawing something to the
356 	 * entry in a draw callback.
357 	 *
358 	 * If the entry is not realized or has no icon at the given
359 	 * position, @icon_area is filled with zeros. Otherwise,
360 	 * @icon_area will be filled with the icon's allocation,
361 	 * relative to @entry's allocation.
362 	 *
363 	 * Params:
364 	 *     iconPos = Icon position
365 	 *     iconArea = Return location for the icon’s area
366 	 */
367 	public void getIconArea(GtkEntryIconPosition iconPos, out GdkRectangle iconArea)
368 	{
369 		gtk_entry_get_icon_area(gtkEntry, iconPos, &iconArea);
370 	}
371 
372 	/**
373 	 * Finds the icon at the given position and return its index.
374 	 *
375 	 * The position’s coordinates are relative to the @entry’s
376 	 * top left corner. If @x, @y doesn’t lie inside an icon,
377 	 * -1 is returned. This function is intended for use in a
378 	 * [signal@Gtk.Widget::query-tooltip] signal handler.
379 	 *
380 	 * Params:
381 	 *     x = the x coordinate of the position to find, relative to @entry
382 	 *     y = the y coordinate of the position to find, relative to @entry
383 	 *
384 	 * Returns: the index of the icon at the given position, or -1
385 	 */
386 	public int getIconAtPos(int x, int y)
387 	{
388 		return gtk_entry_get_icon_at_pos(gtkEntry, x, y);
389 	}
390 
391 	/**
392 	 * Retrieves the `GIcon` used for the icon.
393 	 *
394 	 * %NULL will be returned if there is no icon or if the icon was
395 	 * set by some other method (e.g., by `GdkPaintable` or icon name).
396 	 *
397 	 * Params:
398 	 *     iconPos = Icon position
399 	 *
400 	 * Returns: A `GIcon`, or %NULL if no
401 	 *     icon is set or if the icon is not a `GIcon`
402 	 */
403 	public IconIF getIconGicon(GtkEntryIconPosition iconPos)
404 	{
405 		auto __p = gtk_entry_get_icon_gicon(gtkEntry, iconPos);
406 
407 		if(__p is null)
408 		{
409 			return null;
410 		}
411 
412 		return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p);
413 	}
414 
415 	/**
416 	 * Retrieves the icon name used for the icon.
417 	 *
418 	 * %NULL is returned if there is no icon or if the icon was set
419 	 * by some other method (e.g., by `GdkPaintable` or gicon).
420 	 *
421 	 * Params:
422 	 *     iconPos = Icon position
423 	 *
424 	 * Returns: An icon name, or %NULL if no icon is set
425 	 *     or if the icon wasn’t set from an icon name
426 	 */
427 	public string getIconName(GtkEntryIconPosition iconPos)
428 	{
429 		return Str.toString(gtk_entry_get_icon_name(gtkEntry, iconPos));
430 	}
431 
432 	/**
433 	 * Retrieves the `GdkPaintable` used for the icon.
434 	 *
435 	 * If no `GdkPaintable` was used for the icon, %NULL is returned.
436 	 *
437 	 * Params:
438 	 *     iconPos = Icon position
439 	 *
440 	 * Returns: A `GdkPaintable`, or %NULL
441 	 *     if no icon is set for this position or the icon set is not
442 	 *     a `GdkPaintable`.
443 	 */
444 	public PaintableIF getIconPaintable(GtkEntryIconPosition iconPos)
445 	{
446 		auto __p = gtk_entry_get_icon_paintable(gtkEntry, iconPos);
447 
448 		if(__p is null)
449 		{
450 			return null;
451 		}
452 
453 		return ObjectG.getDObject!(PaintableIF)(cast(GdkPaintable*) __p);
454 	}
455 
456 	/**
457 	 * Returns whether the icon appears sensitive or insensitive.
458 	 *
459 	 * Params:
460 	 *     iconPos = Icon position
461 	 *
462 	 * Returns: %TRUE if the icon is sensitive.
463 	 */
464 	public bool getIconSensitive(GtkEntryIconPosition iconPos)
465 	{
466 		return gtk_entry_get_icon_sensitive(gtkEntry, iconPos) != 0;
467 	}
468 
469 	/**
470 	 * Gets the type of representation being used by the icon
471 	 * to store image data.
472 	 *
473 	 * If the icon has no image data, the return value will
474 	 * be %GTK_IMAGE_EMPTY.
475 	 *
476 	 * Params:
477 	 *     iconPos = Icon position
478 	 *
479 	 * Returns: image representation being used
480 	 */
481 	public GtkImageType getIconStorageType(GtkEntryIconPosition iconPos)
482 	{
483 		return gtk_entry_get_icon_storage_type(gtkEntry, iconPos);
484 	}
485 
486 	/**
487 	 * Gets the contents of the tooltip on the icon at the specified
488 	 * position in @entry.
489 	 *
490 	 * Params:
491 	 *     iconPos = the icon position
492 	 *
493 	 * Returns: the tooltip text, or %NULL. Free the
494 	 *     returned string with g_free() when done.
495 	 */
496 	public string getIconTooltipMarkup(GtkEntryIconPosition iconPos)
497 	{
498 		auto retStr = gtk_entry_get_icon_tooltip_markup(gtkEntry, iconPos);
499 
500 		scope(exit) Str.freeString(retStr);
501 		return Str.toString(retStr);
502 	}
503 
504 	/**
505 	 * Gets the contents of the tooltip on the icon at the specified
506 	 * position in @entry.
507 	 *
508 	 * Params:
509 	 *     iconPos = the icon position
510 	 *
511 	 * Returns: the tooltip text, or %NULL. Free the returned
512 	 *     string with g_free() when done.
513 	 */
514 	public string getIconTooltipText(GtkEntryIconPosition iconPos)
515 	{
516 		auto retStr = gtk_entry_get_icon_tooltip_text(gtkEntry, iconPos);
517 
518 		scope(exit) Str.freeString(retStr);
519 		return Str.toString(retStr);
520 	}
521 
522 	/**
523 	 * Gets the input hints of this `GtkEntry`.
524 	 *
525 	 * Returns: the input hints
526 	 */
527 	public GtkInputHints getInputHints()
528 	{
529 		return gtk_entry_get_input_hints(gtkEntry);
530 	}
531 
532 	/**
533 	 * Gets the input purpose of the `GtkEntry`.
534 	 *
535 	 * Returns: the input purpose
536 	 */
537 	public GtkInputPurpose getInputPurpose()
538 	{
539 		return gtk_entry_get_input_purpose(gtkEntry);
540 	}
541 
542 	/**
543 	 * Retrieves the character displayed in place of the actual text
544 	 * in “password mode”.
545 	 *
546 	 * Returns: the current invisible char, or 0, if the entry does not
547 	 *     show invisible text at all.
548 	 */
549 	public dchar getInvisibleChar()
550 	{
551 		return gtk_entry_get_invisible_char(gtkEntry);
552 	}
553 
554 	/**
555 	 * Retrieves the maximum allowed length of the text in @entry.
556 	 *
557 	 * See [method@Gtk.Entry.set_max_length].
558 	 *
559 	 * Returns: the maximum allowed number of characters
560 	 *     in `GtkEntry`, or 0 if there is no maximum.
561 	 */
562 	public int getMaxLength()
563 	{
564 		return gtk_entry_get_max_length(gtkEntry);
565 	}
566 
567 	/**
568 	 * Gets whether the `GtkEntry` is in overwrite mode.
569 	 *
570 	 * Returns: whether the text is overwritten when typing.
571 	 */
572 	public bool getOverwriteMode()
573 	{
574 		return gtk_entry_get_overwrite_mode(gtkEntry) != 0;
575 	}
576 
577 	/**
578 	 * Retrieves the text that will be displayed when @entry
579 	 * is empty and unfocused
580 	 *
581 	 * Returns: a pointer to the
582 	 *     placeholder text as a string. This string points to
583 	 *     internally allocated storage in the widget and must
584 	 *     not be freed, modified or stored. If no placeholder
585 	 *     text has been set, %NULL will be returned.
586 	 */
587 	public string getPlaceholderText()
588 	{
589 		return Str.toString(gtk_entry_get_placeholder_text(gtkEntry));
590 	}
591 
592 	/**
593 	 * Returns the current fraction of the task that’s been completed.
594 	 *
595 	 * See [method@Gtk.Entry.set_progress_fraction].
596 	 *
597 	 * Returns: a fraction from 0.0 to 1.0
598 	 */
599 	public double getProgressFraction()
600 	{
601 		return gtk_entry_get_progress_fraction(gtkEntry);
602 	}
603 
604 	/**
605 	 * Retrieves the pulse step set with
606 	 * gtk_entry_set_progress_pulse_step().
607 	 *
608 	 * Returns: a fraction from 0.0 to 1.0
609 	 */
610 	public double getProgressPulseStep()
611 	{
612 		return gtk_entry_get_progress_pulse_step(gtkEntry);
613 	}
614 
615 	/**
616 	 * Gets the tabstops of the `GtkEntry.
617 	 *
618 	 * See [method@Gtk.Entry.set_tabs].
619 	 *
620 	 * Returns: the tabstops,
621 	 *     or %NULL if none was set.
622 	 */
623 	public PgTabArray getTabs()
624 	{
625 		auto __p = gtk_entry_get_tabs(gtkEntry);
626 
627 		if(__p is null)
628 		{
629 			return null;
630 		}
631 
632 		return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) __p);
633 	}
634 
635 	/**
636 	 * Retrieves the current length of the text in @entry.
637 	 *
638 	 * This is equivalent to getting @entry's `GtkEntryBuffer`
639 	 * and calling [method@Gtk.EntryBuffer.get_length] on it.
640 	 *
641 	 * Returns: the current number of characters
642 	 *     in `GtkEntry`, or 0 if there are none.
643 	 */
644 	public ushort getTextLength()
645 	{
646 		return gtk_entry_get_text_length(gtkEntry);
647 	}
648 
649 	/**
650 	 * Retrieves whether the text in @entry is visible.
651 	 *
652 	 * See [method@Gtk.Entry.set_visibility].
653 	 *
654 	 * Returns: %TRUE if the text is currently visible
655 	 */
656 	public bool getVisibility()
657 	{
658 		return gtk_entry_get_visibility(gtkEntry) != 0;
659 	}
660 
661 	/**
662 	 * Causes @entry to have keyboard focus.
663 	 *
664 	 * It behaves like [method@Gtk.Widget.grab_focus], except that it doesn't
665 	 * select the contents of the entry. You only want to call this on some
666 	 * special entries which the user usually doesn't want to replace all text
667 	 * in, such as search-as-you-type entries.
668 	 *
669 	 * Returns: %TRUE if focus is now inside @self
670 	 */
671 	public bool grabFocusWithoutSelecting()
672 	{
673 		return gtk_entry_grab_focus_without_selecting(gtkEntry) != 0;
674 	}
675 
676 	/**
677 	 * Indicates that some progress is made, but you don’t
678 	 * know how much.
679 	 *
680 	 * Causes the entry’s progress indicator to enter “activity
681 	 * mode”, where a block bounces back and forth. Each call to
682 	 * gtk_entry_progress_pulse() causes the block to move by a
683 	 * little bit (the amount of movement per pulse is determined
684 	 * by [method@Gtk.Entry.set_progress_pulse_step]).
685 	 */
686 	public void progressPulse()
687 	{
688 		gtk_entry_progress_pulse(gtkEntry);
689 	}
690 
691 	/**
692 	 * Reset the input method context of the entry if needed.
693 	 *
694 	 * This can be necessary in the case where modifying the buffer
695 	 * would confuse on-going input method behavior.
696 	 */
697 	public void resetImContext()
698 	{
699 		gtk_entry_reset_im_context(gtkEntry);
700 	}
701 
702 	/**
703 	 * Sets whether pressing Enter in the @entry will activate the default
704 	 * widget for the window containing the entry.
705 	 *
706 	 * This usually means that the dialog containing the entry will be closed,
707 	 * since the default widget is usually one of the dialog buttons.
708 	 *
709 	 * Params:
710 	 *     setting = %TRUE to activate window’s default widget on Enter keypress
711 	 */
712 	public void setActivatesDefault(bool setting)
713 	{
714 		gtk_entry_set_activates_default(gtkEntry, setting);
715 	}
716 
717 	/**
718 	 * Sets the alignment for the contents of the entry.
719 	 *
720 	 * This controls the horizontal positioning of the contents when
721 	 * the displayed text is shorter than the width of the entry.
722 	 *
723 	 * See also: [property@Gtk.Editable:xalign]
724 	 *
725 	 * Params:
726 	 *     xalign = The horizontal alignment, from 0 (left) to 1 (right).
727 	 *         Reversed for RTL layouts
728 	 */
729 	public void setAlignment(float xalign)
730 	{
731 		gtk_entry_set_alignment(gtkEntry, xalign);
732 	}
733 
734 	/**
735 	 * Sets a `PangoAttrList`.
736 	 *
737 	 * The attributes in the list are applied to the entry text.
738 	 *
739 	 * Since the attributes will be applies to text that changes
740 	 * as the user types, it makes most sense to use attributes
741 	 * with unlimited extent.
742 	 *
743 	 * Params:
744 	 *     attrs = a `PangoAttrList`
745 	 */
746 	public void setAttributes(PgAttributeList attrs)
747 	{
748 		gtk_entry_set_attributes(gtkEntry, (attrs is null) ? null : attrs.getPgAttributeListStruct());
749 	}
750 
751 	/**
752 	 * Set the `GtkEntryBuffer` object which holds the text for
753 	 * this widget.
754 	 *
755 	 * Params:
756 	 *     buffer = a `GtkEntryBuffer`
757 	 */
758 	public void setBuffer(EntryBuffer buffer)
759 	{
760 		gtk_entry_set_buffer(gtkEntry, (buffer is null) ? null : buffer.getEntryBufferStruct());
761 	}
762 
763 	/**
764 	 * Sets @completion to be the auxiliary completion object
765 	 * to use with @entry.
766 	 *
767 	 * All further configuration of the completion mechanism is
768 	 * done on @completion using the `GtkEntryCompletion` API.
769 	 * Completion is disabled if @completion is set to %NULL.
770 	 *
771 	 * Params:
772 	 *     completion = The `GtkEntryCompletion` or %NULL
773 	 */
774 	public void setCompletion(EntryCompletion completion)
775 	{
776 		gtk_entry_set_completion(gtkEntry, (completion is null) ? null : completion.getEntryCompletionStruct());
777 	}
778 
779 	/**
780 	 * Sets a menu model to add when constructing
781 	 * the context menu for @entry.
782 	 *
783 	 * Params:
784 	 *     model = a `GMenuModel`
785 	 */
786 	public void setExtraMenu(MenuModel model)
787 	{
788 		gtk_entry_set_extra_menu(gtkEntry, (model is null) ? null : model.getMenuModelStruct());
789 	}
790 
791 	/**
792 	 * Sets whether the entry has a beveled frame around it.
793 	 *
794 	 * Params:
795 	 *     setting = new value
796 	 */
797 	public void setHasFrame(bool setting)
798 	{
799 		gtk_entry_set_has_frame(gtkEntry, setting);
800 	}
801 
802 	/**
803 	 * Sets whether the icon is activatable.
804 	 *
805 	 * Params:
806 	 *     iconPos = Icon position
807 	 *     activatable = %TRUE if the icon should be activatable
808 	 */
809 	public void setIconActivatable(GtkEntryIconPosition iconPos, bool activatable)
810 	{
811 		gtk_entry_set_icon_activatable(gtkEntry, iconPos, activatable);
812 	}
813 
814 	/**
815 	 * Sets up the icon at the given position as drag source.
816 	 *
817 	 * This makes it so that GTK will start a drag
818 	 * operation when the user clicks and drags the icon.
819 	 *
820 	 * Params:
821 	 *     iconPos = icon position
822 	 *     provider = a #GdkContentProvider
823 	 *     actions = a bitmask of the allowed drag actions
824 	 */
825 	public void setIconDragSource(GtkEntryIconPosition iconPos, ContentProvider provider, GdkDragAction actions)
826 	{
827 		gtk_entry_set_icon_drag_source(gtkEntry, iconPos, (provider is null) ? null : provider.getContentProviderStruct(), actions);
828 	}
829 
830 	/**
831 	 * Sets the icon shown in the entry at the specified position
832 	 * from the current icon theme.
833 	 *
834 	 * If the icon isn’t known, a “broken image” icon will be
835 	 * displayed instead.
836 	 *
837 	 * If @icon is %NULL, no icon will be shown in the
838 	 * specified position.
839 	 *
840 	 * Params:
841 	 *     iconPos = The position at which to set the icon
842 	 *     icon = The icon to set, or %NULL
843 	 */
844 	public void setIconFromGicon(GtkEntryIconPosition iconPos, IconIF icon)
845 	{
846 		gtk_entry_set_icon_from_gicon(gtkEntry, iconPos, (icon is null) ? null : icon.getIconStruct());
847 	}
848 
849 	/**
850 	 * Sets the icon shown in the entry at the specified position
851 	 * from the current icon theme.
852 	 *
853 	 * If the icon name isn’t known, a “broken image” icon will be
854 	 * displayed instead.
855 	 *
856 	 * If @icon_name is %NULL, no icon will be shown in the
857 	 * specified position.
858 	 *
859 	 * Params:
860 	 *     iconPos = The position at which to set the icon
861 	 *     iconName = An icon name, or %NULL
862 	 */
863 	public void setIconFromIconName(GtkEntryIconPosition iconPos, string iconName)
864 	{
865 		gtk_entry_set_icon_from_icon_name(gtkEntry, iconPos, Str.toStringz(iconName));
866 	}
867 
868 	/**
869 	 * Sets the icon shown in the specified position using a `GdkPaintable`.
870 	 *
871 	 * If @paintable is %NULL, no icon will be shown in the specified position.
872 	 *
873 	 * Params:
874 	 *     iconPos = Icon position
875 	 *     paintable = A `GdkPaintable`, or %NULL
876 	 */
877 	public void setIconFromPaintable(GtkEntryIconPosition iconPos, PaintableIF paintable)
878 	{
879 		gtk_entry_set_icon_from_paintable(gtkEntry, iconPos, (paintable is null) ? null : paintable.getPaintableStruct());
880 	}
881 
882 	/**
883 	 * Sets the sensitivity for the specified icon.
884 	 *
885 	 * Params:
886 	 *     iconPos = Icon position
887 	 *     sensitive = Specifies whether the icon should appear
888 	 *         sensitive or insensitive
889 	 */
890 	public void setIconSensitive(GtkEntryIconPosition iconPos, bool sensitive)
891 	{
892 		gtk_entry_set_icon_sensitive(gtkEntry, iconPos, sensitive);
893 	}
894 
895 	/**
896 	 * Sets @tooltip as the contents of the tooltip for the icon at
897 	 * the specified position.
898 	 *
899 	 * @tooltip is assumed to be marked up with Pango Markup.
900 	 *
901 	 * Use %NULL for @tooltip to remove an existing tooltip.
902 	 *
903 	 * See also [method@Gtk.Widget.set_tooltip_markup] and
904 	 * [method@Gtk.Entry.set_icon_tooltip_text].
905 	 *
906 	 * Params:
907 	 *     iconPos = the icon position
908 	 *     tooltip = the contents of the tooltip for the
909 	 *         icon, or %NULL
910 	 */
911 	public void setIconTooltipMarkup(GtkEntryIconPosition iconPos, string tooltip)
912 	{
913 		gtk_entry_set_icon_tooltip_markup(gtkEntry, iconPos, Str.toStringz(tooltip));
914 	}
915 
916 	/**
917 	 * Sets @tooltip as the contents of the tooltip for the icon
918 	 * at the specified position.
919 	 *
920 	 * Use %NULL for @tooltip to remove an existing tooltip.
921 	 *
922 	 * See also [method@Gtk.Widget.set_tooltip_text] and
923 	 * [method@Gtk.Entry.set_icon_tooltip_markup].
924 	 *
925 	 * If you unset the widget tooltip via
926 	 * [method@Gtk.Widget.set_tooltip_text] or
927 	 * [method@Gtk.Widget.set_tooltip_markup], this sets
928 	 * [property@Gtk.Widget:has-tooltip] to %FALSE, which suppresses
929 	 * icon tooltips too. You can resolve this by then calling
930 	 * [method@Gtk.Widget.set_has_tooltip] to set
931 	 * [property@Gtk.Widget:has-tooltip] back to %TRUE, or
932 	 * setting at least one non-empty tooltip on any icon
933 	 * achieves the same result.
934 	 *
935 	 * Params:
936 	 *     iconPos = the icon position
937 	 *     tooltip = the contents of the tooltip for the
938 	 *         icon, or %NULL
939 	 */
940 	public void setIconTooltipText(GtkEntryIconPosition iconPos, string tooltip)
941 	{
942 		gtk_entry_set_icon_tooltip_text(gtkEntry, iconPos, Str.toStringz(tooltip));
943 	}
944 
945 	/**
946 	 * Set additional hints which allow input methods to
947 	 * fine-tune their behavior.
948 	 *
949 	 * Params:
950 	 *     hints = the hints
951 	 */
952 	public void setInputHints(GtkInputHints hints)
953 	{
954 		gtk_entry_set_input_hints(gtkEntry, hints);
955 	}
956 
957 	/**
958 	 * Sets the input purpose which can be used by input methods
959 	 * to adjust their behavior.
960 	 *
961 	 * Params:
962 	 *     purpose = the purpose
963 	 */
964 	public void setInputPurpose(GtkInputPurpose purpose)
965 	{
966 		gtk_entry_set_input_purpose(gtkEntry, purpose);
967 	}
968 
969 	/**
970 	 * Sets the character to use in place of the actual text
971 	 * in “password mode”.
972 	 *
973 	 * See [method@Gtk.Entry.set_visibility] for how to enable
974 	 * “password mode”.
975 	 *
976 	 * By default, GTK picks the best invisible char available in
977 	 * the current font. If you set the invisible char to 0, then
978 	 * the user will get no feedback at all; there will be no text
979 	 * on the screen as they type.
980 	 *
981 	 * Params:
982 	 *     ch = a Unicode character
983 	 */
984 	public void setInvisibleChar(dchar ch)
985 	{
986 		gtk_entry_set_invisible_char(gtkEntry, ch);
987 	}
988 
989 	/**
990 	 * Sets the maximum allowed length of the contents of the widget.
991 	 *
992 	 * If the current contents are longer than the given length, then
993 	 * they will be truncated to fit.
994 	 *
995 	 * This is equivalent to getting @entry's `GtkEntryBuffer` and
996 	 * calling [method@Gtk.EntryBuffer.set_max_length] on it.
997 	 *
998 	 * Params:
999 	 *     max = the maximum length of the entry, or 0 for no maximum.
1000 	 *         (other than the maximum length of entries.) The value passed in will
1001 	 *         be clamped to the range 0-65536.
1002 	 */
1003 	public void setMaxLength(int max)
1004 	{
1005 		gtk_entry_set_max_length(gtkEntry, max);
1006 	}
1007 
1008 	/**
1009 	 * Sets whether the text is overwritten when typing in the `GtkEntry`.
1010 	 *
1011 	 * Params:
1012 	 *     overwrite = new value
1013 	 */
1014 	public void setOverwriteMode(bool overwrite)
1015 	{
1016 		gtk_entry_set_overwrite_mode(gtkEntry, overwrite);
1017 	}
1018 
1019 	/**
1020 	 * Sets text to be displayed in @entry when it is empty.
1021 	 *
1022 	 * This can be used to give a visual hint of the expected
1023 	 * contents of the `GtkEntry`.
1024 	 *
1025 	 * Params:
1026 	 *     text = a string to be displayed when @entry is
1027 	 *         empty and unfocused, or %NULL
1028 	 */
1029 	public void setPlaceholderText(string text)
1030 	{
1031 		gtk_entry_set_placeholder_text(gtkEntry, Str.toStringz(text));
1032 	}
1033 
1034 	/**
1035 	 * Causes the entry’s progress indicator to “fill in” the given
1036 	 * fraction of the bar.
1037 	 *
1038 	 * The fraction should be between 0.0 and 1.0, inclusive.
1039 	 *
1040 	 * Params:
1041 	 *     fraction = fraction of the task that’s been completed
1042 	 */
1043 	public void setProgressFraction(double fraction)
1044 	{
1045 		gtk_entry_set_progress_fraction(gtkEntry, fraction);
1046 	}
1047 
1048 	/**
1049 	 * Sets the fraction of total entry width to move the progress
1050 	 * bouncing block for each pulse.
1051 	 *
1052 	 * Use [method@Gtk.Entry.progress_pulse] to pulse
1053 	 * the progress.
1054 	 *
1055 	 * Params:
1056 	 *     fraction = fraction between 0.0 and 1.0
1057 	 */
1058 	public void setProgressPulseStep(double fraction)
1059 	{
1060 		gtk_entry_set_progress_pulse_step(gtkEntry, fraction);
1061 	}
1062 
1063 	/**
1064 	 * Sets a `PangoTabArray`.
1065 	 *
1066 	 * The tabstops in the array are applied to the entry text.
1067 	 *
1068 	 * Params:
1069 	 *     tabs = a `PangoTabArray`
1070 	 */
1071 	public void setTabs(PgTabArray tabs)
1072 	{
1073 		gtk_entry_set_tabs(gtkEntry, (tabs is null) ? null : tabs.getPgTabArrayStruct());
1074 	}
1075 
1076 	/**
1077 	 * Sets whether the contents of the entry are visible or not.
1078 	 *
1079 	 * When visibility is set to %FALSE, characters are displayed
1080 	 * as the invisible char, and will also appear that way when
1081 	 * the text in the entry widget is copied elsewhere.
1082 	 *
1083 	 * By default, GTK picks the best invisible character available
1084 	 * in the current font, but it can be changed with
1085 	 * [method@Gtk.Entry.set_invisible_char].
1086 	 *
1087 	 * Note that you probably want to set [property@Gtk.Entry:input-purpose]
1088 	 * to %GTK_INPUT_PURPOSE_PASSWORD or %GTK_INPUT_PURPOSE_PIN to
1089 	 * inform input methods about the purpose of this entry,
1090 	 * in addition to setting visibility to %FALSE.
1091 	 *
1092 	 * Params:
1093 	 *     visible = %TRUE if the contents of the entry are displayed
1094 	 *         as plaintext
1095 	 */
1096 	public void setVisibility(bool visible)
1097 	{
1098 		gtk_entry_set_visibility(gtkEntry, visible);
1099 	}
1100 
1101 	/**
1102 	 * Unsets the invisible char, so that the default invisible char
1103 	 * is used again. See [method@Gtk.Entry.set_invisible_char].
1104 	 */
1105 	public void unsetInvisibleChar()
1106 	{
1107 		gtk_entry_unset_invisible_char(gtkEntry);
1108 	}
1109 
1110 	/**
1111 	 * Emitted when the entry is activated.
1112 	 *
1113 	 * The keybindings for this signal are all forms of the Enter key.
1114 	 */
1115 	gulong addOnActivate(void delegate(Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1116 	{
1117 		return Signals.connect(this, "activate", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1118 	}
1119 
1120 	/**
1121 	 * Emitted when an activatable icon is clicked.
1122 	 *
1123 	 * Params:
1124 	 *     iconPos = The position of the clicked icon
1125 	 */
1126 	gulong addOnIconPress(void delegate(GtkEntryIconPosition, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1127 	{
1128 		return Signals.connect(this, "icon-press", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1129 	}
1130 
1131 	/**
1132 	 * Emitted on the button release from a mouse click
1133 	 * over an activatable icon.
1134 	 *
1135 	 * Params:
1136 	 *     iconPos = The position of the clicked icon
1137 	 */
1138 	gulong addOnIconRelease(void delegate(GtkEntryIconPosition, Entry) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1139 	{
1140 		return Signals.connect(this, "icon-release", dlg, connectFlags ^ ConnectFlags.SWAPPED);
1141 	}
1142 }