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