gtk4/auto/entry.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6use crate::{
7 ffi, Accessible, AccessibleRole, Align, Buildable, CellEditable, ConstraintTarget, Editable,
8 EntryBuffer, EntryCompletion, EntryIconPosition, ImageType, InputHints, InputPurpose,
9 LayoutManager, Overflow, Widget,
10};
11use glib::{
12 object::ObjectType as _,
13 prelude::*,
14 signal::{connect_raw, SignalHandlerId},
15 translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20 /// A single-line text entry widget.
21 ///
22 /// <picture>
23 /// <source srcset="entry-dark.png" media="(prefers-color-scheme: dark)">
24 /// <img alt="An example GtkEntry" src="entry.png">
25 /// </picture>
26 ///
27 /// A fairly large set of key bindings are supported by default. If the
28 /// entered text is longer than the allocation of the widget, the widget
29 /// will scroll so that the cursor position is visible.
30 ///
31 /// When using an entry for passwords and other sensitive information, it
32 /// can be put into “password mode” using [`EntryExt::set_visibility()`][crate::prelude::EntryExt::set_visibility()].
33 /// In this mode, entered text is displayed using a “invisible” character.
34 /// By default, GTK picks the best invisible character that is available
35 /// in the current font, but it can be changed with
36 /// [`EntryExt::set_invisible_char()`][crate::prelude::EntryExt::set_invisible_char()].
37 ///
38 /// [`Entry`][crate::Entry] has the ability to display progress or activity
39 /// information behind the text. To make an entry display such information,
40 /// use [`EntryExt::set_progress_fraction()`][crate::prelude::EntryExt::set_progress_fraction()] or
41 /// [`EntryExt::set_progress_pulse_step()`][crate::prelude::EntryExt::set_progress_pulse_step()].
42 ///
43 /// Additionally, [`Entry`][crate::Entry] can show icons at either side of the entry.
44 /// These icons can be activatable by clicking, can be set up as drag source
45 /// and can have tooltips. To add an icon, use
46 /// [`EntryExt::set_icon_from_gicon()`][crate::prelude::EntryExt::set_icon_from_gicon()] or one of the various other functions
47 /// that set an icon from an icon name or a paintable. To trigger an action when
48 /// the user clicks an icon, connect to the [`icon-press`][struct@crate::Entry#icon-press] signal.
49 /// To allow DND operations from an icon, use
50 /// [`EntryExt::set_icon_drag_source()`][crate::prelude::EntryExt::set_icon_drag_source()]. To set a tooltip on an icon, use
51 /// [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()] or the corresponding function
52 /// for markup.
53 ///
54 /// Note that functionality or information that is only available by clicking
55 /// on an icon in an entry may not be accessible at all to users which are not
56 /// able to use a mouse or other pointing device. It is therefore recommended
57 /// that any such functionality should also be available by other means, e.g.
58 /// via the context menu of the entry.
59 ///
60 /// # CSS nodes
61 ///
62 /// ```text
63 /// entry[.flat][.warning][.error]
64 /// ├── text[.readonly]
65 /// ├── image.left
66 /// ├── image.right
67 /// ╰── [progress[.pulse]]
68 /// ```
69 ///
70 /// [`Entry`][crate::Entry] has a main node with the name entry. Depending on the properties
71 /// of the entry, the style classes .read-only and .flat may appear. The style
72 /// classes .warning and .error may also be used with entries.
73 ///
74 /// When the entry shows icons, it adds subnodes with the name image and the
75 /// style class .left or .right, depending on where the icon appears.
76 ///
77 /// When the entry shows progress, it adds a subnode with the name progress.
78 /// The node has the style class .pulse when the shown progress is pulsing.
79 ///
80 /// For all the subnodes added to the text node in various situations,
81 /// see [`Text`][crate::Text].
82 ///
83 /// # GtkEntry as GtkBuildable
84 ///
85 /// The [`Entry`][crate::Entry] implementation of the [`Buildable`][crate::Buildable] interface supports a
86 /// custom `<attributes>` element, which supports any number of `<attribute>`
87 /// elements. The `<attribute>` element has attributes named “name“, “value“,
88 /// “start“ and “end“ and allows you to specify `PangoAttribute` values for
89 /// this label.
90 ///
91 /// An example of a UI definition fragment specifying Pango attributes:
92 /// ```xml
93 /// <object class="GtkEntry">
94 /// <attributes>
95 /// <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
96 /// <attribute name="background" value="red" start="5" end="10"/>
97 /// </attributes>
98 /// </object>
99 /// ```
100 ///
101 /// The start and end attributes specify the range of characters to which the
102 /// Pango attribute applies. If start and end are not specified, the attribute
103 /// is applied to the whole text. Note that specifying ranges does not make much
104 /// sense with translatable attributes. Use markup embedded in the translatable
105 /// content instead.
106 ///
107 /// # Accessibility
108 ///
109 /// [`Entry`][crate::Entry] uses the [enum@Gtk.AccessibleRole.text_box] role.
110 ///
111 /// ## Properties
112 ///
113 ///
114 /// #### `activates-default`
115 /// Whether to activate the default widget when Enter is pressed.
116 ///
117 /// Readable | Writeable
118 ///
119 ///
120 /// #### `attributes`
121 /// A list of Pango attributes to apply to the text of the entry.
122 ///
123 /// This is mainly useful to change the size or weight of the text.
124 ///
125 /// The `PangoAttribute`'s @start_index and @end_index must refer to the
126 /// [`EntryBuffer`][crate::EntryBuffer] text, i.e. without the preedit string.
127 ///
128 /// Readable | Writeable
129 ///
130 ///
131 /// #### `buffer`
132 /// The buffer object which actually stores the text.
133 ///
134 /// Readable | Writeable | Construct
135 ///
136 ///
137 /// #### `completion`
138 /// The auxiliary completion object to use with the entry.
139 ///
140 /// Readable | Writeable
141 ///
142 ///
143 /// #### `enable-emoji-completion`
144 /// Whether to suggest Emoji replacements for :-delimited names
145 /// like `:heart:`.
146 ///
147 /// Readable | Writeable
148 ///
149 ///
150 /// #### `extra-menu`
151 /// A menu model whose contents will be appended to the context menu.
152 ///
153 /// Readable | Writeable
154 ///
155 ///
156 /// #### `has-frame`
157 /// Whether the entry should draw a frame.
158 ///
159 /// Readable | Writeable
160 ///
161 ///
162 /// #### `im-module`
163 /// Which IM (input method) module should be used for this entry.
164 ///
165 /// See [`IMContext`][crate::IMContext].
166 ///
167 /// Setting this to a non-[`None`] value overrides the system-wide IM
168 /// module setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module]
169 /// property.
170 ///
171 /// Readable | Writeable
172 ///
173 ///
174 /// #### `input-hints`
175 /// Additional hints that allow input methods to fine-tune their behavior.
176 ///
177 /// Also see [`input-purpose`][struct@crate::Entry#input-purpose]
178 ///
179 /// Readable | Writeable
180 ///
181 ///
182 /// #### `input-purpose`
183 /// The purpose of this text field.
184 ///
185 /// This property can be used by on-screen keyboards and other input
186 /// methods to adjust their behaviour.
187 ///
188 /// Note that setting the purpose to [`InputPurpose::Password`][crate::InputPurpose::Password] or
189 /// [`InputPurpose::Pin`][crate::InputPurpose::Pin] is independent from setting
190 /// [`visibility`][struct@crate::Entry#visibility].
191 ///
192 /// Readable | Writeable
193 ///
194 ///
195 /// #### `invisible-char`
196 /// The character to use when masking entry contents (“password mode”).
197 ///
198 /// Readable | Writeable
199 ///
200 ///
201 /// #### `invisible-char-set`
202 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
203 ///
204 /// Readable | Writeable
205 ///
206 ///
207 /// #### `max-length`
208 /// Maximum number of characters for this entry.
209 ///
210 /// Readable | Writeable
211 ///
212 ///
213 /// #### `overwrite-mode`
214 /// If text is overwritten when typing in the [`Entry`][crate::Entry].
215 ///
216 /// Readable | Writeable
217 ///
218 ///
219 /// #### `placeholder-text`
220 /// The text that will be displayed in the [`Entry`][crate::Entry] when it is empty
221 /// and unfocused.
222 ///
223 /// Readable | Writeable
224 ///
225 ///
226 /// #### `primary-icon-activatable`
227 /// Whether the primary icon is activatable.
228 ///
229 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
230 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
231 /// activatable icons.
232 ///
233 /// Sensitive, but non-activatable icons can be used for purely
234 /// informational purposes.
235 ///
236 /// Readable | Writeable
237 ///
238 ///
239 /// #### `primary-icon-gicon`
240 /// The `GIcon` to use for the primary icon for the entry.
241 ///
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `primary-icon-name`
246 /// The icon name to use for the primary icon for the entry.
247 ///
248 /// Readable | Writeable
249 ///
250 ///
251 /// #### `primary-icon-paintable`
252 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the primary icon for the entry.
253 ///
254 /// Readable | Writeable
255 ///
256 ///
257 /// #### `primary-icon-sensitive`
258 /// Whether the primary icon is sensitive.
259 ///
260 /// An insensitive icon appears grayed out. GTK does not emit the
261 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
262 /// signals and does not allow DND from insensitive icons.
263 ///
264 /// An icon should be set insensitive if the action that would trigger
265 /// when clicked is currently not available.
266 ///
267 /// Readable | Writeable
268 ///
269 ///
270 /// #### `primary-icon-storage-type`
271 /// The representation which is used for the primary icon of the entry.
272 ///
273 /// Readable
274 ///
275 ///
276 /// #### `primary-icon-tooltip-markup`
277 /// The contents of the tooltip on the primary icon, with markup.
278 ///
279 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
280 ///
281 /// Readable | Writeable
282 ///
283 ///
284 /// #### `primary-icon-tooltip-text`
285 /// The contents of the tooltip on the primary icon.
286 ///
287 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
288 ///
289 /// Readable | Writeable
290 ///
291 ///
292 /// #### `progress-fraction`
293 /// The current fraction of the task that's been completed.
294 ///
295 /// Readable | Writeable
296 ///
297 ///
298 /// #### `progress-pulse-step`
299 /// The fraction of total entry width to move the progress
300 /// bouncing block for each pulse.
301 ///
302 /// See [`EntryExt::progress_pulse()`][crate::prelude::EntryExt::progress_pulse()].
303 ///
304 /// Readable | Writeable
305 ///
306 ///
307 /// #### `scroll-offset`
308 /// Number of pixels of the entry scrolled off the screen to the left.
309 ///
310 /// Readable
311 ///
312 ///
313 /// #### `secondary-icon-activatable`
314 /// Whether the secondary icon is activatable.
315 ///
316 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
317 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
318 /// activatable icons.
319 ///
320 /// Sensitive, but non-activatable icons can be used for purely
321 /// informational purposes.
322 ///
323 /// Readable | Writeable
324 ///
325 ///
326 /// #### `secondary-icon-gicon`
327 /// The `GIcon` to use for the secondary icon for the entry.
328 ///
329 /// Readable | Writeable
330 ///
331 ///
332 /// #### `secondary-icon-name`
333 /// The icon name to use for the secondary icon for the entry.
334 ///
335 /// Readable | Writeable
336 ///
337 ///
338 /// #### `secondary-icon-paintable`
339 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the secondary icon for the entry.
340 ///
341 /// Readable | Writeable
342 ///
343 ///
344 /// #### `secondary-icon-sensitive`
345 /// Whether the secondary icon is sensitive.
346 ///
347 /// An insensitive icon appears grayed out. GTK does not emit the
348 /// [`icon-press`][struct@crate::Entry#icon-press][ and [`icon-release`][struct@crate::Entry#icon-release]
349 /// signals and does not allow DND from insensitive icons.
350 ///
351 /// An icon should be set insensitive if the action that would trigger
352 /// when clicked is currently not available.
353 ///
354 /// Readable | Writeable
355 ///
356 ///
357 /// #### `secondary-icon-storage-type`
358 /// The representation which is used for the secondary icon of the entry.
359 ///
360 /// Readable
361 ///
362 ///
363 /// #### `secondary-icon-tooltip-markup`
364 /// The contents of the tooltip on the secondary icon, with markup.
365 ///
366 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
367 ///
368 /// Readable | Writeable
369 ///
370 ///
371 /// #### `secondary-icon-tooltip-text`
372 /// The contents of the tooltip on the secondary icon.
373 ///
374 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
375 ///
376 /// Readable | Writeable
377 ///
378 ///
379 /// #### `show-emoji-icon`
380 /// Whether the entry will show an Emoji icon in the secondary icon position
381 /// to open the Emoji chooser.
382 ///
383 /// Readable | Writeable
384 ///
385 ///
386 /// #### `tabs`
387 /// A list of tabstops to apply to the text of the entry.
388 ///
389 /// Readable | Writeable
390 ///
391 ///
392 /// #### `text-length`
393 /// The length of the text in the [`Entry`][crate::Entry].
394 ///
395 /// Readable
396 ///
397 ///
398 /// #### `truncate-multiline`
399 /// When [`true`], pasted multi-line text is truncated to the first line.
400 ///
401 /// Readable | Writeable
402 ///
403 ///
404 /// #### `visibility`
405 /// Whether the entry should show the “invisible char” instead of the
406 /// actual text (“password mode”).
407 ///
408 /// Readable | Writeable
409 /// <details><summary><h4>Widget</h4></summary>
410 ///
411 ///
412 /// #### `can-focus`
413 /// Whether the widget or any of its descendents can accept
414 /// the input focus.
415 ///
416 /// This property is meant to be set by widget implementations,
417 /// typically in their instance init function.
418 ///
419 /// Readable | Writeable
420 ///
421 ///
422 /// #### `can-target`
423 /// Whether the widget can receive pointer events.
424 ///
425 /// Readable | Writeable
426 ///
427 ///
428 /// #### `css-classes`
429 /// A list of css classes applied to this widget.
430 ///
431 /// Readable | Writeable
432 ///
433 ///
434 /// #### `css-name`
435 /// The name of this widget in the CSS tree.
436 ///
437 /// This property is meant to be set by widget implementations,
438 /// typically in their instance init function.
439 ///
440 /// Readable | Writeable | Construct Only
441 ///
442 ///
443 /// #### `cursor`
444 /// The cursor used by @widget.
445 ///
446 /// Readable | Writeable
447 ///
448 ///
449 /// #### `focus-on-click`
450 /// Whether the widget should grab focus when it is clicked with the mouse.
451 ///
452 /// This property is only relevant for widgets that can take focus.
453 ///
454 /// Readable | Writeable
455 ///
456 ///
457 /// #### `focusable`
458 /// Whether this widget itself will accept the input focus.
459 ///
460 /// Readable | Writeable
461 ///
462 ///
463 /// #### `halign`
464 /// How to distribute horizontal space if widget gets extra space.
465 ///
466 /// Readable | Writeable
467 ///
468 ///
469 /// #### `has-default`
470 /// Whether the widget is the default widget.
471 ///
472 /// Readable
473 ///
474 ///
475 /// #### `has-focus`
476 /// Whether the widget has the input focus.
477 ///
478 /// Readable
479 ///
480 ///
481 /// #### `has-tooltip`
482 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
483 /// signal on @widget.
484 ///
485 /// A true value indicates that @widget can have a tooltip, in this case
486 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
487 /// determine whether it will provide a tooltip or not.
488 ///
489 /// Readable | Writeable
490 ///
491 ///
492 /// #### `height-request`
493 /// Overrides for height request of the widget.
494 ///
495 /// If this is -1, the natural request will be used.
496 ///
497 /// Readable | Writeable
498 ///
499 ///
500 /// #### `hexpand`
501 /// Whether to expand horizontally.
502 ///
503 /// Readable | Writeable
504 ///
505 ///
506 /// #### `hexpand-set`
507 /// Whether to use the `hexpand` property.
508 ///
509 /// Readable | Writeable
510 ///
511 ///
512 /// #### `layout-manager`
513 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
514 /// the preferred size of the widget, and allocate its children.
515 ///
516 /// This property is meant to be set by widget implementations,
517 /// typically in their instance init function.
518 ///
519 /// Readable | Writeable
520 ///
521 ///
522 /// #### `limit-events`
523 /// Makes this widget act like a modal dialog, with respect to
524 /// event delivery.
525 ///
526 /// Global event controllers will not handle events with targets
527 /// inside the widget, unless they are set up to ignore propagation
528 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
529 ///
530 /// Readable | Writeable
531 ///
532 ///
533 /// #### `margin-bottom`
534 /// Margin on bottom side of widget.
535 ///
536 /// This property adds margin outside of the widget's normal size
537 /// request, the margin will be added in addition to the size from
538 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
539 ///
540 /// Readable | Writeable
541 ///
542 ///
543 /// #### `margin-end`
544 /// Margin on end of widget, horizontally.
545 ///
546 /// This property supports left-to-right and right-to-left text
547 /// directions.
548 ///
549 /// This property adds margin outside of the widget's normal size
550 /// request, the margin will be added in addition to the size from
551 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
552 ///
553 /// Readable | Writeable
554 ///
555 ///
556 /// #### `margin-start`
557 /// Margin on start of widget, horizontally.
558 ///
559 /// This property supports left-to-right and right-to-left text
560 /// directions.
561 ///
562 /// This property adds margin outside of the widget's normal size
563 /// request, the margin will be added in addition to the size from
564 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
565 ///
566 /// Readable | Writeable
567 ///
568 ///
569 /// #### `margin-top`
570 /// Margin on top side of widget.
571 ///
572 /// This property adds margin outside of the widget's normal size
573 /// request, the margin will be added in addition to the size from
574 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
575 ///
576 /// Readable | Writeable
577 ///
578 ///
579 /// #### `name`
580 /// The name of the widget.
581 ///
582 /// Readable | Writeable
583 ///
584 ///
585 /// #### `opacity`
586 /// The requested opacity of the widget.
587 ///
588 /// Readable | Writeable
589 ///
590 ///
591 /// #### `overflow`
592 /// How content outside the widget's content area is treated.
593 ///
594 /// This property is meant to be set by widget implementations,
595 /// typically in their instance init function.
596 ///
597 /// Readable | Writeable
598 ///
599 ///
600 /// #### `parent`
601 /// The parent widget of this widget.
602 ///
603 /// Readable
604 ///
605 ///
606 /// #### `receives-default`
607 /// Whether the widget will receive the default action when it is focused.
608 ///
609 /// Readable | Writeable
610 ///
611 ///
612 /// #### `root`
613 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
614 ///
615 /// This will be `NULL` if the widget is not contained in a root widget.
616 ///
617 /// Readable
618 ///
619 ///
620 /// #### `scale-factor`
621 /// The scale factor of the widget.
622 ///
623 /// Readable
624 ///
625 ///
626 /// #### `sensitive`
627 /// Whether the widget responds to input.
628 ///
629 /// Readable | Writeable
630 ///
631 ///
632 /// #### `tooltip-markup`
633 /// Sets the text of tooltip to be the given string, which is marked up
634 /// with Pango markup.
635 ///
636 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
637 ///
638 /// This is a convenience property which will take care of getting the
639 /// tooltip shown if the given string is not `NULL`:
640 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
641 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
642 /// the default signal handler.
643 ///
644 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
645 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
646 ///
647 /// Readable | Writeable
648 ///
649 ///
650 /// #### `tooltip-text`
651 /// Sets the text of tooltip to be the given string.
652 ///
653 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
654 ///
655 /// This is a convenience property which will take care of getting the
656 /// tooltip shown if the given string is not `NULL`:
657 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
658 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
659 /// the default signal handler.
660 ///
661 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
662 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
663 ///
664 /// Readable | Writeable
665 ///
666 ///
667 /// #### `valign`
668 /// How to distribute vertical space if widget gets extra space.
669 ///
670 /// Readable | Writeable
671 ///
672 ///
673 /// #### `vexpand`
674 /// Whether to expand vertically.
675 ///
676 /// Readable | Writeable
677 ///
678 ///
679 /// #### `vexpand-set`
680 /// Whether to use the `vexpand` property.
681 ///
682 /// Readable | Writeable
683 ///
684 ///
685 /// #### `visible`
686 /// Whether the widget is visible.
687 ///
688 /// Readable | Writeable
689 ///
690 ///
691 /// #### `width-request`
692 /// Overrides for width request of the widget.
693 ///
694 /// If this is -1, the natural request will be used.
695 ///
696 /// Readable | Writeable
697 /// </details>
698 /// <details><summary><h4>Accessible</h4></summary>
699 ///
700 ///
701 /// #### `accessible-role`
702 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
703 ///
704 /// The accessible role cannot be changed once set.
705 ///
706 /// Readable | Writeable
707 /// </details>
708 /// <details><summary><h4>CellEditable</h4></summary>
709 ///
710 ///
711 /// #### `editing-canceled`
712 /// Indicates whether editing on the cell has been canceled.
713 ///
714 /// Readable | Writeable
715 /// </details>
716 /// <details><summary><h4>Editable</h4></summary>
717 ///
718 ///
719 /// #### `cursor-position`
720 /// The current position of the insertion cursor in chars.
721 ///
722 /// Readable
723 ///
724 ///
725 /// #### `editable`
726 /// Whether the entry contents can be edited.
727 ///
728 /// Readable | Writeable
729 ///
730 ///
731 /// #### `enable-undo`
732 /// If undo/redo should be enabled for the editable.
733 ///
734 /// Readable | Writeable
735 ///
736 ///
737 /// #### `max-width-chars`
738 /// The desired maximum width of the entry, in characters.
739 ///
740 /// Readable | Writeable
741 ///
742 ///
743 /// #### `selection-bound`
744 /// The position of the opposite end of the selection from the cursor in chars.
745 ///
746 /// Readable
747 ///
748 ///
749 /// #### `text`
750 /// The contents of the entry.
751 ///
752 /// Readable | Writeable
753 ///
754 ///
755 /// #### `width-chars`
756 /// Number of characters to leave space for in the entry.
757 ///
758 /// Readable | Writeable
759 ///
760 ///
761 /// #### `xalign`
762 /// The horizontal alignment, from 0 (left) to 1 (right).
763 ///
764 /// Reversed for RTL layouts.
765 ///
766 /// Readable | Writeable
767 /// </details>
768 ///
769 /// ## Signals
770 ///
771 ///
772 /// #### `activate`
773 /// Emitted when the entry is activated.
774 ///
775 /// The keybindings for this signal are all forms of the Enter key.
776 ///
777 /// Action
778 ///
779 ///
780 /// #### `icon-press`
781 /// Emitted when an activatable icon is clicked.
782 ///
783 ///
784 ///
785 ///
786 /// #### `icon-release`
787 /// Emitted on the button release from a mouse click
788 /// over an activatable icon.
789 ///
790 ///
791 /// <details><summary><h4>Widget</h4></summary>
792 ///
793 ///
794 /// #### `destroy`
795 /// Signals that all holders of a reference to the widget should release
796 /// the reference that they hold.
797 ///
798 /// May result in finalization of the widget if all references are released.
799 ///
800 /// This signal is not suitable for saving widget state.
801 ///
802 ///
803 ///
804 ///
805 /// #### `direction-changed`
806 /// Emitted when the text direction of a widget changes.
807 ///
808 ///
809 ///
810 ///
811 /// #### `hide`
812 /// Emitted when @widget is hidden.
813 ///
814 ///
815 ///
816 ///
817 /// #### `keynav-failed`
818 /// Emitted if keyboard navigation fails.
819 ///
820 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
821 ///
822 ///
823 ///
824 ///
825 /// #### `map`
826 /// Emitted when @widget is going to be mapped.
827 ///
828 /// A widget is mapped when the widget is visible (which is controlled with
829 /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
830 /// are also visible.
831 ///
832 /// The `::map` signal can be used to determine whether a widget will be drawn,
833 /// for instance it can resume an animation that was stopped during the
834 /// emission of [`unmap`][struct@crate::Widget#unmap].
835 ///
836 ///
837 ///
838 ///
839 /// #### `mnemonic-activate`
840 /// Emitted when a widget is activated via a mnemonic.
841 ///
842 /// The default handler for this signal activates @widget if @group_cycling
843 /// is false, or just makes @widget grab focus if @group_cycling is true.
844 ///
845 ///
846 ///
847 ///
848 /// #### `move-focus`
849 /// Emitted when the focus is moved.
850 ///
851 /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
852 ///
853 /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
854 /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
855 ///
856 /// Action
857 ///
858 ///
859 /// #### `query-tooltip`
860 /// Emitted when the widget’s tooltip is about to be shown.
861 ///
862 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
863 /// is true and the hover timeout has expired with the cursor hovering
864 /// above @widget; or emitted when @widget got focus in keyboard mode.
865 ///
866 /// Using the given coordinates, the signal handler should determine
867 /// whether a tooltip should be shown for @widget. If this is the case
868 /// true should be returned, false otherwise. Note that if @keyboard_mode
869 /// is true, the values of @x and @y are undefined and should not be used.
870 ///
871 /// The signal handler is free to manipulate @tooltip with the therefore
872 /// destined function calls.
873 ///
874 ///
875 ///
876 ///
877 /// #### `realize`
878 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
879 ///
880 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
881 /// or the widget has been mapped (that is, it is going to be drawn).
882 ///
883 ///
884 ///
885 ///
886 /// #### `show`
887 /// Emitted when @widget is shown.
888 ///
889 ///
890 ///
891 ///
892 /// #### `state-flags-changed`
893 /// Emitted when the widget state changes.
894 ///
895 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
896 ///
897 ///
898 ///
899 ///
900 /// #### `unmap`
901 /// Emitted when @widget is going to be unmapped.
902 ///
903 /// A widget is unmapped when either it or any of its parents up to the
904 /// toplevel widget have been set as hidden.
905 ///
906 /// As `::unmap` indicates that a widget will not be shown any longer,
907 /// it can be used to, for example, stop an animation on the widget.
908 ///
909 ///
910 ///
911 ///
912 /// #### `unrealize`
913 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
914 ///
915 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
916 /// or the widget has been unmapped (that is, it is going to be hidden).
917 ///
918 ///
919 /// </details>
920 /// <details><summary><h4>CellEditable</h4></summary>
921 ///
922 ///
923 /// #### `editing-done`
924 /// This signal is a sign for the cell renderer to update its
925 /// value from the @cell_editable.
926 ///
927 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
928 /// emitting this signal when they are done editing, e.g.
929 /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
930 /// do in a handler for ::editing-done are to capture the edited value,
931 /// disconnect the @cell_editable from signals on the [`CellRenderer`][crate::CellRenderer], etc.
932 ///
933 /// gtk_cell_editable_editing_done() is a convenience method
934 /// for emitting `GtkCellEditable::editing-done`.
935 ///
936 ///
937 ///
938 ///
939 /// #### `remove-widget`
940 /// This signal is meant to indicate that the cell is finished
941 /// editing, and the @cell_editable widget is being removed and may
942 /// subsequently be destroyed.
943 ///
944 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
945 /// emitting this signal when they are done editing. It must
946 /// be emitted after the `GtkCellEditable::editing-done` signal,
947 /// to give the cell renderer a chance to update the cell's value
948 /// before the widget is removed.
949 ///
950 /// gtk_cell_editable_remove_widget() is a convenience method
951 /// for emitting `GtkCellEditable::remove-widget`.
952 ///
953 ///
954 /// </details>
955 /// <details><summary><h4>Editable</h4></summary>
956 ///
957 ///
958 /// #### `changed`
959 /// Emitted at the end of a single user-visible operation on the
960 /// contents.
961 ///
962 /// E.g., a paste operation that replaces the contents of the
963 /// selection will cause only one signal emission (even though it
964 /// is implemented by first deleting the selection, then inserting
965 /// the new content, and may cause multiple ::notify::text signals
966 /// to be emitted).
967 ///
968 ///
969 ///
970 ///
971 /// #### `delete-text`
972 /// Emitted when text is deleted from the widget by the user.
973 ///
974 /// The default handler for this signal will normally be responsible for
975 /// deleting the text, so by connecting to this signal and then stopping
976 /// the signal with g_signal_stop_emission(), it is possible to modify the
977 /// range of deleted text, or prevent it from being deleted entirely.
978 ///
979 /// The @start_pos and @end_pos parameters are interpreted as for
980 /// [`EditableExt::delete_text()`][crate::prelude::EditableExt::delete_text()].
981 ///
982 ///
983 ///
984 ///
985 /// #### `insert-text`
986 /// Emitted when text is inserted into the widget by the user.
987 ///
988 /// The default handler for this signal will normally be responsible
989 /// for inserting the text, so by connecting to this signal and then
990 /// stopping the signal with g_signal_stop_emission(), it is possible
991 /// to modify the inserted text, or prevent it from being inserted entirely.
992 ///
993 ///
994 /// </details>
995 ///
996 /// # Implements
997 ///
998 /// [`EntryExt`][trait@crate::prelude::EntryExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`CellEditableExt`][trait@crate::prelude::CellEditableExt], [`EditableExt`][trait@crate::prelude::EditableExt], [`EntryExtManual`][trait@crate::prelude::EntryExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`EditableExtManual`][trait@crate::prelude::EditableExtManual]
999 #[doc(alias = "GtkEntry")]
1000 pub struct Entry(Object<ffi::GtkEntry, ffi::GtkEntryClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, CellEditable, Editable;
1001
1002 match fn {
1003 type_ => || ffi::gtk_entry_get_type(),
1004 }
1005}
1006
1007impl Entry {
1008 pub const NONE: Option<&'static Entry> = None;
1009
1010 /// Creates a new entry.
1011 ///
1012 /// # Returns
1013 ///
1014 /// a new [`Entry`][crate::Entry].
1015 #[doc(alias = "gtk_entry_new")]
1016 pub fn new() -> Entry {
1017 assert_initialized_main_thread!();
1018 unsafe { Widget::from_glib_none(ffi::gtk_entry_new()).unsafe_cast() }
1019 }
1020
1021 /// Creates a new entry with the specified text buffer.
1022 /// ## `buffer`
1023 /// The buffer to use for the new [`Entry`][crate::Entry].
1024 ///
1025 /// # Returns
1026 ///
1027 /// a new [`Entry`][crate::Entry]
1028 #[doc(alias = "gtk_entry_new_with_buffer")]
1029 #[doc(alias = "new_with_buffer")]
1030 pub fn with_buffer(buffer: &impl IsA<EntryBuffer>) -> Entry {
1031 skip_assert_initialized!();
1032 unsafe {
1033 Widget::from_glib_none(ffi::gtk_entry_new_with_buffer(
1034 buffer.as_ref().to_glib_none().0,
1035 ))
1036 .unsafe_cast()
1037 }
1038 }
1039
1040 // rustdoc-stripper-ignore-next
1041 /// Creates a new builder-pattern struct instance to construct [`Entry`] objects.
1042 ///
1043 /// This method returns an instance of [`EntryBuilder`](crate::builders::EntryBuilder) which can be used to create [`Entry`] objects.
1044 pub fn builder() -> EntryBuilder {
1045 EntryBuilder::new()
1046 }
1047}
1048
1049impl Default for Entry {
1050 fn default() -> Self {
1051 Self::new()
1052 }
1053}
1054
1055// rustdoc-stripper-ignore-next
1056/// A [builder-pattern] type to construct [`Entry`] objects.
1057///
1058/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1059#[must_use = "The builder must be built to be used"]
1060pub struct EntryBuilder {
1061 builder: glib::object::ObjectBuilder<'static, Entry>,
1062}
1063
1064impl EntryBuilder {
1065 fn new() -> Self {
1066 Self {
1067 builder: glib::object::Object::builder(),
1068 }
1069 }
1070
1071 /// Whether to activate the default widget when Enter is pressed.
1072 pub fn activates_default(self, activates_default: bool) -> Self {
1073 Self {
1074 builder: self
1075 .builder
1076 .property("activates-default", activates_default),
1077 }
1078 }
1079
1080 /// A list of Pango attributes to apply to the text of the entry.
1081 ///
1082 /// This is mainly useful to change the size or weight of the text.
1083 ///
1084 /// The `PangoAttribute`'s @start_index and @end_index must refer to the
1085 /// [`EntryBuffer`][crate::EntryBuffer] text, i.e. without the preedit string.
1086 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
1087 Self {
1088 builder: self.builder.property("attributes", attributes.clone()),
1089 }
1090 }
1091
1092 /// The buffer object which actually stores the text.
1093 pub fn buffer(self, buffer: &impl IsA<EntryBuffer>) -> Self {
1094 Self {
1095 builder: self.builder.property("buffer", buffer.clone().upcast()),
1096 }
1097 }
1098
1099 /// The auxiliary completion object to use with the entry.
1100 /// GtkEntryCompletion will be removed in GTK 5.
1101 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1102 pub fn completion(self, completion: &EntryCompletion) -> Self {
1103 Self {
1104 builder: self.builder.property("completion", completion.clone()),
1105 }
1106 }
1107
1108 /// Whether to suggest Emoji replacements for :-delimited names
1109 /// like `:heart:`.
1110 pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
1111 Self {
1112 builder: self
1113 .builder
1114 .property("enable-emoji-completion", enable_emoji_completion),
1115 }
1116 }
1117
1118 /// A menu model whose contents will be appended to the context menu.
1119 pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
1120 Self {
1121 builder: self
1122 .builder
1123 .property("extra-menu", extra_menu.clone().upcast()),
1124 }
1125 }
1126
1127 /// Whether the entry should draw a frame.
1128 pub fn has_frame(self, has_frame: bool) -> Self {
1129 Self {
1130 builder: self.builder.property("has-frame", has_frame),
1131 }
1132 }
1133
1134 /// Which IM (input method) module should be used for this entry.
1135 ///
1136 /// See [`IMContext`][crate::IMContext].
1137 ///
1138 /// Setting this to a non-[`None`] value overrides the system-wide IM
1139 /// module setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module]
1140 /// property.
1141 pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
1142 Self {
1143 builder: self.builder.property("im-module", im_module.into()),
1144 }
1145 }
1146
1147 /// Additional hints that allow input methods to fine-tune their behavior.
1148 ///
1149 /// Also see [`input-purpose`][struct@crate::Entry#input-purpose]
1150 pub fn input_hints(self, input_hints: InputHints) -> Self {
1151 Self {
1152 builder: self.builder.property("input-hints", input_hints),
1153 }
1154 }
1155
1156 /// The purpose of this text field.
1157 ///
1158 /// This property can be used by on-screen keyboards and other input
1159 /// methods to adjust their behaviour.
1160 ///
1161 /// Note that setting the purpose to [`InputPurpose::Password`][crate::InputPurpose::Password] or
1162 /// [`InputPurpose::Pin`][crate::InputPurpose::Pin] is independent from setting
1163 /// [`visibility`][struct@crate::Entry#visibility].
1164 pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
1165 Self {
1166 builder: self.builder.property("input-purpose", input_purpose),
1167 }
1168 }
1169
1170 /// The character to use when masking entry contents (“password mode”).
1171 pub fn invisible_char(self, invisible_char: u32) -> Self {
1172 Self {
1173 builder: self.builder.property("invisible-char", invisible_char),
1174 }
1175 }
1176
1177 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
1178 pub fn invisible_char_set(self, invisible_char_set: bool) -> Self {
1179 Self {
1180 builder: self
1181 .builder
1182 .property("invisible-char-set", invisible_char_set),
1183 }
1184 }
1185
1186 /// Maximum number of characters for this entry.
1187 pub fn max_length(self, max_length: i32) -> Self {
1188 Self {
1189 builder: self.builder.property("max-length", max_length),
1190 }
1191 }
1192
1193 /// If text is overwritten when typing in the [`Entry`][crate::Entry].
1194 pub fn overwrite_mode(self, overwrite_mode: bool) -> Self {
1195 Self {
1196 builder: self.builder.property("overwrite-mode", overwrite_mode),
1197 }
1198 }
1199
1200 /// The text that will be displayed in the [`Entry`][crate::Entry] when it is empty
1201 /// and unfocused.
1202 pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
1203 Self {
1204 builder: self
1205 .builder
1206 .property("placeholder-text", placeholder_text.into()),
1207 }
1208 }
1209
1210 /// Whether the primary icon is activatable.
1211 ///
1212 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
1213 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
1214 /// activatable icons.
1215 ///
1216 /// Sensitive, but non-activatable icons can be used for purely
1217 /// informational purposes.
1218 pub fn primary_icon_activatable(self, primary_icon_activatable: bool) -> Self {
1219 Self {
1220 builder: self
1221 .builder
1222 .property("primary-icon-activatable", primary_icon_activatable),
1223 }
1224 }
1225
1226 /// The `GIcon` to use for the primary icon for the entry.
1227 pub fn primary_icon_gicon(self, primary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
1228 Self {
1229 builder: self
1230 .builder
1231 .property("primary-icon-gicon", primary_icon_gicon.clone().upcast()),
1232 }
1233 }
1234
1235 /// The icon name to use for the primary icon for the entry.
1236 pub fn primary_icon_name(self, primary_icon_name: impl Into<glib::GString>) -> Self {
1237 Self {
1238 builder: self
1239 .builder
1240 .property("primary-icon-name", primary_icon_name.into()),
1241 }
1242 }
1243
1244 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the primary icon for the entry.
1245 pub fn primary_icon_paintable(self, primary_icon_paintable: &impl IsA<gdk::Paintable>) -> Self {
1246 Self {
1247 builder: self.builder.property(
1248 "primary-icon-paintable",
1249 primary_icon_paintable.clone().upcast(),
1250 ),
1251 }
1252 }
1253
1254 /// Whether the primary icon is sensitive.
1255 ///
1256 /// An insensitive icon appears grayed out. GTK does not emit the
1257 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
1258 /// signals and does not allow DND from insensitive icons.
1259 ///
1260 /// An icon should be set insensitive if the action that would trigger
1261 /// when clicked is currently not available.
1262 pub fn primary_icon_sensitive(self, primary_icon_sensitive: bool) -> Self {
1263 Self {
1264 builder: self
1265 .builder
1266 .property("primary-icon-sensitive", primary_icon_sensitive),
1267 }
1268 }
1269
1270 /// The contents of the tooltip on the primary icon, with markup.
1271 ///
1272 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
1273 pub fn primary_icon_tooltip_markup(
1274 self,
1275 primary_icon_tooltip_markup: impl Into<glib::GString>,
1276 ) -> Self {
1277 Self {
1278 builder: self.builder.property(
1279 "primary-icon-tooltip-markup",
1280 primary_icon_tooltip_markup.into(),
1281 ),
1282 }
1283 }
1284
1285 /// The contents of the tooltip on the primary icon.
1286 ///
1287 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
1288 pub fn primary_icon_tooltip_text(
1289 self,
1290 primary_icon_tooltip_text: impl Into<glib::GString>,
1291 ) -> Self {
1292 Self {
1293 builder: self.builder.property(
1294 "primary-icon-tooltip-text",
1295 primary_icon_tooltip_text.into(),
1296 ),
1297 }
1298 }
1299
1300 /// The current fraction of the task that's been completed.
1301 pub fn progress_fraction(self, progress_fraction: f64) -> Self {
1302 Self {
1303 builder: self
1304 .builder
1305 .property("progress-fraction", progress_fraction),
1306 }
1307 }
1308
1309 /// The fraction of total entry width to move the progress
1310 /// bouncing block for each pulse.
1311 ///
1312 /// See [`EntryExt::progress_pulse()`][crate::prelude::EntryExt::progress_pulse()].
1313 pub fn progress_pulse_step(self, progress_pulse_step: f64) -> Self {
1314 Self {
1315 builder: self
1316 .builder
1317 .property("progress-pulse-step", progress_pulse_step),
1318 }
1319 }
1320
1321 /// Whether the secondary icon is activatable.
1322 ///
1323 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
1324 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
1325 /// activatable icons.
1326 ///
1327 /// Sensitive, but non-activatable icons can be used for purely
1328 /// informational purposes.
1329 pub fn secondary_icon_activatable(self, secondary_icon_activatable: bool) -> Self {
1330 Self {
1331 builder: self
1332 .builder
1333 .property("secondary-icon-activatable", secondary_icon_activatable),
1334 }
1335 }
1336
1337 /// The `GIcon` to use for the secondary icon for the entry.
1338 pub fn secondary_icon_gicon(self, secondary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
1339 Self {
1340 builder: self.builder.property(
1341 "secondary-icon-gicon",
1342 secondary_icon_gicon.clone().upcast(),
1343 ),
1344 }
1345 }
1346
1347 /// The icon name to use for the secondary icon for the entry.
1348 pub fn secondary_icon_name(self, secondary_icon_name: impl Into<glib::GString>) -> Self {
1349 Self {
1350 builder: self
1351 .builder
1352 .property("secondary-icon-name", secondary_icon_name.into()),
1353 }
1354 }
1355
1356 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the secondary icon for the entry.
1357 pub fn secondary_icon_paintable(
1358 self,
1359 secondary_icon_paintable: &impl IsA<gdk::Paintable>,
1360 ) -> Self {
1361 Self {
1362 builder: self.builder.property(
1363 "secondary-icon-paintable",
1364 secondary_icon_paintable.clone().upcast(),
1365 ),
1366 }
1367 }
1368
1369 /// Whether the secondary icon is sensitive.
1370 ///
1371 /// An insensitive icon appears grayed out. GTK does not emit the
1372 /// [`icon-press`][struct@crate::Entry#icon-press][ and [`icon-release`][struct@crate::Entry#icon-release]
1373 /// signals and does not allow DND from insensitive icons.
1374 ///
1375 /// An icon should be set insensitive if the action that would trigger
1376 /// when clicked is currently not available.
1377 pub fn secondary_icon_sensitive(self, secondary_icon_sensitive: bool) -> Self {
1378 Self {
1379 builder: self
1380 .builder
1381 .property("secondary-icon-sensitive", secondary_icon_sensitive),
1382 }
1383 }
1384
1385 /// The contents of the tooltip on the secondary icon, with markup.
1386 ///
1387 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
1388 pub fn secondary_icon_tooltip_markup(
1389 self,
1390 secondary_icon_tooltip_markup: impl Into<glib::GString>,
1391 ) -> Self {
1392 Self {
1393 builder: self.builder.property(
1394 "secondary-icon-tooltip-markup",
1395 secondary_icon_tooltip_markup.into(),
1396 ),
1397 }
1398 }
1399
1400 /// The contents of the tooltip on the secondary icon.
1401 ///
1402 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
1403 pub fn secondary_icon_tooltip_text(
1404 self,
1405 secondary_icon_tooltip_text: impl Into<glib::GString>,
1406 ) -> Self {
1407 Self {
1408 builder: self.builder.property(
1409 "secondary-icon-tooltip-text",
1410 secondary_icon_tooltip_text.into(),
1411 ),
1412 }
1413 }
1414
1415 /// Whether the entry will show an Emoji icon in the secondary icon position
1416 /// to open the Emoji chooser.
1417 pub fn show_emoji_icon(self, show_emoji_icon: bool) -> Self {
1418 Self {
1419 builder: self.builder.property("show-emoji-icon", show_emoji_icon),
1420 }
1421 }
1422
1423 /// A list of tabstops to apply to the text of the entry.
1424 pub fn tabs(self, tabs: &pango::TabArray) -> Self {
1425 Self {
1426 builder: self.builder.property("tabs", tabs),
1427 }
1428 }
1429
1430 /// When [`true`], pasted multi-line text is truncated to the first line.
1431 pub fn truncate_multiline(self, truncate_multiline: bool) -> Self {
1432 Self {
1433 builder: self
1434 .builder
1435 .property("truncate-multiline", truncate_multiline),
1436 }
1437 }
1438
1439 /// Whether the entry should show the “invisible char” instead of the
1440 /// actual text (“password mode”).
1441 pub fn visibility(self, visibility: bool) -> Self {
1442 Self {
1443 builder: self.builder.property("visibility", visibility),
1444 }
1445 }
1446
1447 /// Whether the widget or any of its descendents can accept
1448 /// the input focus.
1449 ///
1450 /// This property is meant to be set by widget implementations,
1451 /// typically in their instance init function.
1452 pub fn can_focus(self, can_focus: bool) -> Self {
1453 Self {
1454 builder: self.builder.property("can-focus", can_focus),
1455 }
1456 }
1457
1458 /// Whether the widget can receive pointer events.
1459 pub fn can_target(self, can_target: bool) -> Self {
1460 Self {
1461 builder: self.builder.property("can-target", can_target),
1462 }
1463 }
1464
1465 /// A list of css classes applied to this widget.
1466 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1467 Self {
1468 builder: self.builder.property("css-classes", css_classes.into()),
1469 }
1470 }
1471
1472 /// The name of this widget in the CSS tree.
1473 ///
1474 /// This property is meant to be set by widget implementations,
1475 /// typically in their instance init function.
1476 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1477 Self {
1478 builder: self.builder.property("css-name", css_name.into()),
1479 }
1480 }
1481
1482 /// The cursor used by @widget.
1483 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1484 Self {
1485 builder: self.builder.property("cursor", cursor.clone()),
1486 }
1487 }
1488
1489 /// Whether the widget should grab focus when it is clicked with the mouse.
1490 ///
1491 /// This property is only relevant for widgets that can take focus.
1492 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1493 Self {
1494 builder: self.builder.property("focus-on-click", focus_on_click),
1495 }
1496 }
1497
1498 /// Whether this widget itself will accept the input focus.
1499 pub fn focusable(self, focusable: bool) -> Self {
1500 Self {
1501 builder: self.builder.property("focusable", focusable),
1502 }
1503 }
1504
1505 /// How to distribute horizontal space if widget gets extra space.
1506 pub fn halign(self, halign: Align) -> Self {
1507 Self {
1508 builder: self.builder.property("halign", halign),
1509 }
1510 }
1511
1512 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1513 /// signal on @widget.
1514 ///
1515 /// A true value indicates that @widget can have a tooltip, in this case
1516 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1517 /// determine whether it will provide a tooltip or not.
1518 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1519 Self {
1520 builder: self.builder.property("has-tooltip", has_tooltip),
1521 }
1522 }
1523
1524 /// Overrides for height request of the widget.
1525 ///
1526 /// If this is -1, the natural request will be used.
1527 pub fn height_request(self, height_request: i32) -> Self {
1528 Self {
1529 builder: self.builder.property("height-request", height_request),
1530 }
1531 }
1532
1533 /// Whether to expand horizontally.
1534 pub fn hexpand(self, hexpand: bool) -> Self {
1535 Self {
1536 builder: self.builder.property("hexpand", hexpand),
1537 }
1538 }
1539
1540 /// Whether to use the `hexpand` property.
1541 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1542 Self {
1543 builder: self.builder.property("hexpand-set", hexpand_set),
1544 }
1545 }
1546
1547 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1548 /// the preferred size of the widget, and allocate its children.
1549 ///
1550 /// This property is meant to be set by widget implementations,
1551 /// typically in their instance init function.
1552 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1553 Self {
1554 builder: self
1555 .builder
1556 .property("layout-manager", layout_manager.clone().upcast()),
1557 }
1558 }
1559
1560 /// Makes this widget act like a modal dialog, with respect to
1561 /// event delivery.
1562 ///
1563 /// Global event controllers will not handle events with targets
1564 /// inside the widget, unless they are set up to ignore propagation
1565 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1566 #[cfg(feature = "v4_18")]
1567 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1568 pub fn limit_events(self, limit_events: bool) -> Self {
1569 Self {
1570 builder: self.builder.property("limit-events", limit_events),
1571 }
1572 }
1573
1574 /// Margin on bottom side of widget.
1575 ///
1576 /// This property adds margin outside of the widget's normal size
1577 /// request, the margin will be added in addition to the size from
1578 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1579 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1580 Self {
1581 builder: self.builder.property("margin-bottom", margin_bottom),
1582 }
1583 }
1584
1585 /// Margin on end of widget, horizontally.
1586 ///
1587 /// This property supports left-to-right and right-to-left text
1588 /// directions.
1589 ///
1590 /// This property adds margin outside of the widget's normal size
1591 /// request, the margin will be added in addition to the size from
1592 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1593 pub fn margin_end(self, margin_end: i32) -> Self {
1594 Self {
1595 builder: self.builder.property("margin-end", margin_end),
1596 }
1597 }
1598
1599 /// Margin on start of widget, horizontally.
1600 ///
1601 /// This property supports left-to-right and right-to-left text
1602 /// directions.
1603 ///
1604 /// This property adds margin outside of the widget's normal size
1605 /// request, the margin will be added in addition to the size from
1606 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1607 pub fn margin_start(self, margin_start: i32) -> Self {
1608 Self {
1609 builder: self.builder.property("margin-start", margin_start),
1610 }
1611 }
1612
1613 /// Margin on top side of widget.
1614 ///
1615 /// This property adds margin outside of the widget's normal size
1616 /// request, the margin will be added in addition to the size from
1617 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1618 pub fn margin_top(self, margin_top: i32) -> Self {
1619 Self {
1620 builder: self.builder.property("margin-top", margin_top),
1621 }
1622 }
1623
1624 /// The name of the widget.
1625 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1626 Self {
1627 builder: self.builder.property("name", name.into()),
1628 }
1629 }
1630
1631 /// The requested opacity of the widget.
1632 pub fn opacity(self, opacity: f64) -> Self {
1633 Self {
1634 builder: self.builder.property("opacity", opacity),
1635 }
1636 }
1637
1638 /// How content outside the widget's content area is treated.
1639 ///
1640 /// This property is meant to be set by widget implementations,
1641 /// typically in their instance init function.
1642 pub fn overflow(self, overflow: Overflow) -> Self {
1643 Self {
1644 builder: self.builder.property("overflow", overflow),
1645 }
1646 }
1647
1648 /// Whether the widget will receive the default action when it is focused.
1649 pub fn receives_default(self, receives_default: bool) -> Self {
1650 Self {
1651 builder: self.builder.property("receives-default", receives_default),
1652 }
1653 }
1654
1655 /// Whether the widget responds to input.
1656 pub fn sensitive(self, sensitive: bool) -> Self {
1657 Self {
1658 builder: self.builder.property("sensitive", sensitive),
1659 }
1660 }
1661
1662 /// Sets the text of tooltip to be the given string, which is marked up
1663 /// with Pango markup.
1664 ///
1665 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1666 ///
1667 /// This is a convenience property which will take care of getting the
1668 /// tooltip shown if the given string is not `NULL`:
1669 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1670 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1671 /// the default signal handler.
1672 ///
1673 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1674 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1675 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1676 Self {
1677 builder: self
1678 .builder
1679 .property("tooltip-markup", tooltip_markup.into()),
1680 }
1681 }
1682
1683 /// Sets the text of tooltip to be the given string.
1684 ///
1685 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1686 ///
1687 /// This is a convenience property which will take care of getting the
1688 /// tooltip shown if the given string is not `NULL`:
1689 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1690 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1691 /// the default signal handler.
1692 ///
1693 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1694 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1695 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1696 Self {
1697 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1698 }
1699 }
1700
1701 /// How to distribute vertical space if widget gets extra space.
1702 pub fn valign(self, valign: Align) -> Self {
1703 Self {
1704 builder: self.builder.property("valign", valign),
1705 }
1706 }
1707
1708 /// Whether to expand vertically.
1709 pub fn vexpand(self, vexpand: bool) -> Self {
1710 Self {
1711 builder: self.builder.property("vexpand", vexpand),
1712 }
1713 }
1714
1715 /// Whether to use the `vexpand` property.
1716 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1717 Self {
1718 builder: self.builder.property("vexpand-set", vexpand_set),
1719 }
1720 }
1721
1722 /// Whether the widget is visible.
1723 pub fn visible(self, visible: bool) -> Self {
1724 Self {
1725 builder: self.builder.property("visible", visible),
1726 }
1727 }
1728
1729 /// Overrides for width request of the widget.
1730 ///
1731 /// If this is -1, the natural request will be used.
1732 pub fn width_request(self, width_request: i32) -> Self {
1733 Self {
1734 builder: self.builder.property("width-request", width_request),
1735 }
1736 }
1737
1738 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1739 ///
1740 /// The accessible role cannot be changed once set.
1741 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1742 Self {
1743 builder: self.builder.property("accessible-role", accessible_role),
1744 }
1745 }
1746
1747 /// Indicates whether editing on the cell has been canceled.
1748 pub fn editing_canceled(self, editing_canceled: bool) -> Self {
1749 Self {
1750 builder: self.builder.property("editing-canceled", editing_canceled),
1751 }
1752 }
1753
1754 /// Whether the entry contents can be edited.
1755 pub fn editable(self, editable: bool) -> Self {
1756 Self {
1757 builder: self.builder.property("editable", editable),
1758 }
1759 }
1760
1761 /// If undo/redo should be enabled for the editable.
1762 pub fn enable_undo(self, enable_undo: bool) -> Self {
1763 Self {
1764 builder: self.builder.property("enable-undo", enable_undo),
1765 }
1766 }
1767
1768 /// The desired maximum width of the entry, in characters.
1769 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1770 Self {
1771 builder: self.builder.property("max-width-chars", max_width_chars),
1772 }
1773 }
1774
1775 /// The contents of the entry.
1776 pub fn text(self, text: impl Into<glib::GString>) -> Self {
1777 Self {
1778 builder: self.builder.property("text", text.into()),
1779 }
1780 }
1781
1782 /// Number of characters to leave space for in the entry.
1783 pub fn width_chars(self, width_chars: i32) -> Self {
1784 Self {
1785 builder: self.builder.property("width-chars", width_chars),
1786 }
1787 }
1788
1789 /// The horizontal alignment, from 0 (left) to 1 (right).
1790 ///
1791 /// Reversed for RTL layouts.
1792 pub fn xalign(self, xalign: f32) -> Self {
1793 Self {
1794 builder: self.builder.property("xalign", xalign),
1795 }
1796 }
1797
1798 // rustdoc-stripper-ignore-next
1799 /// Build the [`Entry`].
1800 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1801 pub fn build(self) -> Entry {
1802 assert_initialized_main_thread!();
1803 self.builder.build()
1804 }
1805}
1806
1807/// Trait containing all [`struct@Entry`] methods.
1808///
1809/// # Implementors
1810///
1811/// [`Entry`][struct@crate::Entry]
1812pub trait EntryExt: IsA<Entry> + 'static {
1813 /// Retrieves the value set by gtk_entry_set_activates_default().
1814 ///
1815 /// # Returns
1816 ///
1817 /// [`true`] if the entry will activate the default widget
1818 #[doc(alias = "gtk_entry_get_activates_default")]
1819 #[doc(alias = "get_activates_default")]
1820 #[doc(alias = "activates-default")]
1821 fn activates_default(&self) -> bool {
1822 unsafe {
1823 from_glib(ffi::gtk_entry_get_activates_default(
1824 self.as_ref().to_glib_none().0,
1825 ))
1826 }
1827 }
1828
1829 /// Gets the value set by gtk_entry_set_alignment().
1830 ///
1831 /// See also: [`xalign`][struct@crate::Editable#xalign]
1832 ///
1833 /// # Returns
1834 ///
1835 /// the alignment
1836 #[doc(alias = "gtk_entry_get_alignment")]
1837 #[doc(alias = "get_alignment")]
1838 fn alignment(&self) -> f32 {
1839 unsafe { ffi::gtk_entry_get_alignment(self.as_ref().to_glib_none().0) }
1840 }
1841
1842 /// Gets the attribute list of the [`Entry`][crate::Entry].
1843 ///
1844 /// See [`set_attributes()`][Self::set_attributes()].
1845 ///
1846 /// # Returns
1847 ///
1848 /// the attribute list
1849 #[doc(alias = "gtk_entry_get_attributes")]
1850 #[doc(alias = "get_attributes")]
1851 fn attributes(&self) -> Option<pango::AttrList> {
1852 unsafe {
1853 from_glib_none(ffi::gtk_entry_get_attributes(
1854 self.as_ref().to_glib_none().0,
1855 ))
1856 }
1857 }
1858
1859 /// Get the [`EntryBuffer`][crate::EntryBuffer] object which holds the text for
1860 /// this widget.
1861 ///
1862 /// # Returns
1863 ///
1864 /// A [`EntryBuffer`][crate::EntryBuffer] object.
1865 #[doc(alias = "gtk_entry_get_buffer")]
1866 #[doc(alias = "get_buffer")]
1867 fn buffer(&self) -> EntryBuffer {
1868 unsafe { from_glib_none(ffi::gtk_entry_get_buffer(self.as_ref().to_glib_none().0)) }
1869 }
1870
1871 /// Returns the auxiliary completion object currently
1872 /// in use by @self.
1873 ///
1874 /// # Deprecated since 4.10
1875 ///
1876 /// GtkEntryCompletion will be removed in GTK 5.
1877 ///
1878 /// # Returns
1879 ///
1880 /// The auxiliary
1881 /// completion object currently in use by @self
1882 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1883 #[allow(deprecated)]
1884 #[doc(alias = "gtk_entry_get_completion")]
1885 #[doc(alias = "get_completion")]
1886 fn completion(&self) -> Option<EntryCompletion> {
1887 unsafe {
1888 from_glib_none(ffi::gtk_entry_get_completion(
1889 self.as_ref().to_glib_none().0,
1890 ))
1891 }
1892 }
1893
1894 /// Returns the index of the icon which is the source of the
1895 /// current DND operation, or -1.
1896 ///
1897 /// # Returns
1898 ///
1899 /// index of the icon which is the source of the
1900 /// current DND operation, or -1.
1901 #[doc(alias = "gtk_entry_get_current_icon_drag_source")]
1902 #[doc(alias = "get_current_icon_drag_source")]
1903 fn current_icon_drag_source(&self) -> i32 {
1904 unsafe { ffi::gtk_entry_get_current_icon_drag_source(self.as_ref().to_glib_none().0) }
1905 }
1906
1907 /// Gets the menu model set with gtk_entry_set_extra_menu().
1908 ///
1909 /// # Returns
1910 ///
1911 /// the menu model
1912 #[doc(alias = "gtk_entry_get_extra_menu")]
1913 #[doc(alias = "get_extra_menu")]
1914 #[doc(alias = "extra-menu")]
1915 fn extra_menu(&self) -> Option<gio::MenuModel> {
1916 unsafe {
1917 from_glib_none(ffi::gtk_entry_get_extra_menu(
1918 self.as_ref().to_glib_none().0,
1919 ))
1920 }
1921 }
1922
1923 /// Gets the value set by gtk_entry_set_has_frame().
1924 ///
1925 /// # Returns
1926 ///
1927 /// whether the entry has a beveled frame
1928 #[doc(alias = "gtk_entry_get_has_frame")]
1929 #[doc(alias = "get_has_frame")]
1930 #[doc(alias = "has-frame")]
1931 fn has_frame(&self) -> bool {
1932 unsafe { from_glib(ffi::gtk_entry_get_has_frame(self.as_ref().to_glib_none().0)) }
1933 }
1934
1935 /// Returns whether the icon is activatable.
1936 /// ## `icon_pos`
1937 /// Icon position
1938 ///
1939 /// # Returns
1940 ///
1941 /// [`true`] if the icon is activatable.
1942 #[doc(alias = "gtk_entry_get_icon_activatable")]
1943 #[doc(alias = "get_icon_activatable")]
1944 fn icon_is_activatable(&self, icon_pos: EntryIconPosition) -> bool {
1945 unsafe {
1946 from_glib(ffi::gtk_entry_get_icon_activatable(
1947 self.as_ref().to_glib_none().0,
1948 icon_pos.into_glib(),
1949 ))
1950 }
1951 }
1952
1953 /// Gets the area where entry’s icon at @icon_pos is drawn.
1954 ///
1955 /// This function is useful when drawing something to the
1956 /// entry in a draw callback.
1957 ///
1958 /// If the entry is not realized or has no icon at the given
1959 /// position, @icon_area is filled with zeros. Otherwise,
1960 /// @icon_area will be filled with the icon's allocation,
1961 /// relative to @self's allocation.
1962 /// ## `icon_pos`
1963 /// Icon position
1964 ///
1965 /// # Returns
1966 ///
1967 ///
1968 /// ## `icon_area`
1969 /// Return location for the icon’s area
1970 #[doc(alias = "gtk_entry_get_icon_area")]
1971 #[doc(alias = "get_icon_area")]
1972 fn icon_area(&self, icon_pos: EntryIconPosition) -> gdk::Rectangle {
1973 unsafe {
1974 let mut icon_area = gdk::Rectangle::uninitialized();
1975 ffi::gtk_entry_get_icon_area(
1976 self.as_ref().to_glib_none().0,
1977 icon_pos.into_glib(),
1978 icon_area.to_glib_none_mut().0,
1979 );
1980 icon_area
1981 }
1982 }
1983
1984 /// Finds the icon at the given position and return its index.
1985 ///
1986 /// The position’s coordinates are relative to the @self’s
1987 /// top left corner. If @x, @y doesn’t lie inside an icon,
1988 /// -1 is returned. This function is intended for use in a
1989 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] signal handler.
1990 /// ## `x`
1991 /// the x coordinate of the position to find, relative to @self
1992 /// ## `y`
1993 /// the y coordinate of the position to find, relative to @self
1994 ///
1995 /// # Returns
1996 ///
1997 /// the index of the icon at the given position, or -1
1998 #[doc(alias = "gtk_entry_get_icon_at_pos")]
1999 #[doc(alias = "get_icon_at_pos")]
2000 fn icon_at_pos(&self, x: i32, y: i32) -> i32 {
2001 unsafe { ffi::gtk_entry_get_icon_at_pos(self.as_ref().to_glib_none().0, x, y) }
2002 }
2003
2004 /// Retrieves the `GIcon` used for the icon.
2005 ///
2006 /// [`None`] will be returned if there is no icon or if the icon was
2007 /// set by some other method (e.g., by [`gdk::Paintable`][crate::gdk::Paintable] or icon name).
2008 /// ## `icon_pos`
2009 /// Icon position
2010 ///
2011 /// # Returns
2012 ///
2013 /// A `GIcon`
2014 #[doc(alias = "gtk_entry_get_icon_gicon")]
2015 #[doc(alias = "get_icon_gicon")]
2016 fn icon_gicon(&self, icon_pos: EntryIconPosition) -> Option<gio::Icon> {
2017 unsafe {
2018 from_glib_none(ffi::gtk_entry_get_icon_gicon(
2019 self.as_ref().to_glib_none().0,
2020 icon_pos.into_glib(),
2021 ))
2022 }
2023 }
2024
2025 /// Retrieves the icon name used for the icon.
2026 ///
2027 /// [`None`] is returned if there is no icon or if the icon was set
2028 /// by some other method (e.g., by [`gdk::Paintable`][crate::gdk::Paintable] or gicon).
2029 /// ## `icon_pos`
2030 /// Icon position
2031 ///
2032 /// # Returns
2033 ///
2034 /// An icon name
2035 #[doc(alias = "gtk_entry_get_icon_name")]
2036 #[doc(alias = "get_icon_name")]
2037 fn icon_name(&self, icon_pos: EntryIconPosition) -> Option<glib::GString> {
2038 unsafe {
2039 from_glib_none(ffi::gtk_entry_get_icon_name(
2040 self.as_ref().to_glib_none().0,
2041 icon_pos.into_glib(),
2042 ))
2043 }
2044 }
2045
2046 /// Retrieves the [`gdk::Paintable`][crate::gdk::Paintable] used for the icon.
2047 ///
2048 /// If no [`gdk::Paintable`][crate::gdk::Paintable] was used for the icon, [`None`] is returned.
2049 /// ## `icon_pos`
2050 /// Icon position
2051 ///
2052 /// # Returns
2053 ///
2054 /// A [`gdk::Paintable`][crate::gdk::Paintable]
2055 /// if no icon is set for this position or the icon set is not
2056 /// a [`gdk::Paintable`][crate::gdk::Paintable].
2057 #[doc(alias = "gtk_entry_get_icon_paintable")]
2058 #[doc(alias = "get_icon_paintable")]
2059 fn icon_paintable(&self, icon_pos: EntryIconPosition) -> Option<gdk::Paintable> {
2060 unsafe {
2061 from_glib_none(ffi::gtk_entry_get_icon_paintable(
2062 self.as_ref().to_glib_none().0,
2063 icon_pos.into_glib(),
2064 ))
2065 }
2066 }
2067
2068 /// Returns whether the icon appears sensitive or insensitive.
2069 /// ## `icon_pos`
2070 /// Icon position
2071 ///
2072 /// # Returns
2073 ///
2074 /// [`true`] if the icon is sensitive.
2075 #[doc(alias = "gtk_entry_get_icon_sensitive")]
2076 #[doc(alias = "get_icon_sensitive")]
2077 fn icon_is_sensitive(&self, icon_pos: EntryIconPosition) -> bool {
2078 unsafe {
2079 from_glib(ffi::gtk_entry_get_icon_sensitive(
2080 self.as_ref().to_glib_none().0,
2081 icon_pos.into_glib(),
2082 ))
2083 }
2084 }
2085
2086 /// Gets the type of representation being used by the icon
2087 /// to store image data.
2088 ///
2089 /// If the icon has no image data, the return value will
2090 /// be [`ImageType::Empty`][crate::ImageType::Empty].
2091 /// ## `icon_pos`
2092 /// Icon position
2093 ///
2094 /// # Returns
2095 ///
2096 /// image representation being used
2097 #[doc(alias = "gtk_entry_get_icon_storage_type")]
2098 #[doc(alias = "get_icon_storage_type")]
2099 fn icon_storage_type(&self, icon_pos: EntryIconPosition) -> ImageType {
2100 unsafe {
2101 from_glib(ffi::gtk_entry_get_icon_storage_type(
2102 self.as_ref().to_glib_none().0,
2103 icon_pos.into_glib(),
2104 ))
2105 }
2106 }
2107
2108 /// Gets the contents of the tooltip on the icon at the specified
2109 /// position in @self.
2110 /// ## `icon_pos`
2111 /// the icon position
2112 ///
2113 /// # Returns
2114 ///
2115 /// the tooltip text
2116 #[doc(alias = "gtk_entry_get_icon_tooltip_markup")]
2117 #[doc(alias = "get_icon_tooltip_markup")]
2118 fn icon_tooltip_markup(&self, icon_pos: EntryIconPosition) -> Option<glib::GString> {
2119 unsafe {
2120 from_glib_full(ffi::gtk_entry_get_icon_tooltip_markup(
2121 self.as_ref().to_glib_none().0,
2122 icon_pos.into_glib(),
2123 ))
2124 }
2125 }
2126
2127 /// Gets the contents of the tooltip on the icon at the specified
2128 /// position in @self.
2129 /// ## `icon_pos`
2130 /// the icon position
2131 ///
2132 /// # Returns
2133 ///
2134 /// the tooltip text
2135 #[doc(alias = "gtk_entry_get_icon_tooltip_text")]
2136 #[doc(alias = "get_icon_tooltip_text")]
2137 fn icon_tooltip_text(&self, icon_pos: EntryIconPosition) -> Option<glib::GString> {
2138 unsafe {
2139 from_glib_full(ffi::gtk_entry_get_icon_tooltip_text(
2140 self.as_ref().to_glib_none().0,
2141 icon_pos.into_glib(),
2142 ))
2143 }
2144 }
2145
2146 /// Gets the input hints of this [`Entry`][crate::Entry].
2147 ///
2148 /// # Returns
2149 ///
2150 /// the input hints
2151 #[doc(alias = "gtk_entry_get_input_hints")]
2152 #[doc(alias = "get_input_hints")]
2153 #[doc(alias = "input-hints")]
2154 fn input_hints(&self) -> InputHints {
2155 unsafe {
2156 from_glib(ffi::gtk_entry_get_input_hints(
2157 self.as_ref().to_glib_none().0,
2158 ))
2159 }
2160 }
2161
2162 /// Gets the input purpose of the [`Entry`][crate::Entry].
2163 ///
2164 /// # Returns
2165 ///
2166 /// the input purpose
2167 #[doc(alias = "gtk_entry_get_input_purpose")]
2168 #[doc(alias = "get_input_purpose")]
2169 #[doc(alias = "input-purpose")]
2170 fn input_purpose(&self) -> InputPurpose {
2171 unsafe {
2172 from_glib(ffi::gtk_entry_get_input_purpose(
2173 self.as_ref().to_glib_none().0,
2174 ))
2175 }
2176 }
2177
2178 /// Retrieves the maximum allowed length of the text in @self.
2179 ///
2180 /// See [`set_max_length()`][Self::set_max_length()].
2181 ///
2182 /// # Returns
2183 ///
2184 /// the maximum allowed number of characters
2185 /// in [`Entry`][crate::Entry], or 0 if there is no maximum.
2186 #[doc(alias = "gtk_entry_get_max_length")]
2187 #[doc(alias = "get_max_length")]
2188 #[doc(alias = "max-length")]
2189 fn max_length(&self) -> i32 {
2190 unsafe { ffi::gtk_entry_get_max_length(self.as_ref().to_glib_none().0) }
2191 }
2192
2193 /// Gets whether the [`Entry`][crate::Entry] is in overwrite mode.
2194 ///
2195 /// # Returns
2196 ///
2197 /// whether the text is overwritten when typing.
2198 #[doc(alias = "gtk_entry_get_overwrite_mode")]
2199 #[doc(alias = "get_overwrite_mode")]
2200 #[doc(alias = "overwrite-mode")]
2201 fn is_overwrite_mode(&self) -> bool {
2202 unsafe {
2203 from_glib(ffi::gtk_entry_get_overwrite_mode(
2204 self.as_ref().to_glib_none().0,
2205 ))
2206 }
2207 }
2208
2209 /// Retrieves the text that will be displayed when @self
2210 /// is empty and unfocused
2211 ///
2212 /// # Returns
2213 ///
2214 /// a pointer to the
2215 /// placeholder text as a string. This string points to
2216 /// internally allocated storage in the widget and must
2217 /// not be freed, modified or stored. If no placeholder
2218 /// text has been set, [`None`] will be returned.
2219 #[doc(alias = "gtk_entry_get_placeholder_text")]
2220 #[doc(alias = "get_placeholder_text")]
2221 #[doc(alias = "placeholder-text")]
2222 fn placeholder_text(&self) -> Option<glib::GString> {
2223 unsafe {
2224 from_glib_none(ffi::gtk_entry_get_placeholder_text(
2225 self.as_ref().to_glib_none().0,
2226 ))
2227 }
2228 }
2229
2230 /// Returns the current fraction of the task that’s been completed.
2231 ///
2232 /// See [`set_progress_fraction()`][Self::set_progress_fraction()].
2233 ///
2234 /// # Returns
2235 ///
2236 /// a fraction from 0.0 to 1.0
2237 #[doc(alias = "gtk_entry_get_progress_fraction")]
2238 #[doc(alias = "get_progress_fraction")]
2239 #[doc(alias = "progress-fraction")]
2240 fn progress_fraction(&self) -> f64 {
2241 unsafe { ffi::gtk_entry_get_progress_fraction(self.as_ref().to_glib_none().0) }
2242 }
2243
2244 /// Retrieves the pulse step set with
2245 /// gtk_entry_set_progress_pulse_step().
2246 ///
2247 /// # Returns
2248 ///
2249 /// a fraction from 0.0 to 1.0
2250 #[doc(alias = "gtk_entry_get_progress_pulse_step")]
2251 #[doc(alias = "get_progress_pulse_step")]
2252 #[doc(alias = "progress-pulse-step")]
2253 fn progress_pulse_step(&self) -> f64 {
2254 unsafe { ffi::gtk_entry_get_progress_pulse_step(self.as_ref().to_glib_none().0) }
2255 }
2256
2257 /// Gets the tabstops of the [`Entry`][crate::Entry].
2258 ///
2259 /// See [`set_tabs()`][Self::set_tabs()].
2260 ///
2261 /// # Returns
2262 ///
2263 /// the tabstops
2264 #[doc(alias = "gtk_entry_get_tabs")]
2265 #[doc(alias = "get_tabs")]
2266 fn tabs(&self) -> Option<pango::TabArray> {
2267 unsafe { from_glib_none(ffi::gtk_entry_get_tabs(self.as_ref().to_glib_none().0)) }
2268 }
2269
2270 /// Retrieves the current length of the text in @self.
2271 ///
2272 /// This is equivalent to getting @self's [`EntryBuffer`][crate::EntryBuffer]
2273 /// and calling [`EntryBufferExtManual::length()`][crate::prelude::EntryBufferExtManual::length()] on it.
2274 ///
2275 /// # Returns
2276 ///
2277 /// the current number of characters
2278 /// in [`Entry`][crate::Entry], or 0 if there are none.
2279 #[doc(alias = "gtk_entry_get_text_length")]
2280 #[doc(alias = "get_text_length")]
2281 #[doc(alias = "text-length")]
2282 fn text_length(&self) -> u16 {
2283 unsafe { ffi::gtk_entry_get_text_length(self.as_ref().to_glib_none().0) }
2284 }
2285
2286 /// Retrieves whether the text in @self is visible.
2287 ///
2288 /// See [`set_visibility()`][Self::set_visibility()].
2289 ///
2290 /// # Returns
2291 ///
2292 /// [`true`] if the text is currently visible
2293 #[doc(alias = "gtk_entry_get_visibility")]
2294 #[doc(alias = "get_visibility")]
2295 #[doc(alias = "visibility")]
2296 fn is_visible(&self) -> bool {
2297 unsafe {
2298 from_glib(ffi::gtk_entry_get_visibility(
2299 self.as_ref().to_glib_none().0,
2300 ))
2301 }
2302 }
2303
2304 /// Causes @self to have keyboard focus.
2305 ///
2306 /// It behaves like [`WidgetExt::grab_focus()`][crate::prelude::WidgetExt::grab_focus()], except that it doesn't
2307 /// select the contents of the entry. You only want to call this on some
2308 /// special entries which the user usually doesn't want to replace all text
2309 /// in, such as search-as-you-type entries.
2310 ///
2311 /// # Returns
2312 ///
2313 /// [`true`] if focus is now inside @self_
2314 #[doc(alias = "gtk_entry_grab_focus_without_selecting")]
2315 fn grab_focus_without_selecting(&self) -> bool {
2316 unsafe {
2317 from_glib(ffi::gtk_entry_grab_focus_without_selecting(
2318 self.as_ref().to_glib_none().0,
2319 ))
2320 }
2321 }
2322
2323 /// Indicates that some progress is made, but you don’t
2324 /// know how much.
2325 ///
2326 /// Causes the entry’s progress indicator to enter “activity
2327 /// mode”, where a block bounces back and forth. Each call to
2328 /// gtk_entry_progress_pulse() causes the block to move by a
2329 /// little bit (the amount of movement per pulse is determined
2330 /// by [`set_progress_pulse_step()`][Self::set_progress_pulse_step()]).
2331 #[doc(alias = "gtk_entry_progress_pulse")]
2332 fn progress_pulse(&self) {
2333 unsafe {
2334 ffi::gtk_entry_progress_pulse(self.as_ref().to_glib_none().0);
2335 }
2336 }
2337
2338 /// Reset the input method context of the entry if needed.
2339 ///
2340 /// This can be necessary in the case where modifying the buffer
2341 /// would confuse on-going input method behavior.
2342 #[doc(alias = "gtk_entry_reset_im_context")]
2343 fn reset_im_context(&self) {
2344 unsafe {
2345 ffi::gtk_entry_reset_im_context(self.as_ref().to_glib_none().0);
2346 }
2347 }
2348
2349 /// Sets whether pressing Enter in the @self will activate the default
2350 /// widget for the window containing the entry.
2351 ///
2352 /// This usually means that the dialog containing the entry will be closed,
2353 /// since the default widget is usually one of the dialog buttons.
2354 /// ## `setting`
2355 /// [`true`] to activate window’s default widget on Enter keypress
2356 #[doc(alias = "gtk_entry_set_activates_default")]
2357 #[doc(alias = "activates-default")]
2358 fn set_activates_default(&self, setting: bool) {
2359 unsafe {
2360 ffi::gtk_entry_set_activates_default(
2361 self.as_ref().to_glib_none().0,
2362 setting.into_glib(),
2363 );
2364 }
2365 }
2366
2367 /// Sets the alignment for the contents of the entry.
2368 ///
2369 /// This controls the horizontal positioning of the contents when
2370 /// the displayed text is shorter than the width of the entry.
2371 ///
2372 /// See also: [`xalign`][struct@crate::Editable#xalign]
2373 /// ## `xalign`
2374 /// The horizontal alignment, from 0 (left) to 1 (right).
2375 /// Reversed for RTL layouts
2376 #[doc(alias = "gtk_entry_set_alignment")]
2377 fn set_alignment(&self, xalign: f32) {
2378 unsafe {
2379 ffi::gtk_entry_set_alignment(self.as_ref().to_glib_none().0, xalign);
2380 }
2381 }
2382
2383 /// Sets a [`pango::AttrList`][crate::pango::AttrList].
2384 ///
2385 /// The attributes in the list are applied to the entry text.
2386 ///
2387 /// Since the attributes will be applied to text that changes
2388 /// as the user types, it makes most sense to use attributes
2389 /// with unlimited extent.
2390 /// ## `attrs`
2391 /// a [`pango::AttrList`][crate::pango::AttrList]
2392 #[doc(alias = "gtk_entry_set_attributes")]
2393 #[doc(alias = "attributes")]
2394 fn set_attributes(&self, attrs: &pango::AttrList) {
2395 unsafe {
2396 ffi::gtk_entry_set_attributes(self.as_ref().to_glib_none().0, attrs.to_glib_none().0);
2397 }
2398 }
2399
2400 /// Set the [`EntryBuffer`][crate::EntryBuffer] object which holds the text for
2401 /// this widget.
2402 /// ## `buffer`
2403 /// a [`EntryBuffer`][crate::EntryBuffer]
2404 #[doc(alias = "gtk_entry_set_buffer")]
2405 #[doc(alias = "buffer")]
2406 fn set_buffer(&self, buffer: &impl IsA<EntryBuffer>) {
2407 unsafe {
2408 ffi::gtk_entry_set_buffer(
2409 self.as_ref().to_glib_none().0,
2410 buffer.as_ref().to_glib_none().0,
2411 );
2412 }
2413 }
2414
2415 /// Sets @completion to be the auxiliary completion object
2416 /// to use with @self.
2417 ///
2418 /// All further configuration of the completion mechanism is
2419 /// done on @completion using the [`EntryCompletion`][crate::EntryCompletion] API.
2420 /// Completion is disabled if @completion is set to [`None`].
2421 ///
2422 /// # Deprecated since 4.10
2423 ///
2424 /// GtkEntryCompletion will be removed in GTK 5.
2425 /// ## `completion`
2426 /// The [`EntryCompletion`][crate::EntryCompletion]
2427 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2428 #[allow(deprecated)]
2429 #[doc(alias = "gtk_entry_set_completion")]
2430 #[doc(alias = "completion")]
2431 fn set_completion(&self, completion: Option<&EntryCompletion>) {
2432 unsafe {
2433 ffi::gtk_entry_set_completion(
2434 self.as_ref().to_glib_none().0,
2435 completion.to_glib_none().0,
2436 );
2437 }
2438 }
2439
2440 /// Sets a menu model to add when constructing
2441 /// the context menu for @self.
2442 /// ## `model`
2443 /// a `GMenuModel`
2444 #[doc(alias = "gtk_entry_set_extra_menu")]
2445 #[doc(alias = "extra-menu")]
2446 fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
2447 unsafe {
2448 ffi::gtk_entry_set_extra_menu(
2449 self.as_ref().to_glib_none().0,
2450 model.map(|p| p.as_ref()).to_glib_none().0,
2451 );
2452 }
2453 }
2454
2455 /// Sets whether the entry has a beveled frame around it.
2456 /// ## `setting`
2457 /// new value
2458 #[doc(alias = "gtk_entry_set_has_frame")]
2459 #[doc(alias = "has-frame")]
2460 fn set_has_frame(&self, setting: bool) {
2461 unsafe {
2462 ffi::gtk_entry_set_has_frame(self.as_ref().to_glib_none().0, setting.into_glib());
2463 }
2464 }
2465
2466 /// Sets whether the icon is activatable.
2467 /// ## `icon_pos`
2468 /// Icon position
2469 /// ## `activatable`
2470 /// [`true`] if the icon should be activatable
2471 #[doc(alias = "gtk_entry_set_icon_activatable")]
2472 fn set_icon_activatable(&self, icon_pos: EntryIconPosition, activatable: bool) {
2473 unsafe {
2474 ffi::gtk_entry_set_icon_activatable(
2475 self.as_ref().to_glib_none().0,
2476 icon_pos.into_glib(),
2477 activatable.into_glib(),
2478 );
2479 }
2480 }
2481
2482 /// Sets up the icon at the given position as drag source.
2483 ///
2484 /// This makes it so that GTK will start a drag
2485 /// operation when the user clicks and drags the icon.
2486 /// ## `icon_pos`
2487 /// icon position
2488 /// ## `provider`
2489 /// a [`gdk::ContentProvider`][crate::gdk::ContentProvider]
2490 /// ## `actions`
2491 /// a bitmask of the allowed drag actions
2492 #[doc(alias = "gtk_entry_set_icon_drag_source")]
2493 fn set_icon_drag_source(
2494 &self,
2495 icon_pos: EntryIconPosition,
2496 provider: &impl IsA<gdk::ContentProvider>,
2497 actions: gdk::DragAction,
2498 ) {
2499 unsafe {
2500 ffi::gtk_entry_set_icon_drag_source(
2501 self.as_ref().to_glib_none().0,
2502 icon_pos.into_glib(),
2503 provider.as_ref().to_glib_none().0,
2504 actions.into_glib(),
2505 );
2506 }
2507 }
2508
2509 /// Sets the icon shown in the entry at the specified position
2510 /// from the current icon theme.
2511 ///
2512 /// If the icon isn’t known, a “broken image” icon will be
2513 /// displayed instead.
2514 ///
2515 /// If @icon is [`None`], no icon will be shown in the
2516 /// specified position.
2517 /// ## `icon_pos`
2518 /// The position at which to set the icon
2519 /// ## `icon`
2520 /// The icon to set
2521 #[doc(alias = "gtk_entry_set_icon_from_gicon")]
2522 fn set_icon_from_gicon(&self, icon_pos: EntryIconPosition, icon: Option<&impl IsA<gio::Icon>>) {
2523 unsafe {
2524 ffi::gtk_entry_set_icon_from_gicon(
2525 self.as_ref().to_glib_none().0,
2526 icon_pos.into_glib(),
2527 icon.map(|p| p.as_ref()).to_glib_none().0,
2528 );
2529 }
2530 }
2531
2532 /// Sets the icon shown in the entry at the specified position
2533 /// from the current icon theme.
2534 ///
2535 /// If the icon name isn’t known, a “broken image” icon will be
2536 /// displayed instead.
2537 ///
2538 /// If @icon_name is [`None`], no icon will be shown in the
2539 /// specified position.
2540 /// ## `icon_pos`
2541 /// The position at which to set the icon
2542 /// ## `icon_name`
2543 /// An icon name
2544 #[doc(alias = "gtk_entry_set_icon_from_icon_name")]
2545 fn set_icon_from_icon_name(&self, icon_pos: EntryIconPosition, icon_name: Option<&str>) {
2546 unsafe {
2547 ffi::gtk_entry_set_icon_from_icon_name(
2548 self.as_ref().to_glib_none().0,
2549 icon_pos.into_glib(),
2550 icon_name.to_glib_none().0,
2551 );
2552 }
2553 }
2554
2555 /// Sets the icon shown in the specified position using a [`gdk::Paintable`][crate::gdk::Paintable].
2556 ///
2557 /// If @paintable is [`None`], no icon will be shown in the specified position.
2558 /// ## `icon_pos`
2559 /// Icon position
2560 /// ## `paintable`
2561 /// A [`gdk::Paintable`][crate::gdk::Paintable]
2562 #[doc(alias = "gtk_entry_set_icon_from_paintable")]
2563 fn set_icon_from_paintable(
2564 &self,
2565 icon_pos: EntryIconPosition,
2566 paintable: Option<&impl IsA<gdk::Paintable>>,
2567 ) {
2568 unsafe {
2569 ffi::gtk_entry_set_icon_from_paintable(
2570 self.as_ref().to_glib_none().0,
2571 icon_pos.into_glib(),
2572 paintable.map(|p| p.as_ref()).to_glib_none().0,
2573 );
2574 }
2575 }
2576
2577 /// Sets the sensitivity for the specified icon.
2578 /// ## `icon_pos`
2579 /// Icon position
2580 /// ## `sensitive`
2581 /// Specifies whether the icon should appear
2582 /// sensitive or insensitive
2583 #[doc(alias = "gtk_entry_set_icon_sensitive")]
2584 fn set_icon_sensitive(&self, icon_pos: EntryIconPosition, sensitive: bool) {
2585 unsafe {
2586 ffi::gtk_entry_set_icon_sensitive(
2587 self.as_ref().to_glib_none().0,
2588 icon_pos.into_glib(),
2589 sensitive.into_glib(),
2590 );
2591 }
2592 }
2593
2594 /// Sets @tooltip as the contents of the tooltip for the icon at
2595 /// the specified position.
2596 ///
2597 /// @tooltip is assumed to be marked up with Pango Markup.
2598 ///
2599 /// Use [`None`] for @tooltip to remove an existing tooltip.
2600 ///
2601 /// See also [`WidgetExt::set_tooltip_markup()`][crate::prelude::WidgetExt::set_tooltip_markup()] and
2602 /// [`set_icon_tooltip_text()`][Self::set_icon_tooltip_text()].
2603 /// ## `icon_pos`
2604 /// the icon position
2605 /// ## `tooltip`
2606 /// the contents of the tooltip for the icon
2607 #[doc(alias = "gtk_entry_set_icon_tooltip_markup")]
2608 fn set_icon_tooltip_markup(&self, icon_pos: EntryIconPosition, tooltip: Option<&str>) {
2609 unsafe {
2610 ffi::gtk_entry_set_icon_tooltip_markup(
2611 self.as_ref().to_glib_none().0,
2612 icon_pos.into_glib(),
2613 tooltip.to_glib_none().0,
2614 );
2615 }
2616 }
2617
2618 /// Sets @tooltip as the contents of the tooltip for the icon
2619 /// at the specified position.
2620 ///
2621 /// Use [`None`] for @tooltip to remove an existing tooltip.
2622 ///
2623 /// See also [`WidgetExt::set_tooltip_text()`][crate::prelude::WidgetExt::set_tooltip_text()] and
2624 /// [`set_icon_tooltip_markup()`][Self::set_icon_tooltip_markup()].
2625 ///
2626 /// If you unset the widget tooltip via
2627 /// [`WidgetExt::set_tooltip_text()`][crate::prelude::WidgetExt::set_tooltip_text()] or
2628 /// [`WidgetExt::set_tooltip_markup()`][crate::prelude::WidgetExt::set_tooltip_markup()], this sets
2629 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] to [`false`], which suppresses
2630 /// icon tooltips too. You can resolve this by then calling
2631 /// [`WidgetExt::set_has_tooltip()`][crate::prelude::WidgetExt::set_has_tooltip()] to set
2632 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] back to [`true`], or
2633 /// setting at least one non-empty tooltip on any icon
2634 /// achieves the same result.
2635 /// ## `icon_pos`
2636 /// the icon position
2637 /// ## `tooltip`
2638 /// the contents of the tooltip for the icon
2639 #[doc(alias = "gtk_entry_set_icon_tooltip_text")]
2640 fn set_icon_tooltip_text(&self, icon_pos: EntryIconPosition, tooltip: Option<&str>) {
2641 unsafe {
2642 ffi::gtk_entry_set_icon_tooltip_text(
2643 self.as_ref().to_glib_none().0,
2644 icon_pos.into_glib(),
2645 tooltip.to_glib_none().0,
2646 );
2647 }
2648 }
2649
2650 /// Set additional hints which allow input methods to
2651 /// fine-tune their behavior.
2652 /// ## `hints`
2653 /// the hints
2654 #[doc(alias = "gtk_entry_set_input_hints")]
2655 #[doc(alias = "input-hints")]
2656 fn set_input_hints(&self, hints: InputHints) {
2657 unsafe {
2658 ffi::gtk_entry_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
2659 }
2660 }
2661
2662 /// Sets the input purpose which can be used by input methods
2663 /// to adjust their behavior.
2664 /// ## `purpose`
2665 /// the purpose
2666 #[doc(alias = "gtk_entry_set_input_purpose")]
2667 #[doc(alias = "input-purpose")]
2668 fn set_input_purpose(&self, purpose: InputPurpose) {
2669 unsafe {
2670 ffi::gtk_entry_set_input_purpose(self.as_ref().to_glib_none().0, purpose.into_glib());
2671 }
2672 }
2673
2674 /// Sets the character to use in place of the actual text
2675 /// in “password mode”.
2676 ///
2677 /// See [`set_visibility()`][Self::set_visibility()] for how to enable
2678 /// “password mode”.
2679 ///
2680 /// By default, GTK picks the best invisible char available in
2681 /// the current font. If you set the invisible char to 0, then
2682 /// the user will get no feedback at all; there will be no text
2683 /// on the screen as they type.
2684 /// ## `ch`
2685 /// a Unicode character
2686 #[doc(alias = "gtk_entry_set_invisible_char")]
2687 #[doc(alias = "invisible-char")]
2688 fn set_invisible_char(&self, ch: Option<char>) {
2689 unsafe {
2690 ffi::gtk_entry_set_invisible_char(self.as_ref().to_glib_none().0, ch.into_glib());
2691 }
2692 }
2693
2694 /// Sets the maximum allowed length of the contents of the widget.
2695 ///
2696 /// If the current contents are longer than the given length, then
2697 /// they will be truncated to fit. The length is in characters.
2698 ///
2699 /// This is equivalent to getting @self's [`EntryBuffer`][crate::EntryBuffer] and
2700 /// calling [`EntryBufferExtManual::set_max_length()`][crate::prelude::EntryBufferExtManual::set_max_length()] on it.
2701 /// ## `max`
2702 /// the maximum length of the entry, or 0 for no maximum.
2703 /// (other than the maximum length of entries.) The value passed in will
2704 /// be clamped to the range 0-65536.
2705 #[doc(alias = "gtk_entry_set_max_length")]
2706 #[doc(alias = "max-length")]
2707 fn set_max_length(&self, max: i32) {
2708 unsafe {
2709 ffi::gtk_entry_set_max_length(self.as_ref().to_glib_none().0, max);
2710 }
2711 }
2712
2713 /// Sets whether the text is overwritten when typing in the [`Entry`][crate::Entry].
2714 /// ## `overwrite`
2715 /// new value
2716 #[doc(alias = "gtk_entry_set_overwrite_mode")]
2717 #[doc(alias = "overwrite-mode")]
2718 fn set_overwrite_mode(&self, overwrite: bool) {
2719 unsafe {
2720 ffi::gtk_entry_set_overwrite_mode(
2721 self.as_ref().to_glib_none().0,
2722 overwrite.into_glib(),
2723 );
2724 }
2725 }
2726
2727 /// Sets text to be displayed in @self when it is empty.
2728 ///
2729 /// This can be used to give a visual hint of the expected
2730 /// contents of the [`Entry`][crate::Entry].
2731 /// ## `text`
2732 /// a string to be displayed when @self is empty and unfocused
2733 #[doc(alias = "gtk_entry_set_placeholder_text")]
2734 #[doc(alias = "placeholder-text")]
2735 fn set_placeholder_text(&self, text: Option<&str>) {
2736 unsafe {
2737 ffi::gtk_entry_set_placeholder_text(
2738 self.as_ref().to_glib_none().0,
2739 text.to_glib_none().0,
2740 );
2741 }
2742 }
2743
2744 /// Causes the entry’s progress indicator to “fill in” the given
2745 /// fraction of the bar.
2746 ///
2747 /// The fraction should be between 0.0 and 1.0, inclusive.
2748 /// ## `fraction`
2749 /// fraction of the task that’s been completed
2750 #[doc(alias = "gtk_entry_set_progress_fraction")]
2751 #[doc(alias = "progress-fraction")]
2752 fn set_progress_fraction(&self, fraction: f64) {
2753 unsafe {
2754 ffi::gtk_entry_set_progress_fraction(self.as_ref().to_glib_none().0, fraction);
2755 }
2756 }
2757
2758 /// Sets the fraction of total entry width to move the progress
2759 /// bouncing block for each pulse.
2760 ///
2761 /// Use [`progress_pulse()`][Self::progress_pulse()] to pulse
2762 /// the progress.
2763 /// ## `fraction`
2764 /// fraction between 0.0 and 1.0
2765 #[doc(alias = "gtk_entry_set_progress_pulse_step")]
2766 #[doc(alias = "progress-pulse-step")]
2767 fn set_progress_pulse_step(&self, fraction: f64) {
2768 unsafe {
2769 ffi::gtk_entry_set_progress_pulse_step(self.as_ref().to_glib_none().0, fraction);
2770 }
2771 }
2772
2773 /// Sets a [`pango::TabArray`][crate::pango::TabArray].
2774 ///
2775 /// The tabstops in the array are applied to the entry text.
2776 /// ## `tabs`
2777 /// a [`pango::TabArray`][crate::pango::TabArray]
2778 #[doc(alias = "gtk_entry_set_tabs")]
2779 #[doc(alias = "tabs")]
2780 fn set_tabs(&self, tabs: Option<&pango::TabArray>) {
2781 unsafe {
2782 ffi::gtk_entry_set_tabs(
2783 self.as_ref().to_glib_none().0,
2784 mut_override(tabs.to_glib_none().0),
2785 );
2786 }
2787 }
2788
2789 /// Sets whether the contents of the entry are visible or not.
2790 ///
2791 /// When visibility is set to [`false`], characters are displayed
2792 /// as the invisible char, and will also appear that way when
2793 /// the text in the entry widget is copied elsewhere.
2794 ///
2795 /// By default, GTK picks the best invisible character available
2796 /// in the current font, but it can be changed with
2797 /// [`set_invisible_char()`][Self::set_invisible_char()].
2798 ///
2799 /// Note that you probably want to set [`input-purpose`][struct@crate::Entry#input-purpose]
2800 /// to [`InputPurpose::Password`][crate::InputPurpose::Password] or [`InputPurpose::Pin`][crate::InputPurpose::Pin] to
2801 /// inform input methods about the purpose of this entry,
2802 /// in addition to setting visibility to [`false`].
2803 /// ## `visible`
2804 /// [`true`] if the contents of the entry are displayed as plaintext
2805 #[doc(alias = "gtk_entry_set_visibility")]
2806 #[doc(alias = "visibility")]
2807 fn set_visibility(&self, visible: bool) {
2808 unsafe {
2809 ffi::gtk_entry_set_visibility(self.as_ref().to_glib_none().0, visible.into_glib());
2810 }
2811 }
2812
2813 /// Unsets the invisible char, so that the default invisible char
2814 /// is used again. See [`set_invisible_char()`][Self::set_invisible_char()].
2815 #[doc(alias = "gtk_entry_unset_invisible_char")]
2816 fn unset_invisible_char(&self) {
2817 unsafe {
2818 ffi::gtk_entry_unset_invisible_char(self.as_ref().to_glib_none().0);
2819 }
2820 }
2821
2822 /// Whether to suggest Emoji replacements for :-delimited names
2823 /// like `:heart:`.
2824 #[doc(alias = "enable-emoji-completion")]
2825 fn enables_emoji_completion(&self) -> bool {
2826 ObjectExt::property(self.as_ref(), "enable-emoji-completion")
2827 }
2828
2829 /// Whether to suggest Emoji replacements for :-delimited names
2830 /// like `:heart:`.
2831 #[doc(alias = "enable-emoji-completion")]
2832 fn set_enable_emoji_completion(&self, enable_emoji_completion: bool) {
2833 ObjectExt::set_property(
2834 self.as_ref(),
2835 "enable-emoji-completion",
2836 enable_emoji_completion,
2837 )
2838 }
2839
2840 /// Which IM (input method) module should be used for this entry.
2841 ///
2842 /// See [`IMContext`][crate::IMContext].
2843 ///
2844 /// Setting this to a non-[`None`] value overrides the system-wide IM
2845 /// module setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module]
2846 /// property.
2847 #[doc(alias = "im-module")]
2848 fn im_module(&self) -> Option<glib::GString> {
2849 ObjectExt::property(self.as_ref(), "im-module")
2850 }
2851
2852 /// Which IM (input method) module should be used for this entry.
2853 ///
2854 /// See [`IMContext`][crate::IMContext].
2855 ///
2856 /// Setting this to a non-[`None`] value overrides the system-wide IM
2857 /// module setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module]
2858 /// property.
2859 #[doc(alias = "im-module")]
2860 fn set_im_module(&self, im_module: Option<&str>) {
2861 ObjectExt::set_property(self.as_ref(), "im-module", im_module)
2862 }
2863
2864 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
2865 #[doc(alias = "invisible-char-set")]
2866 fn is_invisible_char_set(&self) -> bool {
2867 ObjectExt::property(self.as_ref(), "invisible-char-set")
2868 }
2869
2870 /// Whether the primary icon is activatable.
2871 ///
2872 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
2873 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
2874 /// activatable icons.
2875 ///
2876 /// Sensitive, but non-activatable icons can be used for purely
2877 /// informational purposes.
2878 #[doc(alias = "primary-icon-activatable")]
2879 fn is_primary_icon_activatable(&self) -> bool {
2880 ObjectExt::property(self.as_ref(), "primary-icon-activatable")
2881 }
2882
2883 /// Whether the primary icon is activatable.
2884 ///
2885 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
2886 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
2887 /// activatable icons.
2888 ///
2889 /// Sensitive, but non-activatable icons can be used for purely
2890 /// informational purposes.
2891 #[doc(alias = "primary-icon-activatable")]
2892 fn set_primary_icon_activatable(&self, primary_icon_activatable: bool) {
2893 ObjectExt::set_property(
2894 self.as_ref(),
2895 "primary-icon-activatable",
2896 primary_icon_activatable,
2897 )
2898 }
2899
2900 /// The `GIcon` to use for the primary icon for the entry.
2901 #[doc(alias = "primary-icon-gicon")]
2902 fn primary_icon_gicon(&self) -> Option<gio::Icon> {
2903 ObjectExt::property(self.as_ref(), "primary-icon-gicon")
2904 }
2905
2906 /// The `GIcon` to use for the primary icon for the entry.
2907 #[doc(alias = "primary-icon-gicon")]
2908 fn set_primary_icon_gicon<P: IsA<gio::Icon>>(&self, primary_icon_gicon: Option<&P>) {
2909 ObjectExt::set_property(self.as_ref(), "primary-icon-gicon", primary_icon_gicon)
2910 }
2911
2912 /// The icon name to use for the primary icon for the entry.
2913 #[doc(alias = "primary-icon-name")]
2914 fn primary_icon_name(&self) -> Option<glib::GString> {
2915 ObjectExt::property(self.as_ref(), "primary-icon-name")
2916 }
2917
2918 /// The icon name to use for the primary icon for the entry.
2919 #[doc(alias = "primary-icon-name")]
2920 fn set_primary_icon_name(&self, primary_icon_name: Option<&str>) {
2921 ObjectExt::set_property(self.as_ref(), "primary-icon-name", primary_icon_name)
2922 }
2923
2924 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the primary icon for the entry.
2925 #[doc(alias = "primary-icon-paintable")]
2926 fn primary_icon_paintable(&self) -> Option<gdk::Paintable> {
2927 ObjectExt::property(self.as_ref(), "primary-icon-paintable")
2928 }
2929
2930 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the primary icon for the entry.
2931 #[doc(alias = "primary-icon-paintable")]
2932 fn set_primary_icon_paintable<P: IsA<gdk::Paintable>>(
2933 &self,
2934 primary_icon_paintable: Option<&P>,
2935 ) {
2936 ObjectExt::set_property(
2937 self.as_ref(),
2938 "primary-icon-paintable",
2939 primary_icon_paintable,
2940 )
2941 }
2942
2943 /// Whether the primary icon is sensitive.
2944 ///
2945 /// An insensitive icon appears grayed out. GTK does not emit the
2946 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
2947 /// signals and does not allow DND from insensitive icons.
2948 ///
2949 /// An icon should be set insensitive if the action that would trigger
2950 /// when clicked is currently not available.
2951 #[doc(alias = "primary-icon-sensitive")]
2952 fn is_primary_icon_sensitive(&self) -> bool {
2953 ObjectExt::property(self.as_ref(), "primary-icon-sensitive")
2954 }
2955
2956 /// Whether the primary icon is sensitive.
2957 ///
2958 /// An insensitive icon appears grayed out. GTK does not emit the
2959 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
2960 /// signals and does not allow DND from insensitive icons.
2961 ///
2962 /// An icon should be set insensitive if the action that would trigger
2963 /// when clicked is currently not available.
2964 #[doc(alias = "primary-icon-sensitive")]
2965 fn set_primary_icon_sensitive(&self, primary_icon_sensitive: bool) {
2966 ObjectExt::set_property(
2967 self.as_ref(),
2968 "primary-icon-sensitive",
2969 primary_icon_sensitive,
2970 )
2971 }
2972
2973 /// The representation which is used for the primary icon of the entry.
2974 #[doc(alias = "primary-icon-storage-type")]
2975 fn primary_icon_storage_type(&self) -> ImageType {
2976 ObjectExt::property(self.as_ref(), "primary-icon-storage-type")
2977 }
2978
2979 /// The contents of the tooltip on the primary icon, with markup.
2980 ///
2981 /// Also see [`set_icon_tooltip_markup()`][Self::set_icon_tooltip_markup()].
2982 #[doc(alias = "primary-icon-tooltip-markup")]
2983 fn primary_icon_tooltip_markup(&self) -> Option<glib::GString> {
2984 ObjectExt::property(self.as_ref(), "primary-icon-tooltip-markup")
2985 }
2986
2987 /// The contents of the tooltip on the primary icon, with markup.
2988 ///
2989 /// Also see [`set_icon_tooltip_markup()`][Self::set_icon_tooltip_markup()].
2990 #[doc(alias = "primary-icon-tooltip-markup")]
2991 fn set_primary_icon_tooltip_markup(&self, primary_icon_tooltip_markup: Option<&str>) {
2992 ObjectExt::set_property(
2993 self.as_ref(),
2994 "primary-icon-tooltip-markup",
2995 primary_icon_tooltip_markup,
2996 )
2997 }
2998
2999 /// The contents of the tooltip on the primary icon.
3000 ///
3001 /// Also see [`set_icon_tooltip_text()`][Self::set_icon_tooltip_text()].
3002 #[doc(alias = "primary-icon-tooltip-text")]
3003 fn primary_icon_tooltip_text(&self) -> Option<glib::GString> {
3004 ObjectExt::property(self.as_ref(), "primary-icon-tooltip-text")
3005 }
3006
3007 /// The contents of the tooltip on the primary icon.
3008 ///
3009 /// Also see [`set_icon_tooltip_text()`][Self::set_icon_tooltip_text()].
3010 #[doc(alias = "primary-icon-tooltip-text")]
3011 fn set_primary_icon_tooltip_text(&self, primary_icon_tooltip_text: Option<&str>) {
3012 ObjectExt::set_property(
3013 self.as_ref(),
3014 "primary-icon-tooltip-text",
3015 primary_icon_tooltip_text,
3016 )
3017 }
3018
3019 /// Number of pixels of the entry scrolled off the screen to the left.
3020 #[doc(alias = "scroll-offset")]
3021 fn scroll_offset(&self) -> i32 {
3022 ObjectExt::property(self.as_ref(), "scroll-offset")
3023 }
3024
3025 /// Whether the secondary icon is activatable.
3026 ///
3027 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
3028 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
3029 /// activatable icons.
3030 ///
3031 /// Sensitive, but non-activatable icons can be used for purely
3032 /// informational purposes.
3033 #[doc(alias = "secondary-icon-activatable")]
3034 fn is_secondary_icon_activatable(&self) -> bool {
3035 ObjectExt::property(self.as_ref(), "secondary-icon-activatable")
3036 }
3037
3038 /// Whether the secondary icon is activatable.
3039 ///
3040 /// GTK emits the [`icon-press`][struct@crate::Entry#icon-press] and
3041 /// [`icon-release`][struct@crate::Entry#icon-release] signals only on sensitive,
3042 /// activatable icons.
3043 ///
3044 /// Sensitive, but non-activatable icons can be used for purely
3045 /// informational purposes.
3046 #[doc(alias = "secondary-icon-activatable")]
3047 fn set_secondary_icon_activatable(&self, secondary_icon_activatable: bool) {
3048 ObjectExt::set_property(
3049 self.as_ref(),
3050 "secondary-icon-activatable",
3051 secondary_icon_activatable,
3052 )
3053 }
3054
3055 /// The `GIcon` to use for the secondary icon for the entry.
3056 #[doc(alias = "secondary-icon-gicon")]
3057 fn secondary_icon_gicon(&self) -> Option<gio::Icon> {
3058 ObjectExt::property(self.as_ref(), "secondary-icon-gicon")
3059 }
3060
3061 /// The `GIcon` to use for the secondary icon for the entry.
3062 #[doc(alias = "secondary-icon-gicon")]
3063 fn set_secondary_icon_gicon<P: IsA<gio::Icon>>(&self, secondary_icon_gicon: Option<&P>) {
3064 ObjectExt::set_property(self.as_ref(), "secondary-icon-gicon", secondary_icon_gicon)
3065 }
3066
3067 /// The icon name to use for the secondary icon for the entry.
3068 #[doc(alias = "secondary-icon-name")]
3069 fn secondary_icon_name(&self) -> Option<glib::GString> {
3070 ObjectExt::property(self.as_ref(), "secondary-icon-name")
3071 }
3072
3073 /// The icon name to use for the secondary icon for the entry.
3074 #[doc(alias = "secondary-icon-name")]
3075 fn set_secondary_icon_name(&self, secondary_icon_name: Option<&str>) {
3076 ObjectExt::set_property(self.as_ref(), "secondary-icon-name", secondary_icon_name)
3077 }
3078
3079 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the secondary icon for the entry.
3080 #[doc(alias = "secondary-icon-paintable")]
3081 fn secondary_icon_paintable(&self) -> Option<gdk::Paintable> {
3082 ObjectExt::property(self.as_ref(), "secondary-icon-paintable")
3083 }
3084
3085 /// A [`gdk::Paintable`][crate::gdk::Paintable] to use as the secondary icon for the entry.
3086 #[doc(alias = "secondary-icon-paintable")]
3087 fn set_secondary_icon_paintable<P: IsA<gdk::Paintable>>(
3088 &self,
3089 secondary_icon_paintable: Option<&P>,
3090 ) {
3091 ObjectExt::set_property(
3092 self.as_ref(),
3093 "secondary-icon-paintable",
3094 secondary_icon_paintable,
3095 )
3096 }
3097
3098 /// Whether the secondary icon is sensitive.
3099 ///
3100 /// An insensitive icon appears grayed out. GTK does not emit the
3101 /// [`icon-press`][struct@crate::Entry#icon-press][ and [`icon-release`][struct@crate::Entry#icon-release]
3102 /// signals and does not allow DND from insensitive icons.
3103 ///
3104 /// An icon should be set insensitive if the action that would trigger
3105 /// when clicked is currently not available.
3106 #[doc(alias = "secondary-icon-sensitive")]
3107 fn is_secondary_icon_sensitive(&self) -> bool {
3108 ObjectExt::property(self.as_ref(), "secondary-icon-sensitive")
3109 }
3110
3111 /// Whether the secondary icon is sensitive.
3112 ///
3113 /// An insensitive icon appears grayed out. GTK does not emit the
3114 /// [`icon-press`][struct@crate::Entry#icon-press][ and [`icon-release`][struct@crate::Entry#icon-release]
3115 /// signals and does not allow DND from insensitive icons.
3116 ///
3117 /// An icon should be set insensitive if the action that would trigger
3118 /// when clicked is currently not available.
3119 #[doc(alias = "secondary-icon-sensitive")]
3120 fn set_secondary_icon_sensitive(&self, secondary_icon_sensitive: bool) {
3121 ObjectExt::set_property(
3122 self.as_ref(),
3123 "secondary-icon-sensitive",
3124 secondary_icon_sensitive,
3125 )
3126 }
3127
3128 /// The representation which is used for the secondary icon of the entry.
3129 #[doc(alias = "secondary-icon-storage-type")]
3130 fn secondary_icon_storage_type(&self) -> ImageType {
3131 ObjectExt::property(self.as_ref(), "secondary-icon-storage-type")
3132 }
3133
3134 /// The contents of the tooltip on the secondary icon, with markup.
3135 ///
3136 /// Also see [`set_icon_tooltip_markup()`][Self::set_icon_tooltip_markup()].
3137 #[doc(alias = "secondary-icon-tooltip-markup")]
3138 fn secondary_icon_tooltip_markup(&self) -> Option<glib::GString> {
3139 ObjectExt::property(self.as_ref(), "secondary-icon-tooltip-markup")
3140 }
3141
3142 /// The contents of the tooltip on the secondary icon, with markup.
3143 ///
3144 /// Also see [`set_icon_tooltip_markup()`][Self::set_icon_tooltip_markup()].
3145 #[doc(alias = "secondary-icon-tooltip-markup")]
3146 fn set_secondary_icon_tooltip_markup(&self, secondary_icon_tooltip_markup: Option<&str>) {
3147 ObjectExt::set_property(
3148 self.as_ref(),
3149 "secondary-icon-tooltip-markup",
3150 secondary_icon_tooltip_markup,
3151 )
3152 }
3153
3154 /// The contents of the tooltip on the secondary icon.
3155 ///
3156 /// Also see [`set_icon_tooltip_text()`][Self::set_icon_tooltip_text()].
3157 #[doc(alias = "secondary-icon-tooltip-text")]
3158 fn secondary_icon_tooltip_text(&self) -> Option<glib::GString> {
3159 ObjectExt::property(self.as_ref(), "secondary-icon-tooltip-text")
3160 }
3161
3162 /// The contents of the tooltip on the secondary icon.
3163 ///
3164 /// Also see [`set_icon_tooltip_text()`][Self::set_icon_tooltip_text()].
3165 #[doc(alias = "secondary-icon-tooltip-text")]
3166 fn set_secondary_icon_tooltip_text(&self, secondary_icon_tooltip_text: Option<&str>) {
3167 ObjectExt::set_property(
3168 self.as_ref(),
3169 "secondary-icon-tooltip-text",
3170 secondary_icon_tooltip_text,
3171 )
3172 }
3173
3174 /// Whether the entry will show an Emoji icon in the secondary icon position
3175 /// to open the Emoji chooser.
3176 #[doc(alias = "show-emoji-icon")]
3177 fn shows_emoji_icon(&self) -> bool {
3178 ObjectExt::property(self.as_ref(), "show-emoji-icon")
3179 }
3180
3181 /// Whether the entry will show an Emoji icon in the secondary icon position
3182 /// to open the Emoji chooser.
3183 #[doc(alias = "show-emoji-icon")]
3184 fn set_show_emoji_icon(&self, show_emoji_icon: bool) {
3185 ObjectExt::set_property(self.as_ref(), "show-emoji-icon", show_emoji_icon)
3186 }
3187
3188 /// When [`true`], pasted multi-line text is truncated to the first line.
3189 #[doc(alias = "truncate-multiline")]
3190 fn must_truncate_multiline(&self) -> bool {
3191 ObjectExt::property(self.as_ref(), "truncate-multiline")
3192 }
3193
3194 /// When [`true`], pasted multi-line text is truncated to the first line.
3195 #[doc(alias = "truncate-multiline")]
3196 fn set_truncate_multiline(&self, truncate_multiline: bool) {
3197 ObjectExt::set_property(self.as_ref(), "truncate-multiline", truncate_multiline)
3198 }
3199
3200 /// Emitted when the entry is activated.
3201 ///
3202 /// The keybindings for this signal are all forms of the Enter key.
3203 #[doc(alias = "activate")]
3204 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3205 unsafe extern "C" fn activate_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3206 this: *mut ffi::GtkEntry,
3207 f: glib::ffi::gpointer,
3208 ) {
3209 let f: &F = &*(f as *const F);
3210 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3211 }
3212 unsafe {
3213 let f: Box_<F> = Box_::new(f);
3214 connect_raw(
3215 self.as_ptr() as *mut _,
3216 c"activate".as_ptr() as *const _,
3217 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3218 activate_trampoline::<Self, F> as *const (),
3219 )),
3220 Box_::into_raw(f),
3221 )
3222 }
3223 }
3224
3225 fn emit_activate(&self) {
3226 self.emit_by_name::<()>("activate", &[]);
3227 }
3228
3229 /// Emitted when an activatable icon is clicked.
3230 /// ## `icon_pos`
3231 /// The position of the clicked icon
3232 #[doc(alias = "icon-press")]
3233 fn connect_icon_press<F: Fn(&Self, EntryIconPosition) + 'static>(
3234 &self,
3235 f: F,
3236 ) -> SignalHandlerId {
3237 unsafe extern "C" fn icon_press_trampoline<
3238 P: IsA<Entry>,
3239 F: Fn(&P, EntryIconPosition) + 'static,
3240 >(
3241 this: *mut ffi::GtkEntry,
3242 icon_pos: ffi::GtkEntryIconPosition,
3243 f: glib::ffi::gpointer,
3244 ) {
3245 let f: &F = &*(f as *const F);
3246 f(
3247 Entry::from_glib_borrow(this).unsafe_cast_ref(),
3248 from_glib(icon_pos),
3249 )
3250 }
3251 unsafe {
3252 let f: Box_<F> = Box_::new(f);
3253 connect_raw(
3254 self.as_ptr() as *mut _,
3255 c"icon-press".as_ptr() as *const _,
3256 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3257 icon_press_trampoline::<Self, F> as *const (),
3258 )),
3259 Box_::into_raw(f),
3260 )
3261 }
3262 }
3263
3264 /// Emitted on the button release from a mouse click
3265 /// over an activatable icon.
3266 /// ## `icon_pos`
3267 /// The position of the clicked icon
3268 #[doc(alias = "icon-release")]
3269 fn connect_icon_release<F: Fn(&Self, EntryIconPosition) + 'static>(
3270 &self,
3271 f: F,
3272 ) -> SignalHandlerId {
3273 unsafe extern "C" fn icon_release_trampoline<
3274 P: IsA<Entry>,
3275 F: Fn(&P, EntryIconPosition) + 'static,
3276 >(
3277 this: *mut ffi::GtkEntry,
3278 icon_pos: ffi::GtkEntryIconPosition,
3279 f: glib::ffi::gpointer,
3280 ) {
3281 let f: &F = &*(f as *const F);
3282 f(
3283 Entry::from_glib_borrow(this).unsafe_cast_ref(),
3284 from_glib(icon_pos),
3285 )
3286 }
3287 unsafe {
3288 let f: Box_<F> = Box_::new(f);
3289 connect_raw(
3290 self.as_ptr() as *mut _,
3291 c"icon-release".as_ptr() as *const _,
3292 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3293 icon_release_trampoline::<Self, F> as *const (),
3294 )),
3295 Box_::into_raw(f),
3296 )
3297 }
3298 }
3299
3300 #[doc(alias = "activates-default")]
3301 fn connect_activates_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3302 unsafe extern "C" fn notify_activates_default_trampoline<
3303 P: IsA<Entry>,
3304 F: Fn(&P) + 'static,
3305 >(
3306 this: *mut ffi::GtkEntry,
3307 _param_spec: glib::ffi::gpointer,
3308 f: glib::ffi::gpointer,
3309 ) {
3310 let f: &F = &*(f as *const F);
3311 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3312 }
3313 unsafe {
3314 let f: Box_<F> = Box_::new(f);
3315 connect_raw(
3316 self.as_ptr() as *mut _,
3317 c"notify::activates-default".as_ptr() as *const _,
3318 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3319 notify_activates_default_trampoline::<Self, F> as *const (),
3320 )),
3321 Box_::into_raw(f),
3322 )
3323 }
3324 }
3325
3326 #[doc(alias = "attributes")]
3327 fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3328 unsafe extern "C" fn notify_attributes_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3329 this: *mut ffi::GtkEntry,
3330 _param_spec: glib::ffi::gpointer,
3331 f: glib::ffi::gpointer,
3332 ) {
3333 let f: &F = &*(f as *const F);
3334 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3335 }
3336 unsafe {
3337 let f: Box_<F> = Box_::new(f);
3338 connect_raw(
3339 self.as_ptr() as *mut _,
3340 c"notify::attributes".as_ptr() as *const _,
3341 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3342 notify_attributes_trampoline::<Self, F> as *const (),
3343 )),
3344 Box_::into_raw(f),
3345 )
3346 }
3347 }
3348
3349 #[doc(alias = "buffer")]
3350 fn connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3351 unsafe extern "C" fn notify_buffer_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3352 this: *mut ffi::GtkEntry,
3353 _param_spec: glib::ffi::gpointer,
3354 f: glib::ffi::gpointer,
3355 ) {
3356 let f: &F = &*(f as *const F);
3357 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3358 }
3359 unsafe {
3360 let f: Box_<F> = Box_::new(f);
3361 connect_raw(
3362 self.as_ptr() as *mut _,
3363 c"notify::buffer".as_ptr() as *const _,
3364 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3365 notify_buffer_trampoline::<Self, F> as *const (),
3366 )),
3367 Box_::into_raw(f),
3368 )
3369 }
3370 }
3371
3372 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3373 #[doc(alias = "completion")]
3374 fn connect_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3375 unsafe extern "C" fn notify_completion_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3376 this: *mut ffi::GtkEntry,
3377 _param_spec: glib::ffi::gpointer,
3378 f: glib::ffi::gpointer,
3379 ) {
3380 let f: &F = &*(f as *const F);
3381 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3382 }
3383 unsafe {
3384 let f: Box_<F> = Box_::new(f);
3385 connect_raw(
3386 self.as_ptr() as *mut _,
3387 c"notify::completion".as_ptr() as *const _,
3388 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3389 notify_completion_trampoline::<Self, F> as *const (),
3390 )),
3391 Box_::into_raw(f),
3392 )
3393 }
3394 }
3395
3396 #[doc(alias = "enable-emoji-completion")]
3397 fn connect_enable_emoji_completion_notify<F: Fn(&Self) + 'static>(
3398 &self,
3399 f: F,
3400 ) -> SignalHandlerId {
3401 unsafe extern "C" fn notify_enable_emoji_completion_trampoline<
3402 P: IsA<Entry>,
3403 F: Fn(&P) + 'static,
3404 >(
3405 this: *mut ffi::GtkEntry,
3406 _param_spec: glib::ffi::gpointer,
3407 f: glib::ffi::gpointer,
3408 ) {
3409 let f: &F = &*(f as *const F);
3410 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3411 }
3412 unsafe {
3413 let f: Box_<F> = Box_::new(f);
3414 connect_raw(
3415 self.as_ptr() as *mut _,
3416 c"notify::enable-emoji-completion".as_ptr() as *const _,
3417 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3418 notify_enable_emoji_completion_trampoline::<Self, F> as *const (),
3419 )),
3420 Box_::into_raw(f),
3421 )
3422 }
3423 }
3424
3425 #[doc(alias = "extra-menu")]
3426 fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3427 unsafe extern "C" fn notify_extra_menu_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3428 this: *mut ffi::GtkEntry,
3429 _param_spec: glib::ffi::gpointer,
3430 f: glib::ffi::gpointer,
3431 ) {
3432 let f: &F = &*(f as *const F);
3433 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3434 }
3435 unsafe {
3436 let f: Box_<F> = Box_::new(f);
3437 connect_raw(
3438 self.as_ptr() as *mut _,
3439 c"notify::extra-menu".as_ptr() as *const _,
3440 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3441 notify_extra_menu_trampoline::<Self, F> as *const (),
3442 )),
3443 Box_::into_raw(f),
3444 )
3445 }
3446 }
3447
3448 #[doc(alias = "has-frame")]
3449 fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3450 unsafe extern "C" fn notify_has_frame_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3451 this: *mut ffi::GtkEntry,
3452 _param_spec: glib::ffi::gpointer,
3453 f: glib::ffi::gpointer,
3454 ) {
3455 let f: &F = &*(f as *const F);
3456 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3457 }
3458 unsafe {
3459 let f: Box_<F> = Box_::new(f);
3460 connect_raw(
3461 self.as_ptr() as *mut _,
3462 c"notify::has-frame".as_ptr() as *const _,
3463 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3464 notify_has_frame_trampoline::<Self, F> as *const (),
3465 )),
3466 Box_::into_raw(f),
3467 )
3468 }
3469 }
3470
3471 #[doc(alias = "im-module")]
3472 fn connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3473 unsafe extern "C" fn notify_im_module_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3474 this: *mut ffi::GtkEntry,
3475 _param_spec: glib::ffi::gpointer,
3476 f: glib::ffi::gpointer,
3477 ) {
3478 let f: &F = &*(f as *const F);
3479 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3480 }
3481 unsafe {
3482 let f: Box_<F> = Box_::new(f);
3483 connect_raw(
3484 self.as_ptr() as *mut _,
3485 c"notify::im-module".as_ptr() as *const _,
3486 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3487 notify_im_module_trampoline::<Self, F> as *const (),
3488 )),
3489 Box_::into_raw(f),
3490 )
3491 }
3492 }
3493
3494 #[doc(alias = "input-hints")]
3495 fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3496 unsafe extern "C" fn notify_input_hints_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3497 this: *mut ffi::GtkEntry,
3498 _param_spec: glib::ffi::gpointer,
3499 f: glib::ffi::gpointer,
3500 ) {
3501 let f: &F = &*(f as *const F);
3502 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3503 }
3504 unsafe {
3505 let f: Box_<F> = Box_::new(f);
3506 connect_raw(
3507 self.as_ptr() as *mut _,
3508 c"notify::input-hints".as_ptr() as *const _,
3509 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3510 notify_input_hints_trampoline::<Self, F> as *const (),
3511 )),
3512 Box_::into_raw(f),
3513 )
3514 }
3515 }
3516
3517 #[doc(alias = "input-purpose")]
3518 fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3519 unsafe extern "C" fn notify_input_purpose_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3520 this: *mut ffi::GtkEntry,
3521 _param_spec: glib::ffi::gpointer,
3522 f: glib::ffi::gpointer,
3523 ) {
3524 let f: &F = &*(f as *const F);
3525 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3526 }
3527 unsafe {
3528 let f: Box_<F> = Box_::new(f);
3529 connect_raw(
3530 self.as_ptr() as *mut _,
3531 c"notify::input-purpose".as_ptr() as *const _,
3532 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3533 notify_input_purpose_trampoline::<Self, F> as *const (),
3534 )),
3535 Box_::into_raw(f),
3536 )
3537 }
3538 }
3539
3540 #[doc(alias = "invisible-char")]
3541 fn connect_invisible_char_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3542 unsafe extern "C" fn notify_invisible_char_trampoline<
3543 P: IsA<Entry>,
3544 F: Fn(&P) + 'static,
3545 >(
3546 this: *mut ffi::GtkEntry,
3547 _param_spec: glib::ffi::gpointer,
3548 f: glib::ffi::gpointer,
3549 ) {
3550 let f: &F = &*(f as *const F);
3551 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3552 }
3553 unsafe {
3554 let f: Box_<F> = Box_::new(f);
3555 connect_raw(
3556 self.as_ptr() as *mut _,
3557 c"notify::invisible-char".as_ptr() as *const _,
3558 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3559 notify_invisible_char_trampoline::<Self, F> as *const (),
3560 )),
3561 Box_::into_raw(f),
3562 )
3563 }
3564 }
3565
3566 #[doc(alias = "invisible-char-set")]
3567 fn connect_invisible_char_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3568 unsafe extern "C" fn notify_invisible_char_set_trampoline<
3569 P: IsA<Entry>,
3570 F: Fn(&P) + 'static,
3571 >(
3572 this: *mut ffi::GtkEntry,
3573 _param_spec: glib::ffi::gpointer,
3574 f: glib::ffi::gpointer,
3575 ) {
3576 let f: &F = &*(f as *const F);
3577 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3578 }
3579 unsafe {
3580 let f: Box_<F> = Box_::new(f);
3581 connect_raw(
3582 self.as_ptr() as *mut _,
3583 c"notify::invisible-char-set".as_ptr() as *const _,
3584 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3585 notify_invisible_char_set_trampoline::<Self, F> as *const (),
3586 )),
3587 Box_::into_raw(f),
3588 )
3589 }
3590 }
3591
3592 #[doc(alias = "max-length")]
3593 fn connect_max_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3594 unsafe extern "C" fn notify_max_length_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3595 this: *mut ffi::GtkEntry,
3596 _param_spec: glib::ffi::gpointer,
3597 f: glib::ffi::gpointer,
3598 ) {
3599 let f: &F = &*(f as *const F);
3600 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3601 }
3602 unsafe {
3603 let f: Box_<F> = Box_::new(f);
3604 connect_raw(
3605 self.as_ptr() as *mut _,
3606 c"notify::max-length".as_ptr() as *const _,
3607 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3608 notify_max_length_trampoline::<Self, F> as *const (),
3609 )),
3610 Box_::into_raw(f),
3611 )
3612 }
3613 }
3614
3615 #[doc(alias = "overwrite-mode")]
3616 fn connect_overwrite_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3617 unsafe extern "C" fn notify_overwrite_mode_trampoline<
3618 P: IsA<Entry>,
3619 F: Fn(&P) + 'static,
3620 >(
3621 this: *mut ffi::GtkEntry,
3622 _param_spec: glib::ffi::gpointer,
3623 f: glib::ffi::gpointer,
3624 ) {
3625 let f: &F = &*(f as *const F);
3626 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3627 }
3628 unsafe {
3629 let f: Box_<F> = Box_::new(f);
3630 connect_raw(
3631 self.as_ptr() as *mut _,
3632 c"notify::overwrite-mode".as_ptr() as *const _,
3633 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3634 notify_overwrite_mode_trampoline::<Self, F> as *const (),
3635 )),
3636 Box_::into_raw(f),
3637 )
3638 }
3639 }
3640
3641 #[doc(alias = "placeholder-text")]
3642 fn connect_placeholder_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3643 unsafe extern "C" fn notify_placeholder_text_trampoline<
3644 P: IsA<Entry>,
3645 F: Fn(&P) + 'static,
3646 >(
3647 this: *mut ffi::GtkEntry,
3648 _param_spec: glib::ffi::gpointer,
3649 f: glib::ffi::gpointer,
3650 ) {
3651 let f: &F = &*(f as *const F);
3652 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3653 }
3654 unsafe {
3655 let f: Box_<F> = Box_::new(f);
3656 connect_raw(
3657 self.as_ptr() as *mut _,
3658 c"notify::placeholder-text".as_ptr() as *const _,
3659 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3660 notify_placeholder_text_trampoline::<Self, F> as *const (),
3661 )),
3662 Box_::into_raw(f),
3663 )
3664 }
3665 }
3666
3667 #[doc(alias = "primary-icon-activatable")]
3668 fn connect_primary_icon_activatable_notify<F: Fn(&Self) + 'static>(
3669 &self,
3670 f: F,
3671 ) -> SignalHandlerId {
3672 unsafe extern "C" fn notify_primary_icon_activatable_trampoline<
3673 P: IsA<Entry>,
3674 F: Fn(&P) + 'static,
3675 >(
3676 this: *mut ffi::GtkEntry,
3677 _param_spec: glib::ffi::gpointer,
3678 f: glib::ffi::gpointer,
3679 ) {
3680 let f: &F = &*(f as *const F);
3681 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3682 }
3683 unsafe {
3684 let f: Box_<F> = Box_::new(f);
3685 connect_raw(
3686 self.as_ptr() as *mut _,
3687 c"notify::primary-icon-activatable".as_ptr() as *const _,
3688 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3689 notify_primary_icon_activatable_trampoline::<Self, F> as *const (),
3690 )),
3691 Box_::into_raw(f),
3692 )
3693 }
3694 }
3695
3696 #[doc(alias = "primary-icon-gicon")]
3697 fn connect_primary_icon_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3698 unsafe extern "C" fn notify_primary_icon_gicon_trampoline<
3699 P: IsA<Entry>,
3700 F: Fn(&P) + 'static,
3701 >(
3702 this: *mut ffi::GtkEntry,
3703 _param_spec: glib::ffi::gpointer,
3704 f: glib::ffi::gpointer,
3705 ) {
3706 let f: &F = &*(f as *const F);
3707 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3708 }
3709 unsafe {
3710 let f: Box_<F> = Box_::new(f);
3711 connect_raw(
3712 self.as_ptr() as *mut _,
3713 c"notify::primary-icon-gicon".as_ptr() as *const _,
3714 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3715 notify_primary_icon_gicon_trampoline::<Self, F> as *const (),
3716 )),
3717 Box_::into_raw(f),
3718 )
3719 }
3720 }
3721
3722 #[doc(alias = "primary-icon-name")]
3723 fn connect_primary_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3724 unsafe extern "C" fn notify_primary_icon_name_trampoline<
3725 P: IsA<Entry>,
3726 F: Fn(&P) + 'static,
3727 >(
3728 this: *mut ffi::GtkEntry,
3729 _param_spec: glib::ffi::gpointer,
3730 f: glib::ffi::gpointer,
3731 ) {
3732 let f: &F = &*(f as *const F);
3733 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3734 }
3735 unsafe {
3736 let f: Box_<F> = Box_::new(f);
3737 connect_raw(
3738 self.as_ptr() as *mut _,
3739 c"notify::primary-icon-name".as_ptr() as *const _,
3740 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3741 notify_primary_icon_name_trampoline::<Self, F> as *const (),
3742 )),
3743 Box_::into_raw(f),
3744 )
3745 }
3746 }
3747
3748 #[doc(alias = "primary-icon-paintable")]
3749 fn connect_primary_icon_paintable_notify<F: Fn(&Self) + 'static>(
3750 &self,
3751 f: F,
3752 ) -> SignalHandlerId {
3753 unsafe extern "C" fn notify_primary_icon_paintable_trampoline<
3754 P: IsA<Entry>,
3755 F: Fn(&P) + 'static,
3756 >(
3757 this: *mut ffi::GtkEntry,
3758 _param_spec: glib::ffi::gpointer,
3759 f: glib::ffi::gpointer,
3760 ) {
3761 let f: &F = &*(f as *const F);
3762 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3763 }
3764 unsafe {
3765 let f: Box_<F> = Box_::new(f);
3766 connect_raw(
3767 self.as_ptr() as *mut _,
3768 c"notify::primary-icon-paintable".as_ptr() as *const _,
3769 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3770 notify_primary_icon_paintable_trampoline::<Self, F> as *const (),
3771 )),
3772 Box_::into_raw(f),
3773 )
3774 }
3775 }
3776
3777 #[doc(alias = "primary-icon-sensitive")]
3778 fn connect_primary_icon_sensitive_notify<F: Fn(&Self) + 'static>(
3779 &self,
3780 f: F,
3781 ) -> SignalHandlerId {
3782 unsafe extern "C" fn notify_primary_icon_sensitive_trampoline<
3783 P: IsA<Entry>,
3784 F: Fn(&P) + 'static,
3785 >(
3786 this: *mut ffi::GtkEntry,
3787 _param_spec: glib::ffi::gpointer,
3788 f: glib::ffi::gpointer,
3789 ) {
3790 let f: &F = &*(f as *const F);
3791 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3792 }
3793 unsafe {
3794 let f: Box_<F> = Box_::new(f);
3795 connect_raw(
3796 self.as_ptr() as *mut _,
3797 c"notify::primary-icon-sensitive".as_ptr() as *const _,
3798 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3799 notify_primary_icon_sensitive_trampoline::<Self, F> as *const (),
3800 )),
3801 Box_::into_raw(f),
3802 )
3803 }
3804 }
3805
3806 #[doc(alias = "primary-icon-storage-type")]
3807 fn connect_primary_icon_storage_type_notify<F: Fn(&Self) + 'static>(
3808 &self,
3809 f: F,
3810 ) -> SignalHandlerId {
3811 unsafe extern "C" fn notify_primary_icon_storage_type_trampoline<
3812 P: IsA<Entry>,
3813 F: Fn(&P) + 'static,
3814 >(
3815 this: *mut ffi::GtkEntry,
3816 _param_spec: glib::ffi::gpointer,
3817 f: glib::ffi::gpointer,
3818 ) {
3819 let f: &F = &*(f as *const F);
3820 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3821 }
3822 unsafe {
3823 let f: Box_<F> = Box_::new(f);
3824 connect_raw(
3825 self.as_ptr() as *mut _,
3826 c"notify::primary-icon-storage-type".as_ptr() as *const _,
3827 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3828 notify_primary_icon_storage_type_trampoline::<Self, F> as *const (),
3829 )),
3830 Box_::into_raw(f),
3831 )
3832 }
3833 }
3834
3835 #[doc(alias = "primary-icon-tooltip-markup")]
3836 fn connect_primary_icon_tooltip_markup_notify<F: Fn(&Self) + 'static>(
3837 &self,
3838 f: F,
3839 ) -> SignalHandlerId {
3840 unsafe extern "C" fn notify_primary_icon_tooltip_markup_trampoline<
3841 P: IsA<Entry>,
3842 F: Fn(&P) + 'static,
3843 >(
3844 this: *mut ffi::GtkEntry,
3845 _param_spec: glib::ffi::gpointer,
3846 f: glib::ffi::gpointer,
3847 ) {
3848 let f: &F = &*(f as *const F);
3849 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3850 }
3851 unsafe {
3852 let f: Box_<F> = Box_::new(f);
3853 connect_raw(
3854 self.as_ptr() as *mut _,
3855 c"notify::primary-icon-tooltip-markup".as_ptr() as *const _,
3856 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3857 notify_primary_icon_tooltip_markup_trampoline::<Self, F> as *const (),
3858 )),
3859 Box_::into_raw(f),
3860 )
3861 }
3862 }
3863
3864 #[doc(alias = "primary-icon-tooltip-text")]
3865 fn connect_primary_icon_tooltip_text_notify<F: Fn(&Self) + 'static>(
3866 &self,
3867 f: F,
3868 ) -> SignalHandlerId {
3869 unsafe extern "C" fn notify_primary_icon_tooltip_text_trampoline<
3870 P: IsA<Entry>,
3871 F: Fn(&P) + 'static,
3872 >(
3873 this: *mut ffi::GtkEntry,
3874 _param_spec: glib::ffi::gpointer,
3875 f: glib::ffi::gpointer,
3876 ) {
3877 let f: &F = &*(f as *const F);
3878 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3879 }
3880 unsafe {
3881 let f: Box_<F> = Box_::new(f);
3882 connect_raw(
3883 self.as_ptr() as *mut _,
3884 c"notify::primary-icon-tooltip-text".as_ptr() as *const _,
3885 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3886 notify_primary_icon_tooltip_text_trampoline::<Self, F> as *const (),
3887 )),
3888 Box_::into_raw(f),
3889 )
3890 }
3891 }
3892
3893 #[doc(alias = "progress-fraction")]
3894 fn connect_progress_fraction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3895 unsafe extern "C" fn notify_progress_fraction_trampoline<
3896 P: IsA<Entry>,
3897 F: Fn(&P) + 'static,
3898 >(
3899 this: *mut ffi::GtkEntry,
3900 _param_spec: glib::ffi::gpointer,
3901 f: glib::ffi::gpointer,
3902 ) {
3903 let f: &F = &*(f as *const F);
3904 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3905 }
3906 unsafe {
3907 let f: Box_<F> = Box_::new(f);
3908 connect_raw(
3909 self.as_ptr() as *mut _,
3910 c"notify::progress-fraction".as_ptr() as *const _,
3911 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3912 notify_progress_fraction_trampoline::<Self, F> as *const (),
3913 )),
3914 Box_::into_raw(f),
3915 )
3916 }
3917 }
3918
3919 #[doc(alias = "progress-pulse-step")]
3920 fn connect_progress_pulse_step_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3921 unsafe extern "C" fn notify_progress_pulse_step_trampoline<
3922 P: IsA<Entry>,
3923 F: Fn(&P) + 'static,
3924 >(
3925 this: *mut ffi::GtkEntry,
3926 _param_spec: glib::ffi::gpointer,
3927 f: glib::ffi::gpointer,
3928 ) {
3929 let f: &F = &*(f as *const F);
3930 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3931 }
3932 unsafe {
3933 let f: Box_<F> = Box_::new(f);
3934 connect_raw(
3935 self.as_ptr() as *mut _,
3936 c"notify::progress-pulse-step".as_ptr() as *const _,
3937 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3938 notify_progress_pulse_step_trampoline::<Self, F> as *const (),
3939 )),
3940 Box_::into_raw(f),
3941 )
3942 }
3943 }
3944
3945 #[doc(alias = "scroll-offset")]
3946 fn connect_scroll_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3947 unsafe extern "C" fn notify_scroll_offset_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
3948 this: *mut ffi::GtkEntry,
3949 _param_spec: glib::ffi::gpointer,
3950 f: glib::ffi::gpointer,
3951 ) {
3952 let f: &F = &*(f as *const F);
3953 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3954 }
3955 unsafe {
3956 let f: Box_<F> = Box_::new(f);
3957 connect_raw(
3958 self.as_ptr() as *mut _,
3959 c"notify::scroll-offset".as_ptr() as *const _,
3960 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3961 notify_scroll_offset_trampoline::<Self, F> as *const (),
3962 )),
3963 Box_::into_raw(f),
3964 )
3965 }
3966 }
3967
3968 #[doc(alias = "secondary-icon-activatable")]
3969 fn connect_secondary_icon_activatable_notify<F: Fn(&Self) + 'static>(
3970 &self,
3971 f: F,
3972 ) -> SignalHandlerId {
3973 unsafe extern "C" fn notify_secondary_icon_activatable_trampoline<
3974 P: IsA<Entry>,
3975 F: Fn(&P) + 'static,
3976 >(
3977 this: *mut ffi::GtkEntry,
3978 _param_spec: glib::ffi::gpointer,
3979 f: glib::ffi::gpointer,
3980 ) {
3981 let f: &F = &*(f as *const F);
3982 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
3983 }
3984 unsafe {
3985 let f: Box_<F> = Box_::new(f);
3986 connect_raw(
3987 self.as_ptr() as *mut _,
3988 c"notify::secondary-icon-activatable".as_ptr() as *const _,
3989 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3990 notify_secondary_icon_activatable_trampoline::<Self, F> as *const (),
3991 )),
3992 Box_::into_raw(f),
3993 )
3994 }
3995 }
3996
3997 #[doc(alias = "secondary-icon-gicon")]
3998 fn connect_secondary_icon_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3999 unsafe extern "C" fn notify_secondary_icon_gicon_trampoline<
4000 P: IsA<Entry>,
4001 F: Fn(&P) + 'static,
4002 >(
4003 this: *mut ffi::GtkEntry,
4004 _param_spec: glib::ffi::gpointer,
4005 f: glib::ffi::gpointer,
4006 ) {
4007 let f: &F = &*(f as *const F);
4008 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4009 }
4010 unsafe {
4011 let f: Box_<F> = Box_::new(f);
4012 connect_raw(
4013 self.as_ptr() as *mut _,
4014 c"notify::secondary-icon-gicon".as_ptr() as *const _,
4015 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4016 notify_secondary_icon_gicon_trampoline::<Self, F> as *const (),
4017 )),
4018 Box_::into_raw(f),
4019 )
4020 }
4021 }
4022
4023 #[doc(alias = "secondary-icon-name")]
4024 fn connect_secondary_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4025 unsafe extern "C" fn notify_secondary_icon_name_trampoline<
4026 P: IsA<Entry>,
4027 F: Fn(&P) + 'static,
4028 >(
4029 this: *mut ffi::GtkEntry,
4030 _param_spec: glib::ffi::gpointer,
4031 f: glib::ffi::gpointer,
4032 ) {
4033 let f: &F = &*(f as *const F);
4034 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4035 }
4036 unsafe {
4037 let f: Box_<F> = Box_::new(f);
4038 connect_raw(
4039 self.as_ptr() as *mut _,
4040 c"notify::secondary-icon-name".as_ptr() as *const _,
4041 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4042 notify_secondary_icon_name_trampoline::<Self, F> as *const (),
4043 )),
4044 Box_::into_raw(f),
4045 )
4046 }
4047 }
4048
4049 #[doc(alias = "secondary-icon-paintable")]
4050 fn connect_secondary_icon_paintable_notify<F: Fn(&Self) + 'static>(
4051 &self,
4052 f: F,
4053 ) -> SignalHandlerId {
4054 unsafe extern "C" fn notify_secondary_icon_paintable_trampoline<
4055 P: IsA<Entry>,
4056 F: Fn(&P) + 'static,
4057 >(
4058 this: *mut ffi::GtkEntry,
4059 _param_spec: glib::ffi::gpointer,
4060 f: glib::ffi::gpointer,
4061 ) {
4062 let f: &F = &*(f as *const F);
4063 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4064 }
4065 unsafe {
4066 let f: Box_<F> = Box_::new(f);
4067 connect_raw(
4068 self.as_ptr() as *mut _,
4069 c"notify::secondary-icon-paintable".as_ptr() as *const _,
4070 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4071 notify_secondary_icon_paintable_trampoline::<Self, F> as *const (),
4072 )),
4073 Box_::into_raw(f),
4074 )
4075 }
4076 }
4077
4078 #[doc(alias = "secondary-icon-sensitive")]
4079 fn connect_secondary_icon_sensitive_notify<F: Fn(&Self) + 'static>(
4080 &self,
4081 f: F,
4082 ) -> SignalHandlerId {
4083 unsafe extern "C" fn notify_secondary_icon_sensitive_trampoline<
4084 P: IsA<Entry>,
4085 F: Fn(&P) + 'static,
4086 >(
4087 this: *mut ffi::GtkEntry,
4088 _param_spec: glib::ffi::gpointer,
4089 f: glib::ffi::gpointer,
4090 ) {
4091 let f: &F = &*(f as *const F);
4092 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4093 }
4094 unsafe {
4095 let f: Box_<F> = Box_::new(f);
4096 connect_raw(
4097 self.as_ptr() as *mut _,
4098 c"notify::secondary-icon-sensitive".as_ptr() as *const _,
4099 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4100 notify_secondary_icon_sensitive_trampoline::<Self, F> as *const (),
4101 )),
4102 Box_::into_raw(f),
4103 )
4104 }
4105 }
4106
4107 #[doc(alias = "secondary-icon-storage-type")]
4108 fn connect_secondary_icon_storage_type_notify<F: Fn(&Self) + 'static>(
4109 &self,
4110 f: F,
4111 ) -> SignalHandlerId {
4112 unsafe extern "C" fn notify_secondary_icon_storage_type_trampoline<
4113 P: IsA<Entry>,
4114 F: Fn(&P) + 'static,
4115 >(
4116 this: *mut ffi::GtkEntry,
4117 _param_spec: glib::ffi::gpointer,
4118 f: glib::ffi::gpointer,
4119 ) {
4120 let f: &F = &*(f as *const F);
4121 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4122 }
4123 unsafe {
4124 let f: Box_<F> = Box_::new(f);
4125 connect_raw(
4126 self.as_ptr() as *mut _,
4127 c"notify::secondary-icon-storage-type".as_ptr() as *const _,
4128 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4129 notify_secondary_icon_storage_type_trampoline::<Self, F> as *const (),
4130 )),
4131 Box_::into_raw(f),
4132 )
4133 }
4134 }
4135
4136 #[doc(alias = "secondary-icon-tooltip-markup")]
4137 fn connect_secondary_icon_tooltip_markup_notify<F: Fn(&Self) + 'static>(
4138 &self,
4139 f: F,
4140 ) -> SignalHandlerId {
4141 unsafe extern "C" fn notify_secondary_icon_tooltip_markup_trampoline<
4142 P: IsA<Entry>,
4143 F: Fn(&P) + 'static,
4144 >(
4145 this: *mut ffi::GtkEntry,
4146 _param_spec: glib::ffi::gpointer,
4147 f: glib::ffi::gpointer,
4148 ) {
4149 let f: &F = &*(f as *const F);
4150 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4151 }
4152 unsafe {
4153 let f: Box_<F> = Box_::new(f);
4154 connect_raw(
4155 self.as_ptr() as *mut _,
4156 c"notify::secondary-icon-tooltip-markup".as_ptr() as *const _,
4157 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4158 notify_secondary_icon_tooltip_markup_trampoline::<Self, F> as *const (),
4159 )),
4160 Box_::into_raw(f),
4161 )
4162 }
4163 }
4164
4165 #[doc(alias = "secondary-icon-tooltip-text")]
4166 fn connect_secondary_icon_tooltip_text_notify<F: Fn(&Self) + 'static>(
4167 &self,
4168 f: F,
4169 ) -> SignalHandlerId {
4170 unsafe extern "C" fn notify_secondary_icon_tooltip_text_trampoline<
4171 P: IsA<Entry>,
4172 F: Fn(&P) + 'static,
4173 >(
4174 this: *mut ffi::GtkEntry,
4175 _param_spec: glib::ffi::gpointer,
4176 f: glib::ffi::gpointer,
4177 ) {
4178 let f: &F = &*(f as *const F);
4179 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4180 }
4181 unsafe {
4182 let f: Box_<F> = Box_::new(f);
4183 connect_raw(
4184 self.as_ptr() as *mut _,
4185 c"notify::secondary-icon-tooltip-text".as_ptr() as *const _,
4186 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4187 notify_secondary_icon_tooltip_text_trampoline::<Self, F> as *const (),
4188 )),
4189 Box_::into_raw(f),
4190 )
4191 }
4192 }
4193
4194 #[doc(alias = "show-emoji-icon")]
4195 fn connect_show_emoji_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4196 unsafe extern "C" fn notify_show_emoji_icon_trampoline<
4197 P: IsA<Entry>,
4198 F: Fn(&P) + 'static,
4199 >(
4200 this: *mut ffi::GtkEntry,
4201 _param_spec: glib::ffi::gpointer,
4202 f: glib::ffi::gpointer,
4203 ) {
4204 let f: &F = &*(f as *const F);
4205 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4206 }
4207 unsafe {
4208 let f: Box_<F> = Box_::new(f);
4209 connect_raw(
4210 self.as_ptr() as *mut _,
4211 c"notify::show-emoji-icon".as_ptr() as *const _,
4212 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4213 notify_show_emoji_icon_trampoline::<Self, F> as *const (),
4214 )),
4215 Box_::into_raw(f),
4216 )
4217 }
4218 }
4219
4220 #[doc(alias = "tabs")]
4221 fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4222 unsafe extern "C" fn notify_tabs_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
4223 this: *mut ffi::GtkEntry,
4224 _param_spec: glib::ffi::gpointer,
4225 f: glib::ffi::gpointer,
4226 ) {
4227 let f: &F = &*(f as *const F);
4228 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4229 }
4230 unsafe {
4231 let f: Box_<F> = Box_::new(f);
4232 connect_raw(
4233 self.as_ptr() as *mut _,
4234 c"notify::tabs".as_ptr() as *const _,
4235 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4236 notify_tabs_trampoline::<Self, F> as *const (),
4237 )),
4238 Box_::into_raw(f),
4239 )
4240 }
4241 }
4242
4243 #[doc(alias = "text-length")]
4244 fn connect_text_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4245 unsafe extern "C" fn notify_text_length_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
4246 this: *mut ffi::GtkEntry,
4247 _param_spec: glib::ffi::gpointer,
4248 f: glib::ffi::gpointer,
4249 ) {
4250 let f: &F = &*(f as *const F);
4251 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4252 }
4253 unsafe {
4254 let f: Box_<F> = Box_::new(f);
4255 connect_raw(
4256 self.as_ptr() as *mut _,
4257 c"notify::text-length".as_ptr() as *const _,
4258 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4259 notify_text_length_trampoline::<Self, F> as *const (),
4260 )),
4261 Box_::into_raw(f),
4262 )
4263 }
4264 }
4265
4266 #[doc(alias = "truncate-multiline")]
4267 fn connect_truncate_multiline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4268 unsafe extern "C" fn notify_truncate_multiline_trampoline<
4269 P: IsA<Entry>,
4270 F: Fn(&P) + 'static,
4271 >(
4272 this: *mut ffi::GtkEntry,
4273 _param_spec: glib::ffi::gpointer,
4274 f: glib::ffi::gpointer,
4275 ) {
4276 let f: &F = &*(f as *const F);
4277 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4278 }
4279 unsafe {
4280 let f: Box_<F> = Box_::new(f);
4281 connect_raw(
4282 self.as_ptr() as *mut _,
4283 c"notify::truncate-multiline".as_ptr() as *const _,
4284 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4285 notify_truncate_multiline_trampoline::<Self, F> as *const (),
4286 )),
4287 Box_::into_raw(f),
4288 )
4289 }
4290 }
4291
4292 #[doc(alias = "visibility")]
4293 fn connect_visibility_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4294 unsafe extern "C" fn notify_visibility_trampoline<P: IsA<Entry>, F: Fn(&P) + 'static>(
4295 this: *mut ffi::GtkEntry,
4296 _param_spec: glib::ffi::gpointer,
4297 f: glib::ffi::gpointer,
4298 ) {
4299 let f: &F = &*(f as *const F);
4300 f(Entry::from_glib_borrow(this).unsafe_cast_ref())
4301 }
4302 unsafe {
4303 let f: Box_<F> = Box_::new(f);
4304 connect_raw(
4305 self.as_ptr() as *mut _,
4306 c"notify::visibility".as_ptr() as *const _,
4307 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4308 notify_visibility_trampoline::<Self, F> as *const (),
4309 )),
4310 Box_::into_raw(f),
4311 )
4312 }
4313 }
4314}
4315
4316impl<O: IsA<Entry>> EntryExt for O {}