libadwaita/auto/entry_row.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{ffi, PreferencesRow};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 /// A [`gtk::ListBoxRow`][crate::gtk::ListBoxRow] with an embedded text entry.
17 ///
18 /// <picture>
19 /// <source srcset="entry-row-dark.png" media="(prefers-color-scheme: dark)">
20 /// <img src="entry-row.png" alt="entry-row">
21 /// </picture>
22 ///
23 /// [`EntryRow`][crate::EntryRow] has a title that doubles as placeholder text. It shows an icon
24 /// indicating that it's editable and can receive additional widgets before or
25 /// after the editable part.
26 ///
27 /// If [`show-apply-button`][struct@crate::EntryRow#show-apply-button] is set to `TRUE`, [`EntryRow`][crate::EntryRow] can
28 /// show an apply button when editing its contents. This can be useful if
29 /// changing its contents can result in an expensive operation, such as network
30 /// activity.
31 ///
32 /// [`EntryRow`][crate::EntryRow] provides only minimal API and should be used with the
33 /// [`gtk::Editable`][crate::gtk::Editable] API.
34 ///
35 /// See also [`PasswordEntryRow`][crate::PasswordEntryRow].
36 ///
37 /// ## AdwEntryRow as GtkBuildable
38 ///
39 /// The [`EntryRow`][crate::EntryRow] implementation of the [`gtk::Buildable`][crate::gtk::Buildable] interface
40 /// supports adding a child at its end by specifying “suffix” or omitting the
41 /// “type” attribute of a <child> element.
42 ///
43 /// It also supports adding a child as a prefix widget by specifying “prefix” as
44 /// the “type” attribute of a <child> element.
45 ///
46 /// ## CSS nodes
47 ///
48 /// [`EntryRow`][crate::EntryRow] has a single CSS node with name `row` and the `.entry` style
49 /// class.
50 ///
51 /// ## Properties
52 ///
53 ///
54 /// #### `activates-default`
55 /// Whether activating the embedded entry can activate the default widget.
56 ///
57 /// Readable | Writeable
58 ///
59 ///
60 /// #### `attributes`
61 /// A list of Pango attributes to apply to the text of the embedded entry.
62 ///
63 /// The `Pango::Attribute`'s `start_index` and `end_index` must refer to
64 /// the `Gtk::EntryBuffer` text, i.e. without the preedit string.
65 ///
66 /// Readable | Writeable
67 ///
68 ///
69 /// #### `enable-emoji-completion`
70 /// Whether to suggest emoji replacements on the entry row.
71 ///
72 /// Emoji replacement is done with :-delimited names, like `:heart:`.
73 ///
74 /// Readable | Writeable
75 ///
76 ///
77 /// #### `input-hints`
78 /// Additional input hints for the entry row.
79 ///
80 /// Input hints allow input methods to fine-tune their behavior.
81 ///
82 /// See also: [`input-purpose`][struct@crate::EntryRow#input-purpose]
83 ///
84 /// Readable | Writeable
85 ///
86 ///
87 /// #### `input-purpose`
88 /// The input purpose of the entry row.
89 ///
90 /// The input purpose can be used by input methods to adjust their behavior.
91 ///
92 /// Readable | Writeable
93 ///
94 ///
95 /// #### `max-length`
96 /// Maximum number of characters for the entry.
97 ///
98 /// Readable | Writeable
99 ///
100 ///
101 /// #### `show-apply-button`
102 /// Whether to show the apply button.
103 ///
104 /// When set to `TRUE`, typing text in the entry will reveal an apply button.
105 /// Clicking it or pressing the <kbd>Enter</kbd> key will hide the button and
106 /// emit the [`apply`][struct@crate::EntryRow#apply] signal.
107 ///
108 /// This is useful if changing the entry contents can trigger an expensive
109 /// operation, e.g. network activity, to avoid triggering it after typing every
110 /// character.
111 ///
112 /// Readable | Writeable
113 ///
114 ///
115 /// #### `text-length`
116 /// The length of the text in the entry row.
117 ///
118 /// Readable
119 /// <details><summary><h4>PreferencesRow</h4></summary>
120 ///
121 ///
122 /// #### `title`
123 /// The title of the preference represented by this row.
124 ///
125 /// The title is interpreted as Pango markup unless
126 /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
127 ///
128 /// Readable | Writeable
129 ///
130 ///
131 /// #### `title-selectable`
132 /// Whether the user can copy the title from the label.
133 ///
134 /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
135 ///
136 /// Readable | Writeable
137 ///
138 ///
139 /// #### `use-markup`
140 /// Whether to use Pango markup for the title label.
141 ///
142 /// Subclasses may also use it for other labels, such as subtitle.
143 ///
144 /// See also `parse_markup()`.
145 ///
146 /// Readable | Writeable
147 ///
148 ///
149 /// #### `use-underline`
150 /// Whether an embedded underline in the title indicates a mnemonic.
151 ///
152 /// Readable | Writeable
153 /// </details>
154 /// <details><summary><h4>ListBoxRow</h4></summary>
155 ///
156 ///
157 /// #### `activatable`
158 /// Determines whether the ::row-activated
159 /// signal will be emitted for this row.
160 ///
161 /// Readable | Writeable
162 ///
163 ///
164 /// #### `child`
165 /// The child widget.
166 ///
167 /// Readable | Writeable
168 ///
169 ///
170 /// #### `selectable`
171 /// Determines whether this row can be selected.
172 ///
173 /// Readable | Writeable
174 /// </details>
175 /// <details><summary><h4>Widget</h4></summary>
176 ///
177 ///
178 /// #### `can-focus`
179 /// Whether the widget or any of its descendents can accept
180 /// the input focus.
181 ///
182 /// This property is meant to be set by widget implementations,
183 /// typically in their instance init function.
184 ///
185 /// Readable | Writeable
186 ///
187 ///
188 /// #### `can-target`
189 /// Whether the widget can receive pointer events.
190 ///
191 /// Readable | Writeable
192 ///
193 ///
194 /// #### `css-classes`
195 /// A list of css classes applied to this widget.
196 ///
197 /// Readable | Writeable
198 ///
199 ///
200 /// #### `css-name`
201 /// The name of this widget in the CSS tree.
202 ///
203 /// This property is meant to be set by widget implementations,
204 /// typically in their instance init function.
205 ///
206 /// Readable | Writeable | Construct Only
207 ///
208 ///
209 /// #### `cursor`
210 /// The cursor used by @widget.
211 ///
212 /// Readable | Writeable
213 ///
214 ///
215 /// #### `focus-on-click`
216 /// Whether the widget should grab focus when it is clicked with the mouse.
217 ///
218 /// This property is only relevant for widgets that can take focus.
219 ///
220 /// Readable | Writeable
221 ///
222 ///
223 /// #### `focusable`
224 /// Whether this widget itself will accept the input focus.
225 ///
226 /// Readable | Writeable
227 ///
228 ///
229 /// #### `halign`
230 /// How to distribute horizontal space if widget gets extra space.
231 ///
232 /// Readable | Writeable
233 ///
234 ///
235 /// #### `has-default`
236 /// Whether the widget is the default widget.
237 ///
238 /// Readable
239 ///
240 ///
241 /// #### `has-focus`
242 /// Whether the widget has the input focus.
243 ///
244 /// Readable
245 ///
246 ///
247 /// #### `has-tooltip`
248 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
249 /// signal on @widget.
250 ///
251 /// A true value indicates that @widget can have a tooltip, in this case
252 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
253 /// determine whether it will provide a tooltip or not.
254 ///
255 /// Readable | Writeable
256 ///
257 ///
258 /// #### `height-request`
259 /// Overrides for height request of the widget.
260 ///
261 /// If this is -1, the natural request will be used.
262 ///
263 /// Readable | Writeable
264 ///
265 ///
266 /// #### `hexpand`
267 /// Whether to expand horizontally.
268 ///
269 /// Readable | Writeable
270 ///
271 ///
272 /// #### `hexpand-set`
273 /// Whether to use the `hexpand` property.
274 ///
275 /// Readable | Writeable
276 ///
277 ///
278 /// #### `layout-manager`
279 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
280 /// the preferred size of the widget, and allocate its children.
281 ///
282 /// This property is meant to be set by widget implementations,
283 /// typically in their instance init function.
284 ///
285 /// Readable | Writeable
286 ///
287 ///
288 /// #### `limit-events`
289 /// Makes this widget act like a modal dialog, with respect to
290 /// event delivery.
291 ///
292 /// Global event controllers will not handle events with targets
293 /// inside the widget, unless they are set up to ignore propagation
294 /// limits. See `Gtk::EventController::set_propagation_limit()`.
295 ///
296 /// Readable | Writeable
297 ///
298 ///
299 /// #### `margin-bottom`
300 /// Margin on bottom side of widget.
301 ///
302 /// This property adds margin outside of the widget's normal size
303 /// request, the margin will be added in addition to the size from
304 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
305 ///
306 /// Readable | Writeable
307 ///
308 ///
309 /// #### `margin-end`
310 /// Margin on end of widget, horizontally.
311 ///
312 /// This property supports left-to-right and right-to-left text
313 /// directions.
314 ///
315 /// This property adds margin outside of the widget's normal size
316 /// request, the margin will be added in addition to the size from
317 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
318 ///
319 /// Readable | Writeable
320 ///
321 ///
322 /// #### `margin-start`
323 /// Margin on start of widget, horizontally.
324 ///
325 /// This property supports left-to-right and right-to-left text
326 /// directions.
327 ///
328 /// This property adds margin outside of the widget's normal size
329 /// request, the margin will be added in addition to the size from
330 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
331 ///
332 /// Readable | Writeable
333 ///
334 ///
335 /// #### `margin-top`
336 /// Margin on top side of widget.
337 ///
338 /// This property adds margin outside of the widget's normal size
339 /// request, the margin will be added in addition to the size from
340 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
341 ///
342 /// Readable | Writeable
343 ///
344 ///
345 /// #### `name`
346 /// The name of the widget.
347 ///
348 /// Readable | Writeable
349 ///
350 ///
351 /// #### `opacity`
352 /// The requested opacity of the widget.
353 ///
354 /// Readable | Writeable
355 ///
356 ///
357 /// #### `overflow`
358 /// How content outside the widget's content area is treated.
359 ///
360 /// This property is meant to be set by widget implementations,
361 /// typically in their instance init function.
362 ///
363 /// Readable | Writeable
364 ///
365 ///
366 /// #### `parent`
367 /// The parent widget of this widget.
368 ///
369 /// Readable
370 ///
371 ///
372 /// #### `receives-default`
373 /// Whether the widget will receive the default action when it is focused.
374 ///
375 /// Readable | Writeable
376 ///
377 ///
378 /// #### `root`
379 /// The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
380 ///
381 /// This will be `NULL` if the widget is not contained in a root widget.
382 ///
383 /// Readable
384 ///
385 ///
386 /// #### `scale-factor`
387 /// The scale factor of the widget.
388 ///
389 /// Readable
390 ///
391 ///
392 /// #### `sensitive`
393 /// Whether the widget responds to input.
394 ///
395 /// Readable | Writeable
396 ///
397 ///
398 /// #### `tooltip-markup`
399 /// Sets the text of tooltip to be the given string, which is marked up
400 /// with Pango markup.
401 ///
402 /// Also see `Gtk::Tooltip::set_markup()`.
403 ///
404 /// This is a convenience property which will take care of getting the
405 /// tooltip shown if the given string is not `NULL`:
406 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
407 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
408 /// the default signal handler.
409 ///
410 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
411 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
412 ///
413 /// Readable | Writeable
414 ///
415 ///
416 /// #### `tooltip-text`
417 /// Sets the text of tooltip to be the given string.
418 ///
419 /// Also see `Gtk::Tooltip::set_text()`.
420 ///
421 /// This is a convenience property which will take care of getting the
422 /// tooltip shown if the given string is not `NULL`:
423 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
424 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
425 /// the default signal handler.
426 ///
427 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
428 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
429 ///
430 /// Readable | Writeable
431 ///
432 ///
433 /// #### `valign`
434 /// How to distribute vertical space if widget gets extra space.
435 ///
436 /// Readable | Writeable
437 ///
438 ///
439 /// #### `vexpand`
440 /// Whether to expand vertically.
441 ///
442 /// Readable | Writeable
443 ///
444 ///
445 /// #### `vexpand-set`
446 /// Whether to use the `vexpand` property.
447 ///
448 /// Readable | Writeable
449 ///
450 ///
451 /// #### `visible`
452 /// Whether the widget is visible.
453 ///
454 /// Readable | Writeable
455 ///
456 ///
457 /// #### `width-request`
458 /// Overrides for width request of the widget.
459 ///
460 /// If this is -1, the natural request will be used.
461 ///
462 /// Readable | Writeable
463 /// </details>
464 /// <details><summary><h4>Accessible</h4></summary>
465 ///
466 ///
467 /// #### `accessible-role`
468 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
469 ///
470 /// The accessible role cannot be changed once set.
471 ///
472 /// Readable | Writeable
473 /// </details>
474 /// <details><summary><h4>Actionable</h4></summary>
475 ///
476 ///
477 /// #### `action-name`
478 /// The name of the action with which this widget should be associated.
479 ///
480 /// Readable | Writeable
481 ///
482 ///
483 /// #### `action-target`
484 /// The target value of the actionable widget's action.
485 ///
486 /// Readable | Writeable
487 /// </details>
488 /// <details><summary><h4>Editable</h4></summary>
489 ///
490 ///
491 /// #### `cursor-position`
492 /// The current position of the insertion cursor in chars.
493 ///
494 /// Readable
495 ///
496 ///
497 /// #### `editable`
498 /// Whether the entry contents can be edited.
499 ///
500 /// Readable | Writeable
501 ///
502 ///
503 /// #### `enable-undo`
504 /// If undo/redo should be enabled for the editable.
505 ///
506 /// Readable | Writeable
507 ///
508 ///
509 /// #### `max-width-chars`
510 /// The desired maximum width of the entry, in characters.
511 ///
512 /// Readable | Writeable
513 ///
514 ///
515 /// #### `selection-bound`
516 /// The position of the opposite end of the selection from the cursor in chars.
517 ///
518 /// Readable
519 ///
520 ///
521 /// #### `text`
522 /// The contents of the entry.
523 ///
524 /// Readable | Writeable
525 ///
526 ///
527 /// #### `width-chars`
528 /// Number of characters to leave space for in the entry.
529 ///
530 /// Readable | Writeable
531 ///
532 ///
533 /// #### `xalign`
534 /// The horizontal alignment, from 0 (left) to 1 (right).
535 ///
536 /// Reversed for RTL layouts.
537 ///
538 /// Readable | Writeable
539 /// </details>
540 ///
541 /// ## Signals
542 ///
543 ///
544 /// #### `apply`
545 /// Emitted when the apply button is pressed.
546 ///
547 /// See [`show-apply-button`][struct@crate::EntryRow#show-apply-button].
548 ///
549 ///
550 ///
551 ///
552 /// #### `entry-activated`
553 /// Emitted when the embedded entry is activated.
554 ///
555 ///
556 /// <details><summary><h4>ListBoxRow</h4></summary>
557 ///
558 ///
559 /// #### `activate`
560 /// This is a keybinding signal, which will cause this row to be activated.
561 ///
562 /// If you want to be notified when the user activates a row (by key or not),
563 /// use the [`row-activated`][struct@crate::Gtk::ListBox#row-activated] signal on the row’s parent
564 /// `GtkListBox`.
565 ///
566 /// Action
567 /// </details>
568 /// <details><summary><h4>Widget</h4></summary>
569 ///
570 ///
571 /// #### `destroy`
572 /// Signals that all holders of a reference to the widget should release
573 /// the reference that they hold.
574 ///
575 /// May result in finalization of the widget if all references are released.
576 ///
577 /// This signal is not suitable for saving widget state.
578 ///
579 ///
580 ///
581 ///
582 /// #### `direction-changed`
583 /// Emitted when the text direction of a widget changes.
584 ///
585 ///
586 ///
587 ///
588 /// #### `hide`
589 /// Emitted when @widget is hidden.
590 ///
591 ///
592 ///
593 ///
594 /// #### `keynav-failed`
595 /// Emitted if keyboard navigation fails.
596 ///
597 /// See [`WidgetExtManual::keynav_failed()`][crate::gtk::prelude::WidgetExtManual::keynav_failed()] for details.
598 ///
599 ///
600 ///
601 ///
602 /// #### `map`
603 /// Emitted when @widget is going to be mapped.
604 ///
605 /// A widget is mapped when the widget is visible (which is controlled with
606 /// [`visible`][struct@crate::gtk::Widget#visible]) and all its parents up to the toplevel widget
607 /// are also visible.
608 ///
609 /// The `::map` signal can be used to determine whether a widget will be drawn,
610 /// for instance it can resume an animation that was stopped during the
611 /// emission of [`unmap`][struct@crate::gtk::Widget#unmap].
612 ///
613 ///
614 ///
615 ///
616 /// #### `mnemonic-activate`
617 /// Emitted when a widget is activated via a mnemonic.
618 ///
619 /// The default handler for this signal activates @widget if @group_cycling
620 /// is false, or just makes @widget grab focus if @group_cycling is true.
621 ///
622 ///
623 ///
624 ///
625 /// #### `move-focus`
626 /// Emitted when the focus is moved.
627 ///
628 /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
629 ///
630 /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
631 /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
632 ///
633 /// Action
634 ///
635 ///
636 /// #### `query-tooltip`
637 /// Emitted when the widget’s tooltip is about to be shown.
638 ///
639 /// This happens when the [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] property
640 /// is true and the hover timeout has expired with the cursor hovering
641 /// above @widget; or emitted when @widget got focus in keyboard mode.
642 ///
643 /// Using the given coordinates, the signal handler should determine
644 /// whether a tooltip should be shown for @widget. If this is the case
645 /// true should be returned, false otherwise. Note that if @keyboard_mode
646 /// is true, the values of @x and @y are undefined and should not be used.
647 ///
648 /// The signal handler is free to manipulate @tooltip with the therefore
649 /// destined function calls.
650 ///
651 ///
652 ///
653 ///
654 /// #### `realize`
655 /// Emitted when @widget is associated with a `GdkSurface`.
656 ///
657 /// This means that [`WidgetExtManual::realize()`][crate::gtk::prelude::WidgetExtManual::realize()] has been called
658 /// or the widget has been mapped (that is, it is going to be drawn).
659 ///
660 ///
661 ///
662 ///
663 /// #### `show`
664 /// Emitted when @widget is shown.
665 ///
666 ///
667 ///
668 ///
669 /// #### `state-flags-changed`
670 /// Emitted when the widget state changes.
671 ///
672 /// See [`WidgetExtManual::state_flags()`][crate::gtk::prelude::WidgetExtManual::state_flags()].
673 ///
674 ///
675 ///
676 ///
677 /// #### `unmap`
678 /// Emitted when @widget is going to be unmapped.
679 ///
680 /// A widget is unmapped when either it or any of its parents up to the
681 /// toplevel widget have been set as hidden.
682 ///
683 /// As `::unmap` indicates that a widget will not be shown any longer,
684 /// it can be used to, for example, stop an animation on the widget.
685 ///
686 ///
687 ///
688 ///
689 /// #### `unrealize`
690 /// Emitted when the `GdkSurface` associated with @widget is destroyed.
691 ///
692 /// This means that [`WidgetExtManual::unrealize()`][crate::gtk::prelude::WidgetExtManual::unrealize()] has been called
693 /// or the widget has been unmapped (that is, it is going to be hidden).
694 ///
695 ///
696 /// </details>
697 /// <details><summary><h4>Editable</h4></summary>
698 ///
699 ///
700 /// #### `changed`
701 /// Emitted at the end of a single user-visible operation on the
702 /// contents.
703 ///
704 /// E.g., a paste operation that replaces the contents of the
705 /// selection will cause only one signal emission (even though it
706 /// is implemented by first deleting the selection, then inserting
707 /// the new content, and may cause multiple ::notify::text signals
708 /// to be emitted).
709 ///
710 ///
711 ///
712 ///
713 /// #### `delete-text`
714 /// Emitted when text is deleted from the widget by the user.
715 ///
716 /// The default handler for this signal will normally be responsible for
717 /// deleting the text, so by connecting to this signal and then stopping
718 /// the signal with g_signal_stop_emission(), it is possible to modify the
719 /// range of deleted text, or prevent it from being deleted entirely.
720 ///
721 /// The @start_pos and @end_pos parameters are interpreted as for
722 /// [`EditableExtManual::delete_text()`][crate::gtk::prelude::EditableExtManual::delete_text()].
723 ///
724 ///
725 ///
726 ///
727 /// #### `insert-text`
728 /// Emitted when text is inserted into the widget by the user.
729 ///
730 /// The default handler for this signal will normally be responsible
731 /// for inserting the text, so by connecting to this signal and then
732 /// stopping the signal with g_signal_stop_emission(), it is possible
733 /// to modify the inserted text, or prevent it from being inserted entirely.
734 ///
735 ///
736 /// </details>
737 ///
738 /// # Implements
739 ///
740 /// [`EntryRowExt`][trait@crate::prelude::EntryRowExt], [`PreferencesRowExt`][trait@crate::prelude::PreferencesRowExt], [`trait@gtk::prelude::ListBoxRowExt`], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`trait@gtk::prelude::ActionableExt`], [`trait@gtk::prelude::EditableExt`]
741 #[doc(alias = "AdwEntryRow")]
742 pub struct EntryRow(Object<ffi::AdwEntryRow, ffi::AdwEntryRowClass>) @extends PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable, gtk::Editable;
743
744 match fn {
745 type_ => || ffi::adw_entry_row_get_type(),
746 }
747}
748
749impl EntryRow {
750 pub const NONE: Option<&'static EntryRow> = None;
751
752 /// Creates a new [`EntryRow`][crate::EntryRow].
753 ///
754 /// # Returns
755 ///
756 /// the newly created [`EntryRow`][crate::EntryRow]
757 #[doc(alias = "adw_entry_row_new")]
758 pub fn new() -> EntryRow {
759 assert_initialized_main_thread!();
760 unsafe { gtk::Widget::from_glib_none(ffi::adw_entry_row_new()).unsafe_cast() }
761 }
762
763 // rustdoc-stripper-ignore-next
764 /// Creates a new builder-pattern struct instance to construct [`EntryRow`] objects.
765 ///
766 /// This method returns an instance of [`EntryRowBuilder`](crate::builders::EntryRowBuilder) which can be used to create [`EntryRow`] objects.
767 pub fn builder() -> EntryRowBuilder {
768 EntryRowBuilder::new()
769 }
770}
771
772#[cfg(feature = "v1_2")]
773#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
774impl Default for EntryRow {
775 fn default() -> Self {
776 Self::new()
777 }
778}
779
780// rustdoc-stripper-ignore-next
781/// A [builder-pattern] type to construct [`EntryRow`] objects.
782///
783/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
784#[must_use = "The builder must be built to be used"]
785pub struct EntryRowBuilder {
786 builder: glib::object::ObjectBuilder<'static, EntryRow>,
787}
788
789impl EntryRowBuilder {
790 fn new() -> Self {
791 Self {
792 builder: glib::object::Object::builder(),
793 }
794 }
795
796 /// Whether activating the embedded entry can activate the default widget.
797 #[cfg(feature = "v1_2")]
798 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
799 pub fn activates_default(self, activates_default: bool) -> Self {
800 Self {
801 builder: self
802 .builder
803 .property("activates-default", activates_default),
804 }
805 }
806
807 /// A list of Pango attributes to apply to the text of the embedded entry.
808 ///
809 /// The `Pango::Attribute`'s `start_index` and `end_index` must refer to
810 /// the `Gtk::EntryBuffer` text, i.e. without the preedit string.
811 #[cfg(feature = "v1_2")]
812 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
813 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
814 Self {
815 builder: self.builder.property("attributes", attributes.clone()),
816 }
817 }
818
819 /// Whether to suggest emoji replacements on the entry row.
820 ///
821 /// Emoji replacement is done with :-delimited names, like `:heart:`.
822 #[cfg(feature = "v1_2")]
823 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
824 pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
825 Self {
826 builder: self
827 .builder
828 .property("enable-emoji-completion", enable_emoji_completion),
829 }
830 }
831
832 /// Additional input hints for the entry row.
833 ///
834 /// Input hints allow input methods to fine-tune their behavior.
835 ///
836 /// See also: [`input-purpose`][struct@crate::EntryRow#input-purpose]
837 #[cfg(feature = "v1_2")]
838 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
839 pub fn input_hints(self, input_hints: gtk::InputHints) -> Self {
840 Self {
841 builder: self.builder.property("input-hints", input_hints),
842 }
843 }
844
845 /// The input purpose of the entry row.
846 ///
847 /// The input purpose can be used by input methods to adjust their behavior.
848 #[cfg(feature = "v1_2")]
849 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
850 pub fn input_purpose(self, input_purpose: gtk::InputPurpose) -> Self {
851 Self {
852 builder: self.builder.property("input-purpose", input_purpose),
853 }
854 }
855
856 /// Maximum number of characters for the entry.
857 #[cfg(feature = "v1_6")]
858 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
859 pub fn max_length(self, max_length: i32) -> Self {
860 Self {
861 builder: self.builder.property("max-length", max_length),
862 }
863 }
864
865 /// Whether to show the apply button.
866 ///
867 /// When set to `TRUE`, typing text in the entry will reveal an apply button.
868 /// Clicking it or pressing the <kbd>Enter</kbd> key will hide the button and
869 /// emit the [`apply`][struct@crate::EntryRow#apply] signal.
870 ///
871 /// This is useful if changing the entry contents can trigger an expensive
872 /// operation, e.g. network activity, to avoid triggering it after typing every
873 /// character.
874 #[cfg(feature = "v1_2")]
875 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
876 pub fn show_apply_button(self, show_apply_button: bool) -> Self {
877 Self {
878 builder: self
879 .builder
880 .property("show-apply-button", show_apply_button),
881 }
882 }
883
884 /// The title of the preference represented by this row.
885 ///
886 /// The title is interpreted as Pango markup unless
887 /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
888 pub fn title(self, title: impl Into<glib::GString>) -> Self {
889 Self {
890 builder: self.builder.property("title", title.into()),
891 }
892 }
893
894 /// Whether the user can copy the title from the label.
895 ///
896 /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
897 #[cfg(feature = "v1_1")]
898 #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
899 pub fn title_selectable(self, title_selectable: bool) -> Self {
900 Self {
901 builder: self.builder.property("title-selectable", title_selectable),
902 }
903 }
904
905 /// Whether to use Pango markup for the title label.
906 ///
907 /// Subclasses may also use it for other labels, such as subtitle.
908 ///
909 /// See also `parse_markup()`.
910 #[cfg(feature = "v1_2")]
911 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
912 pub fn use_markup(self, use_markup: bool) -> Self {
913 Self {
914 builder: self.builder.property("use-markup", use_markup),
915 }
916 }
917
918 /// Whether an embedded underline in the title indicates a mnemonic.
919 pub fn use_underline(self, use_underline: bool) -> Self {
920 Self {
921 builder: self.builder.property("use-underline", use_underline),
922 }
923 }
924
925 /// Determines whether the ::row-activated
926 /// signal will be emitted for this row.
927 pub fn activatable(self, activatable: bool) -> Self {
928 Self {
929 builder: self.builder.property("activatable", activatable),
930 }
931 }
932
933 /// The child widget.
934 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
935 Self {
936 builder: self.builder.property("child", child.clone().upcast()),
937 }
938 }
939
940 /// Determines whether this row can be selected.
941 pub fn selectable(self, selectable: bool) -> Self {
942 Self {
943 builder: self.builder.property("selectable", selectable),
944 }
945 }
946
947 /// Whether the widget or any of its descendents can accept
948 /// the input focus.
949 ///
950 /// This property is meant to be set by widget implementations,
951 /// typically in their instance init function.
952 pub fn can_focus(self, can_focus: bool) -> Self {
953 Self {
954 builder: self.builder.property("can-focus", can_focus),
955 }
956 }
957
958 /// Whether the widget can receive pointer events.
959 pub fn can_target(self, can_target: bool) -> Self {
960 Self {
961 builder: self.builder.property("can-target", can_target),
962 }
963 }
964
965 /// A list of css classes applied to this widget.
966 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
967 Self {
968 builder: self.builder.property("css-classes", css_classes.into()),
969 }
970 }
971
972 /// The name of this widget in the CSS tree.
973 ///
974 /// This property is meant to be set by widget implementations,
975 /// typically in their instance init function.
976 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
977 Self {
978 builder: self.builder.property("css-name", css_name.into()),
979 }
980 }
981
982 /// The cursor used by @widget.
983 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
984 Self {
985 builder: self.builder.property("cursor", cursor.clone()),
986 }
987 }
988
989 /// Whether the widget should grab focus when it is clicked with the mouse.
990 ///
991 /// This property is only relevant for widgets that can take focus.
992 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
993 Self {
994 builder: self.builder.property("focus-on-click", focus_on_click),
995 }
996 }
997
998 /// Whether this widget itself will accept the input focus.
999 pub fn focusable(self, focusable: bool) -> Self {
1000 Self {
1001 builder: self.builder.property("focusable", focusable),
1002 }
1003 }
1004
1005 /// How to distribute horizontal space if widget gets extra space.
1006 pub fn halign(self, halign: gtk::Align) -> Self {
1007 Self {
1008 builder: self.builder.property("halign", halign),
1009 }
1010 }
1011
1012 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1013 /// signal on @widget.
1014 ///
1015 /// A true value indicates that @widget can have a tooltip, in this case
1016 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1017 /// determine whether it will provide a tooltip or not.
1018 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1019 Self {
1020 builder: self.builder.property("has-tooltip", has_tooltip),
1021 }
1022 }
1023
1024 /// Overrides for height request of the widget.
1025 ///
1026 /// If this is -1, the natural request will be used.
1027 pub fn height_request(self, height_request: i32) -> Self {
1028 Self {
1029 builder: self.builder.property("height-request", height_request),
1030 }
1031 }
1032
1033 /// Whether to expand horizontally.
1034 pub fn hexpand(self, hexpand: bool) -> Self {
1035 Self {
1036 builder: self.builder.property("hexpand", hexpand),
1037 }
1038 }
1039
1040 /// Whether to use the `hexpand` property.
1041 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1042 Self {
1043 builder: self.builder.property("hexpand-set", hexpand_set),
1044 }
1045 }
1046
1047 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1048 /// the preferred size of the widget, and allocate its children.
1049 ///
1050 /// This property is meant to be set by widget implementations,
1051 /// typically in their instance init function.
1052 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1053 Self {
1054 builder: self
1055 .builder
1056 .property("layout-manager", layout_manager.clone().upcast()),
1057 }
1058 }
1059
1060 /// Makes this widget act like a modal dialog, with respect to
1061 /// event delivery.
1062 ///
1063 /// Global event controllers will not handle events with targets
1064 /// inside the widget, unless they are set up to ignore propagation
1065 /// limits. See `Gtk::EventController::set_propagation_limit()`.
1066 #[cfg(feature = "gtk_v4_18")]
1067 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1068 pub fn limit_events(self, limit_events: bool) -> Self {
1069 Self {
1070 builder: self.builder.property("limit-events", limit_events),
1071 }
1072 }
1073
1074 /// Margin on bottom side of widget.
1075 ///
1076 /// This property adds margin outside of the widget's normal size
1077 /// request, the margin will be added in addition to the size from
1078 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1079 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1080 Self {
1081 builder: self.builder.property("margin-bottom", margin_bottom),
1082 }
1083 }
1084
1085 /// Margin on end of widget, horizontally.
1086 ///
1087 /// This property supports left-to-right and right-to-left text
1088 /// directions.
1089 ///
1090 /// This property adds margin outside of the widget's normal size
1091 /// request, the margin will be added in addition to the size from
1092 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1093 pub fn margin_end(self, margin_end: i32) -> Self {
1094 Self {
1095 builder: self.builder.property("margin-end", margin_end),
1096 }
1097 }
1098
1099 /// Margin on start of widget, horizontally.
1100 ///
1101 /// This property supports left-to-right and right-to-left text
1102 /// directions.
1103 ///
1104 /// This property adds margin outside of the widget's normal size
1105 /// request, the margin will be added in addition to the size from
1106 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1107 pub fn margin_start(self, margin_start: i32) -> Self {
1108 Self {
1109 builder: self.builder.property("margin-start", margin_start),
1110 }
1111 }
1112
1113 /// Margin on top side of widget.
1114 ///
1115 /// This property adds margin outside of the widget's normal size
1116 /// request, the margin will be added in addition to the size from
1117 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1118 pub fn margin_top(self, margin_top: i32) -> Self {
1119 Self {
1120 builder: self.builder.property("margin-top", margin_top),
1121 }
1122 }
1123
1124 /// The name of the widget.
1125 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1126 Self {
1127 builder: self.builder.property("name", name.into()),
1128 }
1129 }
1130
1131 /// The requested opacity of the widget.
1132 pub fn opacity(self, opacity: f64) -> Self {
1133 Self {
1134 builder: self.builder.property("opacity", opacity),
1135 }
1136 }
1137
1138 /// How content outside the widget's content area is treated.
1139 ///
1140 /// This property is meant to be set by widget implementations,
1141 /// typically in their instance init function.
1142 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1143 Self {
1144 builder: self.builder.property("overflow", overflow),
1145 }
1146 }
1147
1148 /// Whether the widget will receive the default action when it is focused.
1149 pub fn receives_default(self, receives_default: bool) -> Self {
1150 Self {
1151 builder: self.builder.property("receives-default", receives_default),
1152 }
1153 }
1154
1155 /// Whether the widget responds to input.
1156 pub fn sensitive(self, sensitive: bool) -> Self {
1157 Self {
1158 builder: self.builder.property("sensitive", sensitive),
1159 }
1160 }
1161
1162 /// Sets the text of tooltip to be the given string, which is marked up
1163 /// with Pango markup.
1164 ///
1165 /// Also see `Gtk::Tooltip::set_markup()`.
1166 ///
1167 /// This is a convenience property which will take care of getting the
1168 /// tooltip shown if the given string is not `NULL`:
1169 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1170 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1171 /// the default signal handler.
1172 ///
1173 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1174 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1175 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1176 Self {
1177 builder: self
1178 .builder
1179 .property("tooltip-markup", tooltip_markup.into()),
1180 }
1181 }
1182
1183 /// Sets the text of tooltip to be the given string.
1184 ///
1185 /// Also see `Gtk::Tooltip::set_text()`.
1186 ///
1187 /// This is a convenience property which will take care of getting the
1188 /// tooltip shown if the given string is not `NULL`:
1189 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1190 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1191 /// the default signal handler.
1192 ///
1193 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1194 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1195 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1196 Self {
1197 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1198 }
1199 }
1200
1201 /// How to distribute vertical space if widget gets extra space.
1202 pub fn valign(self, valign: gtk::Align) -> Self {
1203 Self {
1204 builder: self.builder.property("valign", valign),
1205 }
1206 }
1207
1208 /// Whether to expand vertically.
1209 pub fn vexpand(self, vexpand: bool) -> Self {
1210 Self {
1211 builder: self.builder.property("vexpand", vexpand),
1212 }
1213 }
1214
1215 /// Whether to use the `vexpand` property.
1216 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1217 Self {
1218 builder: self.builder.property("vexpand-set", vexpand_set),
1219 }
1220 }
1221
1222 /// Whether the widget is visible.
1223 pub fn visible(self, visible: bool) -> Self {
1224 Self {
1225 builder: self.builder.property("visible", visible),
1226 }
1227 }
1228
1229 /// Overrides for width request of the widget.
1230 ///
1231 /// If this is -1, the natural request will be used.
1232 pub fn width_request(self, width_request: i32) -> Self {
1233 Self {
1234 builder: self.builder.property("width-request", width_request),
1235 }
1236 }
1237
1238 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1239 ///
1240 /// The accessible role cannot be changed once set.
1241 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1242 Self {
1243 builder: self.builder.property("accessible-role", accessible_role),
1244 }
1245 }
1246
1247 /// The name of the action with which this widget should be associated.
1248 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1249 Self {
1250 builder: self.builder.property("action-name", action_name.into()),
1251 }
1252 }
1253
1254 /// The target value of the actionable widget's action.
1255 pub fn action_target(self, action_target: &glib::Variant) -> Self {
1256 Self {
1257 builder: self
1258 .builder
1259 .property("action-target", action_target.clone()),
1260 }
1261 }
1262
1263 /// Whether the entry contents can be edited.
1264 pub fn editable(self, editable: bool) -> Self {
1265 Self {
1266 builder: self.builder.property("editable", editable),
1267 }
1268 }
1269
1270 /// If undo/redo should be enabled for the editable.
1271 pub fn enable_undo(self, enable_undo: bool) -> Self {
1272 Self {
1273 builder: self.builder.property("enable-undo", enable_undo),
1274 }
1275 }
1276
1277 /// The desired maximum width of the entry, in characters.
1278 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1279 Self {
1280 builder: self.builder.property("max-width-chars", max_width_chars),
1281 }
1282 }
1283
1284 /// The contents of the entry.
1285 pub fn text(self, text: impl Into<glib::GString>) -> Self {
1286 Self {
1287 builder: self.builder.property("text", text.into()),
1288 }
1289 }
1290
1291 /// Number of characters to leave space for in the entry.
1292 pub fn width_chars(self, width_chars: i32) -> Self {
1293 Self {
1294 builder: self.builder.property("width-chars", width_chars),
1295 }
1296 }
1297
1298 /// The horizontal alignment, from 0 (left) to 1 (right).
1299 ///
1300 /// Reversed for RTL layouts.
1301 pub fn xalign(self, xalign: f32) -> Self {
1302 Self {
1303 builder: self.builder.property("xalign", xalign),
1304 }
1305 }
1306
1307 // rustdoc-stripper-ignore-next
1308 /// Build the [`EntryRow`].
1309 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1310 pub fn build(self) -> EntryRow {
1311 assert_initialized_main_thread!();
1312 self.builder.build()
1313 }
1314}
1315
1316/// Trait containing all [`struct@EntryRow`] methods.
1317///
1318/// # Implementors
1319///
1320/// [`EntryRow`][struct@crate::EntryRow], [`PasswordEntryRow`][struct@crate::PasswordEntryRow]
1321pub trait EntryRowExt: IsA<EntryRow> + 'static {
1322 /// Adds a prefix widget to @self.
1323 /// ## `widget`
1324 /// a widget
1325 #[doc(alias = "adw_entry_row_add_prefix")]
1326 fn add_prefix(&self, widget: &impl IsA<gtk::Widget>) {
1327 unsafe {
1328 ffi::adw_entry_row_add_prefix(
1329 self.as_ref().to_glib_none().0,
1330 widget.as_ref().to_glib_none().0,
1331 );
1332 }
1333 }
1334
1335 /// Adds a suffix widget to @self.
1336 /// ## `widget`
1337 /// a widget
1338 #[doc(alias = "adw_entry_row_add_suffix")]
1339 fn add_suffix(&self, widget: &impl IsA<gtk::Widget>) {
1340 unsafe {
1341 ffi::adw_entry_row_add_suffix(
1342 self.as_ref().to_glib_none().0,
1343 widget.as_ref().to_glib_none().0,
1344 );
1345 }
1346 }
1347
1348 /// Gets whether activating the embedded entry can activate the default widget.
1349 ///
1350 /// # Returns
1351 ///
1352 /// whether to activate the default widget
1353 #[doc(alias = "adw_entry_row_get_activates_default")]
1354 #[doc(alias = "get_activates_default")]
1355 #[doc(alias = "activates-default")]
1356 fn activates_default(&self) -> bool {
1357 unsafe {
1358 from_glib(ffi::adw_entry_row_get_activates_default(
1359 self.as_ref().to_glib_none().0,
1360 ))
1361 }
1362 }
1363
1364 /// Gets Pango attributes applied to the text of the embedded entry.
1365 ///
1366 /// # Returns
1367 ///
1368 /// the list of attributes
1369 #[doc(alias = "adw_entry_row_get_attributes")]
1370 #[doc(alias = "get_attributes")]
1371 fn attributes(&self) -> Option<pango::AttrList> {
1372 unsafe {
1373 from_glib_full(ffi::adw_entry_row_get_attributes(
1374 self.as_ref().to_glib_none().0,
1375 ))
1376 }
1377 }
1378
1379 /// Gets whether to suggest emoji replacements on @self.
1380 ///
1381 /// # Returns
1382 ///
1383 /// whether or not emoji completion is enabled
1384 #[doc(alias = "adw_entry_row_get_enable_emoji_completion")]
1385 #[doc(alias = "get_enable_emoji_completion")]
1386 #[doc(alias = "enable-emoji-completion")]
1387 fn enables_emoji_completion(&self) -> bool {
1388 unsafe {
1389 from_glib(ffi::adw_entry_row_get_enable_emoji_completion(
1390 self.as_ref().to_glib_none().0,
1391 ))
1392 }
1393 }
1394
1395 /// Gets the additional input hints of @self.
1396 ///
1397 /// # Returns
1398 ///
1399 /// The input hints
1400 #[doc(alias = "adw_entry_row_get_input_hints")]
1401 #[doc(alias = "get_input_hints")]
1402 #[doc(alias = "input-hints")]
1403 fn input_hints(&self) -> gtk::InputHints {
1404 unsafe {
1405 from_glib(ffi::adw_entry_row_get_input_hints(
1406 self.as_ref().to_glib_none().0,
1407 ))
1408 }
1409 }
1410
1411 /// Gets the input purpose of @self.
1412 ///
1413 /// # Returns
1414 ///
1415 /// the input purpose
1416 #[doc(alias = "adw_entry_row_get_input_purpose")]
1417 #[doc(alias = "get_input_purpose")]
1418 #[doc(alias = "input-purpose")]
1419 fn input_purpose(&self) -> gtk::InputPurpose {
1420 unsafe {
1421 from_glib(ffi::adw_entry_row_get_input_purpose(
1422 self.as_ref().to_glib_none().0,
1423 ))
1424 }
1425 }
1426
1427 /// Retrieves the maximum length of the entry.
1428 ///
1429 /// # Returns
1430 ///
1431 /// The maximum length of the entry.
1432 #[cfg(feature = "v1_6")]
1433 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1434 #[doc(alias = "adw_entry_row_get_max_length")]
1435 #[doc(alias = "get_max_length")]
1436 #[doc(alias = "max-length")]
1437 fn max_length(&self) -> i32 {
1438 unsafe { ffi::adw_entry_row_get_max_length(self.as_ref().to_glib_none().0) }
1439 }
1440
1441 /// Gets whether @self can show the apply button.
1442 ///
1443 /// # Returns
1444 ///
1445 /// whether to show the apply button
1446 #[doc(alias = "adw_entry_row_get_show_apply_button")]
1447 #[doc(alias = "get_show_apply_button")]
1448 #[doc(alias = "show-apply-button")]
1449 fn shows_apply_button(&self) -> bool {
1450 unsafe {
1451 from_glib(ffi::adw_entry_row_get_show_apply_button(
1452 self.as_ref().to_glib_none().0,
1453 ))
1454 }
1455 }
1456
1457 /// Retrieves the current length of the text in @self.
1458 ///
1459 /// # Returns
1460 ///
1461 /// The current number of characters in @self, or 0 if there are none.
1462 #[cfg(feature = "v1_5")]
1463 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1464 #[doc(alias = "adw_entry_row_get_text_length")]
1465 #[doc(alias = "get_text_length")]
1466 #[doc(alias = "text-length")]
1467 fn text_length(&self) -> u32 {
1468 unsafe { ffi::adw_entry_row_get_text_length(self.as_ref().to_glib_none().0) }
1469 }
1470
1471 /// Causes @self to have keyboard focus without selecting the text.
1472 ///
1473 /// See `Gtk::Text::grab_focus_without_selecting()` for more information.
1474 ///
1475 /// # Returns
1476 ///
1477 /// whether the focus is now inside @self
1478 #[cfg(feature = "v1_3")]
1479 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
1480 #[doc(alias = "adw_entry_row_grab_focus_without_selecting")]
1481 fn grab_focus_without_selecting(&self) -> bool {
1482 unsafe {
1483 from_glib(ffi::adw_entry_row_grab_focus_without_selecting(
1484 self.as_ref().to_glib_none().0,
1485 ))
1486 }
1487 }
1488
1489 /// Removes a child from @self.
1490 /// ## `widget`
1491 /// the child to be removed
1492 #[doc(alias = "adw_entry_row_remove")]
1493 fn remove(&self, widget: &impl IsA<gtk::Widget>) {
1494 unsafe {
1495 ffi::adw_entry_row_remove(
1496 self.as_ref().to_glib_none().0,
1497 widget.as_ref().to_glib_none().0,
1498 );
1499 }
1500 }
1501
1502 /// Sets whether activating the embedded entry can activate the default widget.
1503 /// ## `activates`
1504 /// whether to activate the default widget
1505 #[doc(alias = "adw_entry_row_set_activates_default")]
1506 #[doc(alias = "activates-default")]
1507 fn set_activates_default(&self, activates: bool) {
1508 unsafe {
1509 ffi::adw_entry_row_set_activates_default(
1510 self.as_ref().to_glib_none().0,
1511 activates.into_glib(),
1512 );
1513 }
1514 }
1515
1516 /// Sets Pango attributes to apply to the text of the embedded entry.
1517 ///
1518 /// The `Pango::Attribute`'s `start_index` and `end_index` must refer to
1519 /// the `Gtk::EntryBuffer` text, i.e. without the preedit string.
1520 /// ## `attributes`
1521 /// a list of attributes
1522 #[doc(alias = "adw_entry_row_set_attributes")]
1523 #[doc(alias = "attributes")]
1524 fn set_attributes(&self, attributes: Option<&pango::AttrList>) {
1525 unsafe {
1526 ffi::adw_entry_row_set_attributes(
1527 self.as_ref().to_glib_none().0,
1528 attributes.to_glib_none().0,
1529 );
1530 }
1531 }
1532
1533 /// Sets whether to suggest emoji replacements on @self.
1534 ///
1535 /// Emoji replacement is done with :-delimited names, like `:heart:`.
1536 /// ## `enable_emoji_completion`
1537 /// Whether emoji completion should be enabled or not
1538 #[doc(alias = "adw_entry_row_set_enable_emoji_completion")]
1539 #[doc(alias = "enable-emoji-completion")]
1540 fn set_enable_emoji_completion(&self, enable_emoji_completion: bool) {
1541 unsafe {
1542 ffi::adw_entry_row_set_enable_emoji_completion(
1543 self.as_ref().to_glib_none().0,
1544 enable_emoji_completion.into_glib(),
1545 );
1546 }
1547 }
1548
1549 /// Set additional input hints for @self.
1550 ///
1551 /// Input hints allow input methods to fine-tune their behavior.
1552 ///
1553 /// See also: [`input-purpose`][struct@crate::AdwEntryRow#input-purpose]
1554 /// ## `hints`
1555 /// the hints
1556 #[doc(alias = "adw_entry_row_set_input_hints")]
1557 #[doc(alias = "input-hints")]
1558 fn set_input_hints(&self, hints: gtk::InputHints) {
1559 unsafe {
1560 ffi::adw_entry_row_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
1561 }
1562 }
1563
1564 /// Sets the input purpose of @self.
1565 ///
1566 /// The input purpose can be used by input methods to adjust their behavior.
1567 /// ## `purpose`
1568 /// the purpose
1569 #[doc(alias = "adw_entry_row_set_input_purpose")]
1570 #[doc(alias = "input-purpose")]
1571 fn set_input_purpose(&self, purpose: gtk::InputPurpose) {
1572 unsafe {
1573 ffi::adw_entry_row_set_input_purpose(
1574 self.as_ref().to_glib_none().0,
1575 purpose.into_glib(),
1576 );
1577 }
1578 }
1579
1580 /// Sets the maximum length of the entry.
1581 /// ## `max_length`
1582 /// maximum length of the entry
1583 #[cfg(feature = "v1_6")]
1584 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1585 #[doc(alias = "adw_entry_row_set_max_length")]
1586 #[doc(alias = "max-length")]
1587 fn set_max_length(&self, max_length: i32) {
1588 unsafe {
1589 ffi::adw_entry_row_set_max_length(self.as_ref().to_glib_none().0, max_length);
1590 }
1591 }
1592
1593 /// Sets whether @self can show the apply button.
1594 ///
1595 /// When set to `TRUE`, typing text in the entry will reveal an apply button.
1596 /// Clicking it or pressing the <kbd>Enter</kbd> key will hide the button and
1597 /// emit the [`apply`][struct@crate::EntryRow#apply] signal.
1598 ///
1599 /// This is useful if changing the entry contents can trigger an expensive
1600 /// operation, e.g. network activity, to avoid triggering it after typing every
1601 /// character.
1602 /// ## `show_apply_button`
1603 /// whether to show the apply button
1604 #[doc(alias = "adw_entry_row_set_show_apply_button")]
1605 #[doc(alias = "show-apply-button")]
1606 fn set_show_apply_button(&self, show_apply_button: bool) {
1607 unsafe {
1608 ffi::adw_entry_row_set_show_apply_button(
1609 self.as_ref().to_glib_none().0,
1610 show_apply_button.into_glib(),
1611 );
1612 }
1613 }
1614
1615 /// Emitted when the apply button is pressed.
1616 ///
1617 /// See [`show-apply-button`][struct@crate::EntryRow#show-apply-button].
1618 #[cfg(feature = "v1_2")]
1619 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1620 #[doc(alias = "apply")]
1621 fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1622 unsafe extern "C" fn apply_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1623 this: *mut ffi::AdwEntryRow,
1624 f: glib::ffi::gpointer,
1625 ) {
1626 let f: &F = &*(f as *const F);
1627 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1628 }
1629 unsafe {
1630 let f: Box_<F> = Box_::new(f);
1631 connect_raw(
1632 self.as_ptr() as *mut _,
1633 c"apply".as_ptr() as *const _,
1634 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1635 apply_trampoline::<Self, F> as *const (),
1636 )),
1637 Box_::into_raw(f),
1638 )
1639 }
1640 }
1641
1642 /// Emitted when the embedded entry is activated.
1643 #[cfg(feature = "v1_2")]
1644 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1645 #[doc(alias = "entry-activated")]
1646 fn connect_entry_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1647 unsafe extern "C" fn entry_activated_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1648 this: *mut ffi::AdwEntryRow,
1649 f: glib::ffi::gpointer,
1650 ) {
1651 let f: &F = &*(f as *const F);
1652 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1653 }
1654 unsafe {
1655 let f: Box_<F> = Box_::new(f);
1656 connect_raw(
1657 self.as_ptr() as *mut _,
1658 c"entry-activated".as_ptr() as *const _,
1659 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1660 entry_activated_trampoline::<Self, F> as *const (),
1661 )),
1662 Box_::into_raw(f),
1663 )
1664 }
1665 }
1666
1667 #[cfg(feature = "v1_2")]
1668 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1669 #[doc(alias = "activates-default")]
1670 fn connect_activates_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1671 unsafe extern "C" fn notify_activates_default_trampoline<
1672 P: IsA<EntryRow>,
1673 F: Fn(&P) + 'static,
1674 >(
1675 this: *mut ffi::AdwEntryRow,
1676 _param_spec: glib::ffi::gpointer,
1677 f: glib::ffi::gpointer,
1678 ) {
1679 let f: &F = &*(f as *const F);
1680 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1681 }
1682 unsafe {
1683 let f: Box_<F> = Box_::new(f);
1684 connect_raw(
1685 self.as_ptr() as *mut _,
1686 c"notify::activates-default".as_ptr() as *const _,
1687 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1688 notify_activates_default_trampoline::<Self, F> as *const (),
1689 )),
1690 Box_::into_raw(f),
1691 )
1692 }
1693 }
1694
1695 #[cfg(feature = "v1_2")]
1696 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1697 #[doc(alias = "attributes")]
1698 fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1699 unsafe extern "C" fn notify_attributes_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1700 this: *mut ffi::AdwEntryRow,
1701 _param_spec: glib::ffi::gpointer,
1702 f: glib::ffi::gpointer,
1703 ) {
1704 let f: &F = &*(f as *const F);
1705 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1706 }
1707 unsafe {
1708 let f: Box_<F> = Box_::new(f);
1709 connect_raw(
1710 self.as_ptr() as *mut _,
1711 c"notify::attributes".as_ptr() as *const _,
1712 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1713 notify_attributes_trampoline::<Self, F> as *const (),
1714 )),
1715 Box_::into_raw(f),
1716 )
1717 }
1718 }
1719
1720 #[cfg(feature = "v1_2")]
1721 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1722 #[doc(alias = "enable-emoji-completion")]
1723 fn connect_enable_emoji_completion_notify<F: Fn(&Self) + 'static>(
1724 &self,
1725 f: F,
1726 ) -> SignalHandlerId {
1727 unsafe extern "C" fn notify_enable_emoji_completion_trampoline<
1728 P: IsA<EntryRow>,
1729 F: Fn(&P) + 'static,
1730 >(
1731 this: *mut ffi::AdwEntryRow,
1732 _param_spec: glib::ffi::gpointer,
1733 f: glib::ffi::gpointer,
1734 ) {
1735 let f: &F = &*(f as *const F);
1736 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1737 }
1738 unsafe {
1739 let f: Box_<F> = Box_::new(f);
1740 connect_raw(
1741 self.as_ptr() as *mut _,
1742 c"notify::enable-emoji-completion".as_ptr() as *const _,
1743 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1744 notify_enable_emoji_completion_trampoline::<Self, F> as *const (),
1745 )),
1746 Box_::into_raw(f),
1747 )
1748 }
1749 }
1750
1751 #[cfg(feature = "v1_2")]
1752 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1753 #[doc(alias = "input-hints")]
1754 fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1755 unsafe extern "C" fn notify_input_hints_trampoline<
1756 P: IsA<EntryRow>,
1757 F: Fn(&P) + 'static,
1758 >(
1759 this: *mut ffi::AdwEntryRow,
1760 _param_spec: glib::ffi::gpointer,
1761 f: glib::ffi::gpointer,
1762 ) {
1763 let f: &F = &*(f as *const F);
1764 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1765 }
1766 unsafe {
1767 let f: Box_<F> = Box_::new(f);
1768 connect_raw(
1769 self.as_ptr() as *mut _,
1770 c"notify::input-hints".as_ptr() as *const _,
1771 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1772 notify_input_hints_trampoline::<Self, F> as *const (),
1773 )),
1774 Box_::into_raw(f),
1775 )
1776 }
1777 }
1778
1779 #[cfg(feature = "v1_2")]
1780 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1781 #[doc(alias = "input-purpose")]
1782 fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1783 unsafe extern "C" fn notify_input_purpose_trampoline<
1784 P: IsA<EntryRow>,
1785 F: Fn(&P) + 'static,
1786 >(
1787 this: *mut ffi::AdwEntryRow,
1788 _param_spec: glib::ffi::gpointer,
1789 f: glib::ffi::gpointer,
1790 ) {
1791 let f: &F = &*(f as *const F);
1792 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1793 }
1794 unsafe {
1795 let f: Box_<F> = Box_::new(f);
1796 connect_raw(
1797 self.as_ptr() as *mut _,
1798 c"notify::input-purpose".as_ptr() as *const _,
1799 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1800 notify_input_purpose_trampoline::<Self, F> as *const (),
1801 )),
1802 Box_::into_raw(f),
1803 )
1804 }
1805 }
1806
1807 #[cfg(feature = "v1_6")]
1808 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1809 #[doc(alias = "max-length")]
1810 fn connect_max_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1811 unsafe extern "C" fn notify_max_length_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1812 this: *mut ffi::AdwEntryRow,
1813 _param_spec: glib::ffi::gpointer,
1814 f: glib::ffi::gpointer,
1815 ) {
1816 let f: &F = &*(f as *const F);
1817 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1818 }
1819 unsafe {
1820 let f: Box_<F> = Box_::new(f);
1821 connect_raw(
1822 self.as_ptr() as *mut _,
1823 c"notify::max-length".as_ptr() as *const _,
1824 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1825 notify_max_length_trampoline::<Self, F> as *const (),
1826 )),
1827 Box_::into_raw(f),
1828 )
1829 }
1830 }
1831
1832 #[cfg(feature = "v1_2")]
1833 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1834 #[doc(alias = "show-apply-button")]
1835 fn connect_show_apply_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1836 unsafe extern "C" fn notify_show_apply_button_trampoline<
1837 P: IsA<EntryRow>,
1838 F: Fn(&P) + 'static,
1839 >(
1840 this: *mut ffi::AdwEntryRow,
1841 _param_spec: glib::ffi::gpointer,
1842 f: glib::ffi::gpointer,
1843 ) {
1844 let f: &F = &*(f as *const F);
1845 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1846 }
1847 unsafe {
1848 let f: Box_<F> = Box_::new(f);
1849 connect_raw(
1850 self.as_ptr() as *mut _,
1851 c"notify::show-apply-button".as_ptr() as *const _,
1852 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1853 notify_show_apply_button_trampoline::<Self, F> as *const (),
1854 )),
1855 Box_::into_raw(f),
1856 )
1857 }
1858 }
1859
1860 #[cfg(feature = "v1_5")]
1861 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1862 #[doc(alias = "text-length")]
1863 fn connect_text_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1864 unsafe extern "C" fn notify_text_length_trampoline<
1865 P: IsA<EntryRow>,
1866 F: Fn(&P) + 'static,
1867 >(
1868 this: *mut ffi::AdwEntryRow,
1869 _param_spec: glib::ffi::gpointer,
1870 f: glib::ffi::gpointer,
1871 ) {
1872 let f: &F = &*(f as *const F);
1873 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1874 }
1875 unsafe {
1876 let f: Box_<F> = Box_::new(f);
1877 connect_raw(
1878 self.as_ptr() as *mut _,
1879 c"notify::text-length".as_ptr() as *const _,
1880 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1881 notify_text_length_trampoline::<Self, F> as *const (),
1882 )),
1883 Box_::into_raw(f),
1884 )
1885 }
1886 }
1887}
1888
1889impl<O: IsA<EntryRow>> EntryRowExt for O {}