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 /// #### `max-width-chars`
488 /// The desired maximum width of the entry, in characters.
489 ///
490 /// Readable | Writable
491 ///
492 ///
493 /// #### `selection-bound`
494 /// The position of the opposite end of the selection from the cursor in chars.
495 ///
496 /// Readable
497 ///
498 ///
499 /// #### `text`
500 /// The contents of the entry.
501 ///
502 /// Readable | Writable
503 ///
504 ///
505 /// #### `width-chars`
506 /// Number of characters to leave space for in the entry.
507 ///
508 /// Readable | Writable
509 ///
510 ///
511 /// #### `xalign`
512 /// The horizontal alignment, from 0 (left) to 1 (right).
513 ///
514 /// Reversed for RTL layouts.
515 ///
516 /// Readable | Writable
517 /// </details>
518 ///
519 /// ## Signals
520 ///
521 ///
522 /// #### `apply`
523 /// Emitted when the apply button is pressed.
524 ///
525 /// See [`show-apply-button`][struct@crate::EntryRow#show-apply-button].
526 ///
527 ///
528 ///
529 ///
530 /// #### `entry-activated`
531 /// Emitted when the embedded entry is activated.
532 ///
533 ///
534 /// <details><summary><h4>ListBoxRow</h4></summary>
535 ///
536 ///
537 /// #### `activate`
538 /// s parent
539 /// `GtkListBox`.
540 ///
541 /// Action
542 /// </details>
543 /// <details><summary><h4>Widget</h4></summary>
544 ///
545 ///
546 /// #### `destroy`
547 /// Signals that all holders of a reference to the widget should release
548 /// the reference that they hold.
549 ///
550 /// May result in finalization of the widget if all references are released.
551 ///
552 /// This signal is not suitable for saving widget state.
553 ///
554 ///
555 ///
556 ///
557 /// #### `direction-changed`
558 /// Emitted when the text direction of a widget changes.
559 ///
560 ///
561 ///
562 ///
563 /// #### `hide`
564 /// Emitted when @widget is hidden.
565 ///
566 ///
567 ///
568 ///
569 /// #### `keynav-failed`
570 /// Emitted if keyboard navigation fails.
571 ///
572 /// See [`WidgetExtManual::keynav_failed()`][crate::gtk::prelude::WidgetExtManual::keynav_failed()] for details.
573 ///
574 ///
575 ///
576 ///
577 /// #### `map`
578 /// Emitted when @widget is going to be mapped.
579 ///
580 /// A widget is mapped when the widget is visible (which is controlled with
581 /// [`visible`][struct@crate::gtk::Widget#visible]) and all its parents up to the toplevel widget
582 /// are also visible.
583 ///
584 /// The `::map` signal can be used to determine whether a widget will be drawn,
585 /// for instance it can resume an animation that was stopped during the
586 /// emission of [`unmap`][struct@crate::gtk::Widget#unmap].
587 ///
588 ///
589 ///
590 ///
591 /// #### `mnemonic-activate`
592 /// Emitted when a widget is activated via a mnemonic.
593 ///
594 /// The default handler for this signal activates @widget if @group_cycling
595 /// is false, or just makes @widget grab focus if @group_cycling is true.
596 ///
597 ///
598 ///
599 ///
600 /// #### `move-focus`
601 /// to move backward.
602 ///
603 /// Action
604 ///
605 ///
606 /// #### `query-tooltip`
607 /// s tooltip is about to be shown.
608 ///
609 /// This happens when the [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] property
610 /// is true and the hover timeout has expired with the cursor hovering
611 /// above @widget; or emitted when @widget got focus in keyboard mode.
612 ///
613 /// Using the given coordinates, the signal handler should determine
614 /// whether a tooltip should be shown for @widget. If this is the case
615 /// true should be returned, false otherwise. Note that if @keyboard_mode
616 /// is true, the values of @x and @y are undefined and should not be used.
617 ///
618 /// The signal handler is free to manipulate @tooltip with the therefore
619 /// destined function calls.
620 ///
621 ///
622 ///
623 ///
624 /// #### `realize`
625 /// Emitted when @widget is associated with a `GdkSurface`.
626 ///
627 /// This means that [`WidgetExtManual::realize()`][crate::gtk::prelude::WidgetExtManual::realize()] has been called
628 /// or the widget has been mapped (that is, it is going to be drawn).
629 ///
630 ///
631 ///
632 ///
633 /// #### `show`
634 /// Emitted when @widget is shown.
635 ///
636 ///
637 ///
638 ///
639 /// #### `state-flags-changed`
640 /// Emitted when the widget state changes.
641 ///
642 /// See [`WidgetExtManual::state_flags()`][crate::gtk::prelude::WidgetExtManual::state_flags()].
643 ///
644 ///
645 ///
646 ///
647 /// #### `unmap`
648 /// Emitted when @widget is going to be unmapped.
649 ///
650 /// A widget is unmapped when either it or any of its parents up to the
651 /// toplevel widget have been set as hidden.
652 ///
653 /// As `::unmap` indicates that a widget will not be shown any longer,
654 /// it can be used to, for example, stop an animation on the widget.
655 ///
656 ///
657 ///
658 ///
659 /// #### `unrealize`
660 /// Emitted when the `GdkSurface` associated with @widget is destroyed.
661 ///
662 /// This means that [`WidgetExtManual::unrealize()`][crate::gtk::prelude::WidgetExtManual::unrealize()] has been called
663 /// or the widget has been unmapped (that is, it is going to be hidden).
664 ///
665 ///
666 /// </details>
667 /// <details><summary><h4>Editable</h4></summary>
668 ///
669 ///
670 /// #### `changed`
671 /// Emitted at the end of a single user-visible operation on the
672 /// contents.
673 ///
674 /// E.g., a paste operation that replaces the contents of the
675 /// selection will cause only one signal emission (even though it
676 /// is implemented by first deleting the selection, then inserting
677 /// the new content, and may cause multiple ::notify::text signals
678 /// to be emitted).
679 ///
680 ///
681 ///
682 ///
683 /// #### `delete-text`
684 /// Emitted when text is deleted from the widget by the user.
685 ///
686 /// The default handler for this signal will normally be responsible for
687 /// deleting the text, so by connecting to this signal and then stopping
688 /// the signal with g_signal_stop_emission(), it is possible to modify the
689 /// range of deleted text, or prevent it from being deleted entirely.
690 ///
691 /// The @start_pos and @end_pos parameters are interpreted as for
692 /// [`EditableExtManual::delete_text()`][crate::gtk::prelude::EditableExtManual::delete_text()].
693 ///
694 ///
695 ///
696 ///
697 /// #### `insert-text`
698 /// Emitted when text is inserted into the widget by the user.
699 ///
700 /// The default handler for this signal will normally be responsible
701 /// for inserting the text, so by connecting to this signal and then
702 /// stopping the signal with g_signal_stop_emission(), it is possible
703 /// to modify the inserted text, or prevent it from being inserted entirely.
704 ///
705 ///
706 /// </details>
707 ///
708 /// # Implements
709 ///
710 /// [`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`]
711 #[doc(alias = "AdwEntryRow")]
712 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;
713
714 match fn {
715 type_ => || ffi::adw_entry_row_get_type(),
716 }
717}
718
719#[cfg(not(feature = "gtk_v4_10"))]
720glib::wrapper! {
721 #[doc(alias = "AdwEntryRow")]
722 pub struct EntryRow(Object<ffi::AdwEntryRow, ffi::AdwEntryRowClass>) @extends PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable, gtk::Editable;
723
724 match fn {
725 type_ => || ffi::adw_entry_row_get_type(),
726 }
727}
728
729impl EntryRow {
730 pub const NONE: Option<&'static EntryRow> = None;
731
732 /// Creates a new [`EntryRow`][crate::EntryRow].
733 ///
734 /// # Returns
735 ///
736 /// the newly created [`EntryRow`][crate::EntryRow]
737 #[doc(alias = "adw_entry_row_new")]
738 pub fn new() -> EntryRow {
739 assert_initialized_main_thread!();
740 unsafe { gtk::Widget::from_glib_none(ffi::adw_entry_row_new()).unsafe_cast() }
741 }
742
743 // rustdoc-stripper-ignore-next
744 /// Creates a new builder-pattern struct instance to construct [`EntryRow`] objects.
745 ///
746 /// This method returns an instance of [`EntryRowBuilder`](crate::builders::EntryRowBuilder) which can be used to create [`EntryRow`] objects.
747 pub fn builder() -> EntryRowBuilder {
748 EntryRowBuilder::new()
749 }
750}
751
752#[cfg(feature = "v1_2")]
753#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
754impl Default for EntryRow {
755 fn default() -> Self {
756 Self::new()
757 }
758}
759
760// rustdoc-stripper-ignore-next
761/// A [builder-pattern] type to construct [`EntryRow`] objects.
762///
763/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
764#[must_use = "The builder must be built to be used"]
765pub struct EntryRowBuilder {
766 builder: glib::object::ObjectBuilder<'static, EntryRow>,
767}
768
769impl EntryRowBuilder {
770 fn new() -> Self {
771 Self {
772 builder: glib::object::Object::builder(),
773 }
774 }
775
776 /// Whether activating the embedded entry can activate the default widget.
777 #[cfg(feature = "v1_2")]
778 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
779 pub fn activates_default(self, activates_default: bool) -> Self {
780 Self {
781 builder: self
782 .builder
783 .property("activates-default", activates_default),
784 }
785 }
786
787 /// A list of Pango attributes to apply to the text of the embedded entry.
788 ///
789 /// The `Pango::Attribute`'s `start_index` and `end_index` must refer to
790 /// the `Gtk::EntryBuffer` text, i.e. without the preedit string.
791 #[cfg(feature = "v1_2")]
792 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
793 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
794 Self {
795 builder: self.builder.property("attributes", attributes.clone()),
796 }
797 }
798
799 /// Whether to suggest emoji replacements on the entry row.
800 ///
801 /// Emoji replacement is done with :-delimited names, like `:heart:`.
802 #[cfg(feature = "v1_2")]
803 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
804 pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
805 Self {
806 builder: self
807 .builder
808 .property("enable-emoji-completion", enable_emoji_completion),
809 }
810 }
811
812 /// Additional input hints for the entry row.
813 ///
814 /// Input hints allow input methods to fine-tune their behavior.
815 ///
816 /// See also: [`input-purpose`][struct@crate::EntryRow#input-purpose]
817 #[cfg(feature = "v1_2")]
818 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
819 pub fn input_hints(self, input_hints: gtk::InputHints) -> Self {
820 Self {
821 builder: self.builder.property("input-hints", input_hints),
822 }
823 }
824
825 /// The input purpose of the entry row.
826 ///
827 /// The input purpose can be used by input methods to adjust their behavior.
828 #[cfg(feature = "v1_2")]
829 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
830 pub fn input_purpose(self, input_purpose: gtk::InputPurpose) -> Self {
831 Self {
832 builder: self.builder.property("input-purpose", input_purpose),
833 }
834 }
835
836 /// Maximum number of characters for the entry.
837 #[cfg(feature = "v1_6")]
838 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
839 pub fn max_length(self, max_length: i32) -> Self {
840 Self {
841 builder: self.builder.property("max-length", max_length),
842 }
843 }
844
845 /// key will hide the button and
846 /// emit the [`apply`][struct@crate::EntryRow#apply] signal.
847 ///
848 /// This is useful if changing the entry contents can trigger an expensive
849 /// operation, e.g. network activity, to avoid triggering it after typing every
850 /// character.
851 #[cfg(feature = "v1_2")]
852 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
853 pub fn show_apply_button(self, show_apply_button: bool) -> Self {
854 Self {
855 builder: self
856 .builder
857 .property("show-apply-button", show_apply_button),
858 }
859 }
860
861 /// The title of the preference represented by this row.
862 ///
863 /// The title is interpreted as Pango markup unless
864 /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
865 pub fn title(self, title: impl Into<glib::GString>) -> Self {
866 Self {
867 builder: self.builder.property("title", title.into()),
868 }
869 }
870
871 /// Whether the user can copy the title from the label.
872 ///
873 /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
874 #[cfg(feature = "v1_1")]
875 #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
876 pub fn title_selectable(self, title_selectable: bool) -> Self {
877 Self {
878 builder: self.builder.property("title-selectable", title_selectable),
879 }
880 }
881
882 /// Whether to use Pango markup for the title label.
883 ///
884 /// Subclasses may also use it for other labels, such as subtitle.
885 ///
886 /// See also `parse_markup()`.
887 #[cfg(feature = "v1_2")]
888 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
889 pub fn use_markup(self, use_markup: bool) -> Self {
890 Self {
891 builder: self.builder.property("use-markup", use_markup),
892 }
893 }
894
895 /// Whether an embedded underline in the title indicates a mnemonic.
896 pub fn use_underline(self, use_underline: bool) -> Self {
897 Self {
898 builder: self.builder.property("use-underline", use_underline),
899 }
900 }
901
902 /// Determines whether the ::row-activated
903 /// signal will be emitted for this row.
904 pub fn activatable(self, activatable: bool) -> Self {
905 Self {
906 builder: self.builder.property("activatable", activatable),
907 }
908 }
909
910 /// The child widget.
911 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
912 Self {
913 builder: self.builder.property("child", child.clone().upcast()),
914 }
915 }
916
917 /// Determines whether this row can be selected.
918 pub fn selectable(self, selectable: bool) -> Self {
919 Self {
920 builder: self.builder.property("selectable", selectable),
921 }
922 }
923
924 /// Whether the widget or any of its descendents can accept
925 /// the input focus.
926 ///
927 /// This property is meant to be set by widget implementations,
928 /// typically in their instance init function.
929 pub fn can_focus(self, can_focus: bool) -> Self {
930 Self {
931 builder: self.builder.property("can-focus", can_focus),
932 }
933 }
934
935 /// Whether the widget can receive pointer events.
936 pub fn can_target(self, can_target: bool) -> Self {
937 Self {
938 builder: self.builder.property("can-target", can_target),
939 }
940 }
941
942 /// A list of css classes applied to this widget.
943 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
944 Self {
945 builder: self.builder.property("css-classes", css_classes.into()),
946 }
947 }
948
949 /// The name of this widget in the CSS tree.
950 ///
951 /// This property is meant to be set by widget implementations,
952 /// typically in their instance init function.
953 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
954 Self {
955 builder: self.builder.property("css-name", css_name.into()),
956 }
957 }
958
959 /// The cursor used by @widget.
960 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
961 Self {
962 builder: self.builder.property("cursor", cursor.clone()),
963 }
964 }
965
966 /// Whether the widget should grab focus when it is clicked with the mouse.
967 ///
968 /// This property is only relevant for widgets that can take focus.
969 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
970 Self {
971 builder: self.builder.property("focus-on-click", focus_on_click),
972 }
973 }
974
975 /// Whether this widget itself will accept the input focus.
976 pub fn focusable(self, focusable: bool) -> Self {
977 Self {
978 builder: self.builder.property("focusable", focusable),
979 }
980 }
981
982 /// How to distribute horizontal space if widget gets extra space.
983 pub fn halign(self, halign: gtk::Align) -> Self {
984 Self {
985 builder: self.builder.property("halign", halign),
986 }
987 }
988
989 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
990 /// signal on @widget.
991 ///
992 /// A true value indicates that @widget can have a tooltip, in this case
993 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
994 /// determine whether it will provide a tooltip or not.
995 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
996 Self {
997 builder: self.builder.property("has-tooltip", has_tooltip),
998 }
999 }
1000
1001 /// Overrides for height request of the widget.
1002 ///
1003 /// If this is -1, the natural request will be used.
1004 pub fn height_request(self, height_request: i32) -> Self {
1005 Self {
1006 builder: self.builder.property("height-request", height_request),
1007 }
1008 }
1009
1010 /// Whether to expand horizontally.
1011 pub fn hexpand(self, hexpand: bool) -> Self {
1012 Self {
1013 builder: self.builder.property("hexpand", hexpand),
1014 }
1015 }
1016
1017 /// Whether to use the `hexpand` property.
1018 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1019 Self {
1020 builder: self.builder.property("hexpand-set", hexpand_set),
1021 }
1022 }
1023
1024 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1025 /// the preferred size of the widget, and allocate its children.
1026 ///
1027 /// This property is meant to be set by widget implementations,
1028 /// typically in their instance init function.
1029 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1030 Self {
1031 builder: self
1032 .builder
1033 .property("layout-manager", layout_manager.clone().upcast()),
1034 }
1035 }
1036
1037 /// Makes this widget act like a modal dialog, with respect to
1038 /// event delivery.
1039 ///
1040 /// Global event controllers will not handle events with targets
1041 /// inside the widget, unless they are set up to ignore propagation
1042 /// limits. See `Gtk::EventController::set_propagation_limit()`.
1043 #[cfg(feature = "gtk_v4_18")]
1044 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1045 pub fn limit_events(self, limit_events: bool) -> Self {
1046 Self {
1047 builder: self.builder.property("limit-events", limit_events),
1048 }
1049 }
1050
1051 /// Margin on bottom side of widget.
1052 ///
1053 /// This property adds margin outside of the widget's normal size
1054 /// request, the margin will be added in addition to the size from
1055 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1056 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1057 Self {
1058 builder: self.builder.property("margin-bottom", margin_bottom),
1059 }
1060 }
1061
1062 /// Margin on end of widget, horizontally.
1063 ///
1064 /// This property supports left-to-right and right-to-left text
1065 /// directions.
1066 ///
1067 /// This property adds margin outside of the widget's normal size
1068 /// request, the margin will be added in addition to the size from
1069 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1070 pub fn margin_end(self, margin_end: i32) -> Self {
1071 Self {
1072 builder: self.builder.property("margin-end", margin_end),
1073 }
1074 }
1075
1076 /// Margin on start of widget, horizontally.
1077 ///
1078 /// This property supports left-to-right and right-to-left text
1079 /// directions.
1080 ///
1081 /// This property adds margin outside of the widget's normal size
1082 /// request, the margin will be added in addition to the size from
1083 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1084 pub fn margin_start(self, margin_start: i32) -> Self {
1085 Self {
1086 builder: self.builder.property("margin-start", margin_start),
1087 }
1088 }
1089
1090 /// Margin on top side of widget.
1091 ///
1092 /// This property adds margin outside of the widget's normal size
1093 /// request, the margin will be added in addition to the size from
1094 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1095 pub fn margin_top(self, margin_top: i32) -> Self {
1096 Self {
1097 builder: self.builder.property("margin-top", margin_top),
1098 }
1099 }
1100
1101 /// The name of the widget.
1102 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1103 Self {
1104 builder: self.builder.property("name", name.into()),
1105 }
1106 }
1107
1108 /// The requested opacity of the widget.
1109 pub fn opacity(self, opacity: f64) -> Self {
1110 Self {
1111 builder: self.builder.property("opacity", opacity),
1112 }
1113 }
1114
1115 /// How content outside the widget's content area is treated.
1116 ///
1117 /// This property is meant to be set by widget implementations,
1118 /// typically in their instance init function.
1119 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1120 Self {
1121 builder: self.builder.property("overflow", overflow),
1122 }
1123 }
1124
1125 /// Whether the widget will receive the default action when it is focused.
1126 pub fn receives_default(self, receives_default: bool) -> Self {
1127 Self {
1128 builder: self.builder.property("receives-default", receives_default),
1129 }
1130 }
1131
1132 /// Whether the widget responds to input.
1133 pub fn sensitive(self, sensitive: bool) -> Self {
1134 Self {
1135 builder: self.builder.property("sensitive", sensitive),
1136 }
1137 }
1138
1139 /// Sets the text of tooltip to be the given string, which is marked up
1140 /// with Pango markup.
1141 ///
1142 /// Also see `Gtk::Tooltip::set_markup()`.
1143 ///
1144 /// This is a convenience property which will take care of getting the
1145 /// tooltip shown if the given string is not `NULL`:
1146 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1147 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1148 /// the default signal handler.
1149 ///
1150 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1151 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1152 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1153 Self {
1154 builder: self
1155 .builder
1156 .property("tooltip-markup", tooltip_markup.into()),
1157 }
1158 }
1159
1160 /// Sets the text of tooltip to be the given string.
1161 ///
1162 /// Also see `Gtk::Tooltip::set_text()`.
1163 ///
1164 /// This is a convenience property which will take care of getting the
1165 /// tooltip shown if the given string is not `NULL`:
1166 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1167 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1168 /// the default signal handler.
1169 ///
1170 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1171 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1172 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1173 Self {
1174 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1175 }
1176 }
1177
1178 /// How to distribute vertical space if widget gets extra space.
1179 pub fn valign(self, valign: gtk::Align) -> Self {
1180 Self {
1181 builder: self.builder.property("valign", valign),
1182 }
1183 }
1184
1185 /// Whether to expand vertically.
1186 pub fn vexpand(self, vexpand: bool) -> Self {
1187 Self {
1188 builder: self.builder.property("vexpand", vexpand),
1189 }
1190 }
1191
1192 /// Whether to use the `vexpand` property.
1193 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1194 Self {
1195 builder: self.builder.property("vexpand-set", vexpand_set),
1196 }
1197 }
1198
1199 /// Whether the widget is visible.
1200 pub fn visible(self, visible: bool) -> Self {
1201 Self {
1202 builder: self.builder.property("visible", visible),
1203 }
1204 }
1205
1206 /// Overrides for width request of the widget.
1207 ///
1208 /// If this is -1, the natural request will be used.
1209 pub fn width_request(self, width_request: i32) -> Self {
1210 Self {
1211 builder: self.builder.property("width-request", width_request),
1212 }
1213 }
1214
1215 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1216 ///
1217 /// The accessible role cannot be changed once set.
1218 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1219 Self {
1220 builder: self.builder.property("accessible-role", accessible_role),
1221 }
1222 }
1223
1224 /// The name of the action with which this widget should be associated.
1225 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1226 Self {
1227 builder: self.builder.property("action-name", action_name.into()),
1228 }
1229 }
1230
1231 /// The target value of the actionable widget's action.
1232 pub fn action_target(self, action_target: &glib::Variant) -> Self {
1233 Self {
1234 builder: self
1235 .builder
1236 .property("action-target", action_target.clone()),
1237 }
1238 }
1239
1240 /// Whether the entry contents can be edited.
1241 pub fn editable(self, editable: bool) -> Self {
1242 Self {
1243 builder: self.builder.property("editable", editable),
1244 }
1245 }
1246
1247 /// If undo/redo should be enabled for the editable.
1248 pub fn enable_undo(self, enable_undo: bool) -> Self {
1249 Self {
1250 builder: self.builder.property("enable-undo", enable_undo),
1251 }
1252 }
1253
1254 /// The desired maximum width of the entry, in characters.
1255 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1256 Self {
1257 builder: self.builder.property("max-width-chars", max_width_chars),
1258 }
1259 }
1260
1261 /// The contents of the entry.
1262 pub fn text(self, text: impl Into<glib::GString>) -> Self {
1263 Self {
1264 builder: self.builder.property("text", text.into()),
1265 }
1266 }
1267
1268 /// Number of characters to leave space for in the entry.
1269 pub fn width_chars(self, width_chars: i32) -> Self {
1270 Self {
1271 builder: self.builder.property("width-chars", width_chars),
1272 }
1273 }
1274
1275 /// The horizontal alignment, from 0 (left) to 1 (right).
1276 ///
1277 /// Reversed for RTL layouts.
1278 pub fn xalign(self, xalign: f32) -> Self {
1279 Self {
1280 builder: self.builder.property("xalign", xalign),
1281 }
1282 }
1283
1284 // rustdoc-stripper-ignore-next
1285 /// Build the [`EntryRow`].
1286 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1287 pub fn build(self) -> EntryRow {
1288 assert_initialized_main_thread!();
1289 self.builder.build()
1290 }
1291}
1292
1293/// Trait containing all [`struct@EntryRow`] methods.
1294///
1295/// # Implementors
1296///
1297/// [`EntryRow`][struct@crate::EntryRow], [`PasswordEntryRow`][struct@crate::PasswordEntryRow]
1298pub trait EntryRowExt: IsA<EntryRow> + 'static {
1299 /// Adds a prefix widget to @self.
1300 /// ## `widget`
1301 /// a widget
1302 #[doc(alias = "adw_entry_row_add_prefix")]
1303 fn add_prefix(&self, widget: &impl IsA<gtk::Widget>) {
1304 unsafe {
1305 ffi::adw_entry_row_add_prefix(
1306 self.as_ref().to_glib_none().0,
1307 widget.as_ref().to_glib_none().0,
1308 );
1309 }
1310 }
1311
1312 /// Adds a suffix widget to @self.
1313 /// ## `widget`
1314 /// a widget
1315 #[doc(alias = "adw_entry_row_add_suffix")]
1316 fn add_suffix(&self, widget: &impl IsA<gtk::Widget>) {
1317 unsafe {
1318 ffi::adw_entry_row_add_suffix(
1319 self.as_ref().to_glib_none().0,
1320 widget.as_ref().to_glib_none().0,
1321 );
1322 }
1323 }
1324
1325 /// Gets whether activating the embedded entry can activate the default widget.
1326 ///
1327 /// # Returns
1328 ///
1329 /// whether to activate the default widget
1330 #[doc(alias = "adw_entry_row_get_activates_default")]
1331 #[doc(alias = "get_activates_default")]
1332 #[doc(alias = "activates-default")]
1333 fn activates_default(&self) -> bool {
1334 unsafe {
1335 from_glib(ffi::adw_entry_row_get_activates_default(
1336 self.as_ref().to_glib_none().0,
1337 ))
1338 }
1339 }
1340
1341 /// Gets Pango attributes applied to the text of the embedded entry.
1342 ///
1343 /// # Returns
1344 ///
1345 /// the list of attributes
1346 #[doc(alias = "adw_entry_row_get_attributes")]
1347 #[doc(alias = "get_attributes")]
1348 fn attributes(&self) -> Option<pango::AttrList> {
1349 unsafe {
1350 from_glib_full(ffi::adw_entry_row_get_attributes(
1351 self.as_ref().to_glib_none().0,
1352 ))
1353 }
1354 }
1355
1356 /// Gets whether to suggest emoji replacements on @self.
1357 ///
1358 /// # Returns
1359 ///
1360 /// whether or not emoji completion is enabled
1361 #[doc(alias = "adw_entry_row_get_enable_emoji_completion")]
1362 #[doc(alias = "get_enable_emoji_completion")]
1363 #[doc(alias = "enable-emoji-completion")]
1364 fn enables_emoji_completion(&self) -> bool {
1365 unsafe {
1366 from_glib(ffi::adw_entry_row_get_enable_emoji_completion(
1367 self.as_ref().to_glib_none().0,
1368 ))
1369 }
1370 }
1371
1372 /// Gets the additional input hints of @self.
1373 ///
1374 /// # Returns
1375 ///
1376 /// The input hints
1377 #[doc(alias = "adw_entry_row_get_input_hints")]
1378 #[doc(alias = "get_input_hints")]
1379 #[doc(alias = "input-hints")]
1380 fn input_hints(&self) -> gtk::InputHints {
1381 unsafe {
1382 from_glib(ffi::adw_entry_row_get_input_hints(
1383 self.as_ref().to_glib_none().0,
1384 ))
1385 }
1386 }
1387
1388 /// Gets the input purpose of @self.
1389 ///
1390 /// # Returns
1391 ///
1392 /// the input purpose
1393 #[doc(alias = "adw_entry_row_get_input_purpose")]
1394 #[doc(alias = "get_input_purpose")]
1395 #[doc(alias = "input-purpose")]
1396 fn input_purpose(&self) -> gtk::InputPurpose {
1397 unsafe {
1398 from_glib(ffi::adw_entry_row_get_input_purpose(
1399 self.as_ref().to_glib_none().0,
1400 ))
1401 }
1402 }
1403
1404 /// Retrieves the maximum length of the entry.
1405 ///
1406 /// # Returns
1407 ///
1408 /// The maximum length of the entry.
1409 #[cfg(feature = "v1_6")]
1410 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1411 #[doc(alias = "adw_entry_row_get_max_length")]
1412 #[doc(alias = "get_max_length")]
1413 #[doc(alias = "max-length")]
1414 fn max_length(&self) -> i32 {
1415 unsafe { ffi::adw_entry_row_get_max_length(self.as_ref().to_glib_none().0) }
1416 }
1417
1418 /// Gets whether @self can show the apply button.
1419 ///
1420 /// # Returns
1421 ///
1422 /// whether to show the apply button
1423 #[doc(alias = "adw_entry_row_get_show_apply_button")]
1424 #[doc(alias = "get_show_apply_button")]
1425 #[doc(alias = "show-apply-button")]
1426 fn shows_apply_button(&self) -> bool {
1427 unsafe {
1428 from_glib(ffi::adw_entry_row_get_show_apply_button(
1429 self.as_ref().to_glib_none().0,
1430 ))
1431 }
1432 }
1433
1434 /// Retrieves the current length of the text in @self.
1435 ///
1436 /// # Returns
1437 ///
1438 /// The current number of characters in @self, or 0 if there are none.
1439 #[cfg(feature = "v1_5")]
1440 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1441 #[doc(alias = "adw_entry_row_get_text_length")]
1442 #[doc(alias = "get_text_length")]
1443 #[doc(alias = "text-length")]
1444 fn text_length(&self) -> u32 {
1445 unsafe { ffi::adw_entry_row_get_text_length(self.as_ref().to_glib_none().0) }
1446 }
1447
1448 /// Causes @self to have keyboard focus without selecting the text.
1449 ///
1450 /// See `Gtk::Text::grab_focus_without_selecting()` for more information.
1451 ///
1452 /// # Returns
1453 ///
1454 /// whether the focus is now inside @self
1455 #[cfg(feature = "v1_3")]
1456 #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
1457 #[doc(alias = "adw_entry_row_grab_focus_without_selecting")]
1458 fn grab_focus_without_selecting(&self) -> bool {
1459 unsafe {
1460 from_glib(ffi::adw_entry_row_grab_focus_without_selecting(
1461 self.as_ref().to_glib_none().0,
1462 ))
1463 }
1464 }
1465
1466 /// Removes a child from @self.
1467 /// ## `widget`
1468 /// the child to be removed
1469 #[doc(alias = "adw_entry_row_remove")]
1470 fn remove(&self, widget: &impl IsA<gtk::Widget>) {
1471 unsafe {
1472 ffi::adw_entry_row_remove(
1473 self.as_ref().to_glib_none().0,
1474 widget.as_ref().to_glib_none().0,
1475 );
1476 }
1477 }
1478
1479 /// Sets whether activating the embedded entry can activate the default widget.
1480 /// ## `activates`
1481 /// whether to activate the default widget
1482 #[doc(alias = "adw_entry_row_set_activates_default")]
1483 #[doc(alias = "activates-default")]
1484 fn set_activates_default(&self, activates: bool) {
1485 unsafe {
1486 ffi::adw_entry_row_set_activates_default(
1487 self.as_ref().to_glib_none().0,
1488 activates.into_glib(),
1489 );
1490 }
1491 }
1492
1493 /// Sets Pango attributes to apply to the text of the embedded entry.
1494 ///
1495 /// The `Pango::Attribute`'s `start_index` and `end_index` must refer to
1496 /// the `Gtk::EntryBuffer` text, i.e. without the preedit string.
1497 /// ## `attributes`
1498 /// a list of attributes
1499 #[doc(alias = "adw_entry_row_set_attributes")]
1500 #[doc(alias = "attributes")]
1501 fn set_attributes(&self, attributes: Option<&pango::AttrList>) {
1502 unsafe {
1503 ffi::adw_entry_row_set_attributes(
1504 self.as_ref().to_glib_none().0,
1505 attributes.to_glib_none().0,
1506 );
1507 }
1508 }
1509
1510 /// Sets whether to suggest emoji replacements on @self.
1511 ///
1512 /// Emoji replacement is done with :-delimited names, like `:heart:`.
1513 /// ## `enable_emoji_completion`
1514 /// Whether emoji completion should be enabled or not
1515 #[doc(alias = "adw_entry_row_set_enable_emoji_completion")]
1516 #[doc(alias = "enable-emoji-completion")]
1517 fn set_enable_emoji_completion(&self, enable_emoji_completion: bool) {
1518 unsafe {
1519 ffi::adw_entry_row_set_enable_emoji_completion(
1520 self.as_ref().to_glib_none().0,
1521 enable_emoji_completion.into_glib(),
1522 );
1523 }
1524 }
1525
1526 /// Set additional input hints for @self.
1527 ///
1528 /// Input hints allow input methods to fine-tune their behavior.
1529 ///
1530 /// See also: [`input-purpose`][struct@crate::AdwEntryRow#input-purpose]
1531 /// ## `hints`
1532 /// the hints
1533 #[doc(alias = "adw_entry_row_set_input_hints")]
1534 #[doc(alias = "input-hints")]
1535 fn set_input_hints(&self, hints: gtk::InputHints) {
1536 unsafe {
1537 ffi::adw_entry_row_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
1538 }
1539 }
1540
1541 /// Sets the input purpose of @self.
1542 ///
1543 /// The input purpose can be used by input methods to adjust their behavior.
1544 /// ## `purpose`
1545 /// the purpose
1546 #[doc(alias = "adw_entry_row_set_input_purpose")]
1547 #[doc(alias = "input-purpose")]
1548 fn set_input_purpose(&self, purpose: gtk::InputPurpose) {
1549 unsafe {
1550 ffi::adw_entry_row_set_input_purpose(
1551 self.as_ref().to_glib_none().0,
1552 purpose.into_glib(),
1553 );
1554 }
1555 }
1556
1557 /// Sets the maximum length of the entry.
1558 /// ## `max_length`
1559 /// maximum length of the entry
1560 #[cfg(feature = "v1_6")]
1561 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1562 #[doc(alias = "adw_entry_row_set_max_length")]
1563 #[doc(alias = "max-length")]
1564 fn set_max_length(&self, max_length: i32) {
1565 unsafe {
1566 ffi::adw_entry_row_set_max_length(self.as_ref().to_glib_none().0, max_length);
1567 }
1568 }
1569
1570 /// key will hide the button and
1571 /// emit the [`apply`][struct@crate::EntryRow#apply] signal.
1572 ///
1573 /// This is useful if changing the entry contents can trigger an expensive
1574 /// operation, e.g. network activity, to avoid triggering it after typing every
1575 /// character.
1576 /// ## `show_apply_button`
1577 /// whether to show the apply button
1578 #[doc(alias = "adw_entry_row_set_show_apply_button")]
1579 #[doc(alias = "show-apply-button")]
1580 fn set_show_apply_button(&self, show_apply_button: bool) {
1581 unsafe {
1582 ffi::adw_entry_row_set_show_apply_button(
1583 self.as_ref().to_glib_none().0,
1584 show_apply_button.into_glib(),
1585 );
1586 }
1587 }
1588
1589 /// Emitted when the apply button is pressed.
1590 ///
1591 /// See [`show-apply-button`][struct@crate::EntryRow#show-apply-button].
1592 #[cfg(feature = "v1_2")]
1593 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1594 #[doc(alias = "apply")]
1595 fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1596 unsafe extern "C" fn apply_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1597 this: *mut ffi::AdwEntryRow,
1598 f: glib::ffi::gpointer,
1599 ) {
1600 unsafe {
1601 let f: &F = &*(f as *const F);
1602 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1603 }
1604 }
1605 unsafe {
1606 let f: Box_<F> = Box_::new(f);
1607 connect_raw(
1608 self.as_ptr() as *mut _,
1609 c"apply".as_ptr(),
1610 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1611 apply_trampoline::<Self, F> as *const (),
1612 )),
1613 Box_::into_raw(f),
1614 )
1615 }
1616 }
1617
1618 /// Emitted when the embedded entry is activated.
1619 #[cfg(feature = "v1_2")]
1620 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1621 #[doc(alias = "entry-activated")]
1622 fn connect_entry_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1623 unsafe extern "C" fn entry_activated_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1624 this: *mut ffi::AdwEntryRow,
1625 f: glib::ffi::gpointer,
1626 ) {
1627 unsafe {
1628 let f: &F = &*(f as *const F);
1629 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1630 }
1631 }
1632 unsafe {
1633 let f: Box_<F> = Box_::new(f);
1634 connect_raw(
1635 self.as_ptr() as *mut _,
1636 c"entry-activated".as_ptr(),
1637 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1638 entry_activated_trampoline::<Self, F> as *const (),
1639 )),
1640 Box_::into_raw(f),
1641 )
1642 }
1643 }
1644
1645 #[cfg(feature = "v1_2")]
1646 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1647 #[doc(alias = "activates-default")]
1648 fn connect_activates_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1649 unsafe extern "C" fn notify_activates_default_trampoline<
1650 P: IsA<EntryRow>,
1651 F: Fn(&P) + 'static,
1652 >(
1653 this: *mut ffi::AdwEntryRow,
1654 _param_spec: glib::ffi::gpointer,
1655 f: glib::ffi::gpointer,
1656 ) {
1657 unsafe {
1658 let f: &F = &*(f as *const F);
1659 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1660 }
1661 }
1662 unsafe {
1663 let f: Box_<F> = Box_::new(f);
1664 connect_raw(
1665 self.as_ptr() as *mut _,
1666 c"notify::activates-default".as_ptr(),
1667 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1668 notify_activates_default_trampoline::<Self, F> as *const (),
1669 )),
1670 Box_::into_raw(f),
1671 )
1672 }
1673 }
1674
1675 #[cfg(feature = "v1_2")]
1676 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1677 #[doc(alias = "attributes")]
1678 fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1679 unsafe extern "C" fn notify_attributes_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1680 this: *mut ffi::AdwEntryRow,
1681 _param_spec: glib::ffi::gpointer,
1682 f: glib::ffi::gpointer,
1683 ) {
1684 unsafe {
1685 let f: &F = &*(f as *const F);
1686 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1687 }
1688 }
1689 unsafe {
1690 let f: Box_<F> = Box_::new(f);
1691 connect_raw(
1692 self.as_ptr() as *mut _,
1693 c"notify::attributes".as_ptr(),
1694 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1695 notify_attributes_trampoline::<Self, F> as *const (),
1696 )),
1697 Box_::into_raw(f),
1698 )
1699 }
1700 }
1701
1702 #[cfg(feature = "v1_2")]
1703 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1704 #[doc(alias = "enable-emoji-completion")]
1705 fn connect_enable_emoji_completion_notify<F: Fn(&Self) + 'static>(
1706 &self,
1707 f: F,
1708 ) -> SignalHandlerId {
1709 unsafe extern "C" fn notify_enable_emoji_completion_trampoline<
1710 P: IsA<EntryRow>,
1711 F: Fn(&P) + 'static,
1712 >(
1713 this: *mut ffi::AdwEntryRow,
1714 _param_spec: glib::ffi::gpointer,
1715 f: glib::ffi::gpointer,
1716 ) {
1717 unsafe {
1718 let f: &F = &*(f as *const F);
1719 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1720 }
1721 }
1722 unsafe {
1723 let f: Box_<F> = Box_::new(f);
1724 connect_raw(
1725 self.as_ptr() as *mut _,
1726 c"notify::enable-emoji-completion".as_ptr(),
1727 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1728 notify_enable_emoji_completion_trampoline::<Self, F> as *const (),
1729 )),
1730 Box_::into_raw(f),
1731 )
1732 }
1733 }
1734
1735 #[cfg(feature = "v1_2")]
1736 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1737 #[doc(alias = "input-hints")]
1738 fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1739 unsafe extern "C" fn notify_input_hints_trampoline<
1740 P: IsA<EntryRow>,
1741 F: Fn(&P) + 'static,
1742 >(
1743 this: *mut ffi::AdwEntryRow,
1744 _param_spec: glib::ffi::gpointer,
1745 f: glib::ffi::gpointer,
1746 ) {
1747 unsafe {
1748 let f: &F = &*(f as *const F);
1749 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1750 }
1751 }
1752 unsafe {
1753 let f: Box_<F> = Box_::new(f);
1754 connect_raw(
1755 self.as_ptr() as *mut _,
1756 c"notify::input-hints".as_ptr(),
1757 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1758 notify_input_hints_trampoline::<Self, F> as *const (),
1759 )),
1760 Box_::into_raw(f),
1761 )
1762 }
1763 }
1764
1765 #[cfg(feature = "v1_2")]
1766 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1767 #[doc(alias = "input-purpose")]
1768 fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1769 unsafe extern "C" fn notify_input_purpose_trampoline<
1770 P: IsA<EntryRow>,
1771 F: Fn(&P) + 'static,
1772 >(
1773 this: *mut ffi::AdwEntryRow,
1774 _param_spec: glib::ffi::gpointer,
1775 f: glib::ffi::gpointer,
1776 ) {
1777 unsafe {
1778 let f: &F = &*(f as *const F);
1779 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1780 }
1781 }
1782 unsafe {
1783 let f: Box_<F> = Box_::new(f);
1784 connect_raw(
1785 self.as_ptr() as *mut _,
1786 c"notify::input-purpose".as_ptr(),
1787 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1788 notify_input_purpose_trampoline::<Self, F> as *const (),
1789 )),
1790 Box_::into_raw(f),
1791 )
1792 }
1793 }
1794
1795 #[cfg(feature = "v1_6")]
1796 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1797 #[doc(alias = "max-length")]
1798 fn connect_max_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1799 unsafe extern "C" fn notify_max_length_trampoline<P: IsA<EntryRow>, F: Fn(&P) + 'static>(
1800 this: *mut ffi::AdwEntryRow,
1801 _param_spec: glib::ffi::gpointer,
1802 f: glib::ffi::gpointer,
1803 ) {
1804 unsafe {
1805 let f: &F = &*(f as *const F);
1806 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1807 }
1808 }
1809 unsafe {
1810 let f: Box_<F> = Box_::new(f);
1811 connect_raw(
1812 self.as_ptr() as *mut _,
1813 c"notify::max-length".as_ptr(),
1814 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1815 notify_max_length_trampoline::<Self, F> as *const (),
1816 )),
1817 Box_::into_raw(f),
1818 )
1819 }
1820 }
1821
1822 #[cfg(feature = "v1_2")]
1823 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1824 #[doc(alias = "show-apply-button")]
1825 fn connect_show_apply_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1826 unsafe extern "C" fn notify_show_apply_button_trampoline<
1827 P: IsA<EntryRow>,
1828 F: Fn(&P) + 'static,
1829 >(
1830 this: *mut ffi::AdwEntryRow,
1831 _param_spec: glib::ffi::gpointer,
1832 f: glib::ffi::gpointer,
1833 ) {
1834 unsafe {
1835 let f: &F = &*(f as *const F);
1836 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1837 }
1838 }
1839 unsafe {
1840 let f: Box_<F> = Box_::new(f);
1841 connect_raw(
1842 self.as_ptr() as *mut _,
1843 c"notify::show-apply-button".as_ptr(),
1844 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1845 notify_show_apply_button_trampoline::<Self, F> as *const (),
1846 )),
1847 Box_::into_raw(f),
1848 )
1849 }
1850 }
1851
1852 #[cfg(feature = "v1_5")]
1853 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1854 #[doc(alias = "text-length")]
1855 fn connect_text_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1856 unsafe extern "C" fn notify_text_length_trampoline<
1857 P: IsA<EntryRow>,
1858 F: Fn(&P) + 'static,
1859 >(
1860 this: *mut ffi::AdwEntryRow,
1861 _param_spec: glib::ffi::gpointer,
1862 f: glib::ffi::gpointer,
1863 ) {
1864 unsafe {
1865 let f: &F = &*(f as *const F);
1866 f(EntryRow::from_glib_borrow(this).unsafe_cast_ref())
1867 }
1868 }
1869 unsafe {
1870 let f: Box_<F> = Box_::new(f);
1871 connect_raw(
1872 self.as_ptr() as *mut _,
1873 c"notify::text-length".as_ptr(),
1874 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1875 notify_text_length_trampoline::<Self, F> as *const (),
1876 )),
1877 Box_::into_raw(f),
1878 )
1879 }
1880 }
1881}
1882
1883impl<O: IsA<EntryRow>> EntryRowExt for O {}