Skip to main content

gtk4/auto/
search_entry.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, Editable, LayoutManager,
7    Overflow, Widget, ffi,
8};
9#[cfg(feature = "v4_14")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
11use crate::{InputHints, InputPurpose};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{SignalHandlerId, connect_raw},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21    /// A single-line text entry widget for use as a search entry.
22    ///
23    /// The main API for interacting with a [`SearchEntry`][crate::SearchEntry] as entry
24    /// is the [`Editable`][crate::Editable] interface.
25    ///
26    /// <picture>
27    ///   <source srcset="search-entry-dark.png" media="(prefers-color-scheme: dark)">
28    ///   <img alt="An example GtkSearchEntry" src="search-entry.png">
29    /// </picture>
30    ///
31    /// It will show an inactive symbolic “find” icon when the search
32    /// entry is empty, and a symbolic “clear” icon when there is text.
33    /// Clicking on the “clear” icon will empty the search entry.
34    ///
35    /// To make filtering appear more reactive, it is a good idea to
36    /// not react to every change in the entry text immediately, but
37    /// only after a short delay. To support this, [`SearchEntry`][crate::SearchEntry]
38    /// emits the [`search-changed`][struct@crate::SearchEntry#search-changed] signal which
39    /// can be used instead of the [`changed`][struct@crate::Editable#changed] signal.
40    ///
41    /// The [`previous-match`][struct@crate::SearchEntry#previous-match],
42    /// [`next-match`][struct@crate::SearchEntry#next-match] and
43    /// [`stop-search`][struct@crate::SearchEntry#stop-search] signals can be used to
44    /// implement moving between search results and ending the search.
45    ///
46    /// Often, [`SearchEntry`][crate::SearchEntry] will be fed events by means of being
47    /// placed inside a [`SearchBar`][crate::SearchBar]. If that is not the case,
48    /// you can use [`set_key_capture_widget()`][Self::set_key_capture_widget()] to
49    /// let it capture key input from another widget.
50    ///
51    /// [`SearchEntry`][crate::SearchEntry] provides only minimal API and should be used with
52    /// the [`Editable`][crate::Editable] API.
53    ///
54    /// ## Shortcuts and Gestures
55    ///
56    /// The following signals have default keybindings:
57    ///
58    /// - [`activate`][struct@crate::SearchEntry#activate]
59    /// - [`next-match`][struct@crate::SearchEntry#next-match]
60    /// - [`previous-match`][struct@crate::SearchEntry#previous-match]
61    /// - [`stop-search`][struct@crate::SearchEntry#stop-search]
62    ///
63    /// ## CSS Nodes
64    ///
65    /// ```text
66    /// entry.search
67    /// ╰── text
68    /// ```
69    ///
70    /// [`SearchEntry`][crate::SearchEntry] has a single CSS node with name entry that carries
71    /// a `.search` style class, and the text node is a child of that.
72    ///
73    /// ## Accessibility
74    ///
75    /// [`SearchEntry`][crate::SearchEntry] uses the [enum@Gtk.AccessibleRole.search_box] role.
76    ///
77    /// ## Properties
78    ///
79    ///
80    /// #### `activates-default`
81    ///  Whether to activate the default widget when Enter is pressed.
82    ///
83    /// Readable | Writeable
84    ///
85    ///
86    /// #### `input-hints`
87    ///  The hints about input for the [`SearchEntry`][crate::SearchEntry] used to alter the
88    /// behaviour of input methods.
89    ///
90    /// Readable | Writeable
91    ///
92    ///
93    /// #### `input-purpose`
94    ///  The purpose for the [`SearchEntry`][crate::SearchEntry] input used to alter the
95    /// behaviour of input methods.
96    ///
97    /// Readable | Writeable
98    ///
99    ///
100    /// #### `placeholder-text`
101    ///  The text that will be displayed in the [`SearchEntry`][crate::SearchEntry]
102    /// when it is empty and unfocused.
103    ///
104    /// Readable | Writeable
105    ///
106    ///
107    /// #### `search-delay`
108    ///  The delay in milliseconds from last keypress to the search
109    /// changed signal.
110    ///
111    /// Readable | Writeable
112    /// <details><summary><h4>Widget</h4></summary>
113    ///
114    ///
115    /// #### `can-focus`
116    ///  Whether the widget or any of its descendents can accept
117    /// the input focus.
118    ///
119    /// This property is meant to be set by widget implementations,
120    /// typically in their instance init function.
121    ///
122    /// Readable | Writeable
123    ///
124    ///
125    /// #### `can-target`
126    ///  Whether the widget can receive pointer events.
127    ///
128    /// Readable | Writeable
129    ///
130    ///
131    /// #### `css-classes`
132    ///  A list of css classes applied to this widget.
133    ///
134    /// Readable | Writeable
135    ///
136    ///
137    /// #### `css-name`
138    ///  The name of this widget in the CSS tree.
139    ///
140    /// This property is meant to be set by widget implementations,
141    /// typically in their instance init function.
142    ///
143    /// Readable | Writeable | Construct Only
144    ///
145    ///
146    /// #### `cursor`
147    ///  The cursor used by @widget.
148    ///
149    /// Readable | Writeable
150    ///
151    ///
152    /// #### `focus-on-click`
153    ///  Whether the widget should grab focus when it is clicked with the mouse.
154    ///
155    /// This property is only relevant for widgets that can take focus.
156    ///
157    /// Readable | Writeable
158    ///
159    ///
160    /// #### `focusable`
161    ///  Whether this widget itself will accept the input focus.
162    ///
163    /// Readable | Writeable
164    ///
165    ///
166    /// #### `halign`
167    ///  How to distribute horizontal space if widget gets extra space.
168    ///
169    /// Readable | Writeable
170    ///
171    ///
172    /// #### `has-default`
173    ///  Whether the widget is the default widget.
174    ///
175    /// Readable
176    ///
177    ///
178    /// #### `has-focus`
179    ///  Whether the widget has the input focus.
180    ///
181    /// Readable
182    ///
183    ///
184    /// #### `has-tooltip`
185    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
186    /// signal on @widget.
187    ///
188    /// A true value indicates that @widget can have a tooltip, in this case
189    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
190    /// determine whether it will provide a tooltip or not.
191    ///
192    /// Readable | Writeable
193    ///
194    ///
195    /// #### `height-request`
196    ///  Overrides for height request of the widget.
197    ///
198    /// If this is -1, the natural request will be used.
199    ///
200    /// Readable | Writeable
201    ///
202    ///
203    /// #### `hexpand`
204    ///  Whether to expand horizontally.
205    ///
206    /// Readable | Writeable
207    ///
208    ///
209    /// #### `hexpand-set`
210    ///  Whether to use the `hexpand` property.
211    ///
212    /// Readable | Writeable
213    ///
214    ///
215    /// #### `layout-manager`
216    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
217    /// the preferred size of the widget, and allocate its children.
218    ///
219    /// This property is meant to be set by widget implementations,
220    /// typically in their instance init function.
221    ///
222    /// Readable | Writeable
223    ///
224    ///
225    /// #### `limit-events`
226    ///  Makes this widget act like a modal dialog, with respect to
227    /// event delivery.
228    ///
229    /// Global event controllers will not handle events with targets
230    /// inside the widget, unless they are set up to ignore propagation
231    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
232    ///
233    /// Readable | Writeable
234    ///
235    ///
236    /// #### `margin-bottom`
237    ///  Margin on bottom side of widget.
238    ///
239    /// This property adds margin outside of the widget's normal size
240    /// request, the margin will be added in addition to the size from
241    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
242    ///
243    /// Readable | Writeable
244    ///
245    ///
246    /// #### `margin-end`
247    ///  Margin on end of widget, horizontally.
248    ///
249    /// This property supports left-to-right and right-to-left text
250    /// directions.
251    ///
252    /// This property adds margin outside of the widget's normal size
253    /// request, the margin will be added in addition to the size from
254    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
255    ///
256    /// Readable | Writeable
257    ///
258    ///
259    /// #### `margin-start`
260    ///  Margin on start of widget, horizontally.
261    ///
262    /// This property supports left-to-right and right-to-left text
263    /// directions.
264    ///
265    /// This property adds margin outside of the widget's normal size
266    /// request, the margin will be added in addition to the size from
267    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
268    ///
269    /// Readable | Writeable
270    ///
271    ///
272    /// #### `margin-top`
273    ///  Margin on top side of widget.
274    ///
275    /// This property adds margin outside of the widget's normal size
276    /// request, the margin will be added in addition to the size from
277    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
278    ///
279    /// Readable | Writeable
280    ///
281    ///
282    /// #### `name`
283    ///  The name of the widget.
284    ///
285    /// Readable | Writeable
286    ///
287    ///
288    /// #### `opacity`
289    ///  The requested opacity of the widget.
290    ///
291    /// Readable | Writeable
292    ///
293    ///
294    /// #### `overflow`
295    ///  How content outside the widget's content area is treated.
296    ///
297    /// This property is meant to be set by widget implementations,
298    /// typically in their instance init function.
299    ///
300    /// Readable | Writeable
301    ///
302    ///
303    /// #### `parent`
304    ///  The parent widget of this widget.
305    ///
306    /// Readable
307    ///
308    ///
309    /// #### `receives-default`
310    ///  Whether the widget will receive the default action when it is focused.
311    ///
312    /// Readable | Writeable
313    ///
314    ///
315    /// #### `root`
316    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
317    ///
318    /// This will be `NULL` if the widget is not contained in a root widget.
319    ///
320    /// Readable
321    ///
322    ///
323    /// #### `scale-factor`
324    ///  The scale factor of the widget.
325    ///
326    /// Readable
327    ///
328    ///
329    /// #### `sensitive`
330    ///  Whether the widget responds to input.
331    ///
332    /// Readable | Writeable
333    ///
334    ///
335    /// #### `tooltip-markup`
336    ///  Sets the text of tooltip to be the given string, which is marked up
337    /// with Pango markup.
338    ///
339    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
340    ///
341    /// This is a convenience property which will take care of getting the
342    /// tooltip shown if the given string is not `NULL`:
343    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
344    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
345    /// the default signal handler.
346    ///
347    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
348    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
349    ///
350    /// Readable | Writeable
351    ///
352    ///
353    /// #### `tooltip-text`
354    ///  Sets the text of tooltip to be the given string.
355    ///
356    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
357    ///
358    /// This is a convenience property which will take care of getting the
359    /// tooltip shown if the given string is not `NULL`:
360    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
361    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
362    /// the default signal handler.
363    ///
364    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
365    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
366    ///
367    /// Readable | Writeable
368    ///
369    ///
370    /// #### `valign`
371    ///  How to distribute vertical space if widget gets extra space.
372    ///
373    /// Readable | Writeable
374    ///
375    ///
376    /// #### `vexpand`
377    ///  Whether to expand vertically.
378    ///
379    /// Readable | Writeable
380    ///
381    ///
382    /// #### `vexpand-set`
383    ///  Whether to use the `vexpand` property.
384    ///
385    /// Readable | Writeable
386    ///
387    ///
388    /// #### `visible`
389    ///  Whether the widget is visible.
390    ///
391    /// Readable | Writeable
392    ///
393    ///
394    /// #### `width-request`
395    ///  Overrides for width request of the widget.
396    ///
397    /// If this is -1, the natural request will be used.
398    ///
399    /// Readable | Writeable
400    /// </details>
401    /// <details><summary><h4>Accessible</h4></summary>
402    ///
403    ///
404    /// #### `accessible-role`
405    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
406    ///
407    /// The accessible role cannot be changed once set.
408    ///
409    /// Readable | Writeable
410    /// </details>
411    /// <details><summary><h4>Editable</h4></summary>
412    ///
413    ///
414    /// #### `cursor-position`
415    ///  The current position of the insertion cursor in chars.
416    ///
417    /// Readable
418    ///
419    ///
420    /// #### `editable`
421    ///  Whether the entry contents can be edited.
422    ///
423    /// Readable | Writeable
424    ///
425    ///
426    /// #### `enable-undo`
427    ///  If undo/redo should be enabled for the editable.
428    ///
429    /// Readable | Writeable
430    ///
431    ///
432    /// #### `max-width-chars`
433    ///  The desired maximum width of the entry, in characters.
434    ///
435    /// Readable | Writeable
436    ///
437    ///
438    /// #### `selection-bound`
439    ///  The position of the opposite end of the selection from the cursor in chars.
440    ///
441    /// Readable
442    ///
443    ///
444    /// #### `text`
445    ///  The contents of the entry.
446    ///
447    /// Readable | Writeable
448    ///
449    ///
450    /// #### `width-chars`
451    ///  Number of characters to leave space for in the entry.
452    ///
453    /// Readable | Writeable
454    ///
455    ///
456    /// #### `xalign`
457    ///  The horizontal alignment, from 0 (left) to 1 (right).
458    ///
459    /// Reversed for RTL layouts.
460    ///
461    /// Readable | Writeable
462    /// </details>
463    ///
464    /// ## Signals
465    ///
466    ///
467    /// #### `activate`
468    ///  Emitted when the entry is activated.
469    ///
470    /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
471    ///
472    /// Action
473    ///
474    ///
475    /// #### `next-match`
476    ///  Emitted when the user initiates a move to the next match
477    /// for the current search string.
478    ///
479    /// This is a [keybinding signal](class.SignalAction.html).
480    ///
481    /// Applications should connect to it, to implement moving
482    /// between matches.
483    ///
484    /// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>g</kbd>.
485    ///
486    /// Action
487    ///
488    ///
489    /// #### `previous-match`
490    ///  Emitted when the user initiates a move to the previous match
491    /// for the current search string.
492    ///
493    /// This is a [keybinding signal](class.SignalAction.html).
494    ///
495    /// Applications should connect to it, to implement moving
496    /// between matches.
497    ///
498    /// The default bindings for this signal is
499    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>g</kbd>.
500    ///
501    /// Action
502    ///
503    ///
504    /// #### `search-changed`
505    ///  Emitted with a delay. The length of the delay can be
506    /// changed with the [`search-delay`][struct@crate::SearchEntry#search-delay]
507    /// property.
508    ///
509    ///
510    ///
511    ///
512    /// #### `search-started`
513    ///  Emitted when the user initiated a search on the entry.
514    ///
515    ///
516    ///
517    ///
518    /// #### `stop-search`
519    ///  Emitted when the user stops a search via keyboard input.
520    ///
521    /// This is a [keybinding signal](class.SignalAction.html).
522    ///
523    /// Applications should connect to it, to implement hiding
524    /// the search entry in this case.
525    ///
526    /// The default bindings for this signal is <kbd>Escape</kbd>.
527    ///
528    /// Action
529    /// <details><summary><h4>Widget</h4></summary>
530    ///
531    ///
532    /// #### `destroy`
533    ///  Signals that all holders of a reference to the widget should release
534    /// the reference that they hold.
535    ///
536    /// May result in finalization of the widget if all references are released.
537    ///
538    /// This signal is not suitable for saving widget state.
539    ///
540    ///
541    ///
542    ///
543    /// #### `direction-changed`
544    ///  Emitted when the text direction of a widget changes.
545    ///
546    ///
547    ///
548    ///
549    /// #### `hide`
550    ///  Emitted when @widget is hidden.
551    ///
552    ///
553    ///
554    ///
555    /// #### `keynav-failed`
556    ///  Emitted if keyboard navigation fails.
557    ///
558    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
559    ///
560    ///
561    ///
562    ///
563    /// #### `map`
564    ///  Emitted when @widget is going to be mapped.
565    ///
566    /// A widget is mapped when the widget is visible (which is controlled with
567    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
568    /// are also visible.
569    ///
570    /// The `::map` signal can be used to determine whether a widget will be drawn,
571    /// for instance it can resume an animation that was stopped during the
572    /// emission of [`unmap`][struct@crate::Widget#unmap].
573    ///
574    ///
575    ///
576    ///
577    /// #### `mnemonic-activate`
578    ///  Emitted when a widget is activated via a mnemonic.
579    ///
580    /// The default handler for this signal activates @widget if @group_cycling
581    /// is false, or just makes @widget grab focus if @group_cycling is true.
582    ///
583    ///
584    ///
585    ///
586    /// #### `move-focus`
587    ///  Emitted when the focus is moved.
588    ///
589    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
590    ///
591    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
592    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
593    ///
594    /// Action
595    ///
596    ///
597    /// #### `query-tooltip`
598    ///  Emitted when the widget’s tooltip is about to be shown.
599    ///
600    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
601    /// is true and the hover timeout has expired with the cursor hovering
602    /// above @widget; or emitted when @widget got focus in keyboard mode.
603    ///
604    /// Using the given coordinates, the signal handler should determine
605    /// whether a tooltip should be shown for @widget. If this is the case
606    /// true should be returned, false otherwise. Note that if @keyboard_mode
607    /// is true, the values of @x and @y are undefined and should not be used.
608    ///
609    /// The signal handler is free to manipulate @tooltip with the therefore
610    /// destined function calls.
611    ///
612    ///
613    ///
614    ///
615    /// #### `realize`
616    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
617    ///
618    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
619    /// or the widget has been mapped (that is, it is going to be drawn).
620    ///
621    ///
622    ///
623    ///
624    /// #### `show`
625    ///  Emitted when @widget is shown.
626    ///
627    ///
628    ///
629    ///
630    /// #### `state-flags-changed`
631    ///  Emitted when the widget state changes.
632    ///
633    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
634    ///
635    ///
636    ///
637    ///
638    /// #### `unmap`
639    ///  Emitted when @widget is going to be unmapped.
640    ///
641    /// A widget is unmapped when either it or any of its parents up to the
642    /// toplevel widget have been set as hidden.
643    ///
644    /// As `::unmap` indicates that a widget will not be shown any longer,
645    /// it can be used to, for example, stop an animation on the widget.
646    ///
647    ///
648    ///
649    ///
650    /// #### `unrealize`
651    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
652    ///
653    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
654    /// or the widget has been unmapped (that is, it is going to be hidden).
655    ///
656    ///
657    /// </details>
658    /// <details><summary><h4>Editable</h4></summary>
659    ///
660    ///
661    /// #### `changed`
662    ///  Emitted at the end of a single user-visible operation on the
663    /// contents.
664    ///
665    /// E.g., a paste operation that replaces the contents of the
666    /// selection will cause only one signal emission (even though it
667    /// is implemented by first deleting the selection, then inserting
668    /// the new content, and may cause multiple ::notify::text signals
669    /// to be emitted).
670    ///
671    ///
672    ///
673    ///
674    /// #### `delete-text`
675    ///  Emitted when text is deleted from the widget by the user.
676    ///
677    /// The default handler for this signal will normally be responsible for
678    /// deleting the text, so by connecting to this signal and then stopping
679    /// the signal with g_signal_stop_emission(), it is possible to modify the
680    /// range of deleted text, or prevent it from being deleted entirely.
681    ///
682    /// The @start_pos and @end_pos parameters are interpreted as for
683    /// [`EditableExt::delete_text()`][crate::prelude::EditableExt::delete_text()].
684    ///
685    ///
686    ///
687    ///
688    /// #### `insert-text`
689    ///  Emitted when text is inserted into the widget by the user.
690    ///
691    /// The default handler for this signal will normally be responsible
692    /// for inserting the text, so by connecting to this signal and then
693    /// stopping the signal with g_signal_stop_emission(), it is possible
694    /// to modify the inserted text, or prevent it from being inserted entirely.
695    ///
696    ///
697    /// </details>
698    ///
699    /// # Implements
700    ///
701    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`EditableExt`][trait@crate::prelude::EditableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`EditableExtManual`][trait@crate::prelude::EditableExtManual]
702    #[doc(alias = "GtkSearchEntry")]
703    pub struct SearchEntry(Object<ffi::GtkSearchEntry>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Editable;
704
705    match fn {
706        type_ => || ffi::gtk_search_entry_get_type(),
707    }
708}
709
710impl SearchEntry {
711    /// Creates a [`SearchEntry`][crate::SearchEntry].
712    ///
713    /// # Returns
714    ///
715    /// a new [`SearchEntry`][crate::SearchEntry]
716    #[doc(alias = "gtk_search_entry_new")]
717    pub fn new() -> SearchEntry {
718        assert_initialized_main_thread!();
719        unsafe { Widget::from_glib_none(ffi::gtk_search_entry_new()).unsafe_cast() }
720    }
721
722    // rustdoc-stripper-ignore-next
723    /// Creates a new builder-pattern struct instance to construct [`SearchEntry`] objects.
724    ///
725    /// This method returns an instance of [`SearchEntryBuilder`](crate::builders::SearchEntryBuilder) which can be used to create [`SearchEntry`] objects.
726    pub fn builder() -> SearchEntryBuilder {
727        SearchEntryBuilder::new()
728    }
729
730    /// Gets the input purpose for @self.
731    ///
732    /// # Returns
733    ///
734    /// The input hints
735    #[cfg(feature = "v4_14")]
736    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
737    #[doc(alias = "gtk_search_entry_get_input_hints")]
738    #[doc(alias = "get_input_hints")]
739    #[doc(alias = "input-hints")]
740    pub fn input_hints(&self) -> InputHints {
741        unsafe { from_glib(ffi::gtk_search_entry_get_input_hints(self.to_glib_none().0)) }
742    }
743
744    /// Gets the input purpose of @self.
745    ///
746    /// # Returns
747    ///
748    /// The input hints
749    #[cfg(feature = "v4_14")]
750    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
751    #[doc(alias = "gtk_search_entry_get_input_purpose")]
752    #[doc(alias = "get_input_purpose")]
753    #[doc(alias = "input-purpose")]
754    pub fn input_purpose(&self) -> InputPurpose {
755        unsafe {
756            from_glib(ffi::gtk_search_entry_get_input_purpose(
757                self.to_glib_none().0,
758            ))
759        }
760    }
761
762    /// Gets the widget that @self is capturing key events from.
763    ///
764    /// # Returns
765    ///
766    /// The key capture widget.
767    #[doc(alias = "gtk_search_entry_get_key_capture_widget")]
768    #[doc(alias = "get_key_capture_widget")]
769    pub fn key_capture_widget(&self) -> Option<Widget> {
770        unsafe {
771            from_glib_none(ffi::gtk_search_entry_get_key_capture_widget(
772                self.to_glib_none().0,
773            ))
774        }
775    }
776
777    /// Get the delay to be used between the last keypress and the
778    /// [`search-changed`][struct@crate::SearchEntry#search-changed] signal being emitted.
779    ///
780    /// # Returns
781    ///
782    /// a delay in milliseconds.
783    #[cfg(feature = "v4_8")]
784    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
785    #[doc(alias = "gtk_search_entry_get_search_delay")]
786    #[doc(alias = "get_search_delay")]
787    #[doc(alias = "search-delay")]
788    pub fn search_delay(&self) -> u32 {
789        unsafe { ffi::gtk_search_entry_get_search_delay(self.to_glib_none().0) }
790    }
791
792    /// Sets the input hints for @self.
793    /// ## `hints`
794    /// the new input hints
795    #[cfg(feature = "v4_14")]
796    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
797    #[doc(alias = "gtk_search_entry_set_input_hints")]
798    #[doc(alias = "input-hints")]
799    pub fn set_input_hints(&self, hints: InputHints) {
800        unsafe {
801            ffi::gtk_search_entry_set_input_hints(self.to_glib_none().0, hints.into_glib());
802        }
803    }
804
805    /// Sets the input purpose of @self.
806    /// ## `purpose`
807    /// the new input purpose
808    #[cfg(feature = "v4_14")]
809    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
810    #[doc(alias = "gtk_search_entry_set_input_purpose")]
811    #[doc(alias = "input-purpose")]
812    pub fn set_input_purpose(&self, purpose: InputPurpose) {
813        unsafe {
814            ffi::gtk_search_entry_set_input_purpose(self.to_glib_none().0, purpose.into_glib());
815        }
816    }
817
818    /// Sets @widget as the widget that @self will capture key
819    /// events from.
820    ///
821    /// Key events are consumed by the search entry to start or
822    /// continue a search.
823    ///
824    /// If the entry is part of a [`SearchBar`][crate::SearchBar], it is preferable
825    /// to call [`SearchBar::set_key_capture_widget()`][crate::SearchBar::set_key_capture_widget()] instead,
826    /// which will reveal the entry in addition to triggering the
827    /// search entry.
828    ///
829    /// Note that despite the name of this function, the events
830    /// are only 'captured' in the bubble phase, which means that
831    /// editable child widgets of @widget will receive text input
832    /// before it gets captured. If that is not desired, you can
833    /// capture and forward the events yourself with
834    /// [`EventControllerKey::forward()`][crate::EventControllerKey::forward()].
835    /// ## `widget`
836    /// a [`Widget`][crate::Widget]
837    #[doc(alias = "gtk_search_entry_set_key_capture_widget")]
838    pub fn set_key_capture_widget(&self, widget: Option<&impl IsA<Widget>>) {
839        unsafe {
840            ffi::gtk_search_entry_set_key_capture_widget(
841                self.to_glib_none().0,
842                widget.map(|p| p.as_ref()).to_glib_none().0,
843            );
844        }
845    }
846
847    /// Set the delay to be used between the last keypress and the
848    /// [`search-changed`][struct@crate::SearchEntry#search-changed] signal being emitted.
849    /// ## `delay`
850    /// a delay in milliseconds
851    #[cfg(feature = "v4_8")]
852    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
853    #[doc(alias = "gtk_search_entry_set_search_delay")]
854    #[doc(alias = "search-delay")]
855    pub fn set_search_delay(&self, delay: u32) {
856        unsafe {
857            ffi::gtk_search_entry_set_search_delay(self.to_glib_none().0, delay);
858        }
859    }
860
861    /// Whether to activate the default widget when Enter is pressed.
862    #[doc(alias = "activates-default")]
863    pub fn activates_default(&self) -> bool {
864        ObjectExt::property(self, "activates-default")
865    }
866
867    /// Whether to activate the default widget when Enter is pressed.
868    #[doc(alias = "activates-default")]
869    pub fn set_activates_default(&self, activates_default: bool) {
870        ObjectExt::set_property(self, "activates-default", activates_default)
871    }
872
873    #[doc(alias = "placeholder-text")]
874    pub fn placeholder_text(&self) -> Option<glib::GString> {
875        ObjectExt::property(self, "placeholder-text")
876    }
877
878    #[doc(alias = "placeholder-text")]
879    pub fn set_placeholder_text(&self, placeholder_text: Option<&str>) {
880        ObjectExt::set_property(self, "placeholder-text", placeholder_text)
881    }
882
883    /// Emitted when the entry is activated.
884    ///
885    /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
886    #[doc(alias = "activate")]
887    pub fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
888        unsafe extern "C" fn activate_trampoline<F: Fn(&SearchEntry) + 'static>(
889            this: *mut ffi::GtkSearchEntry,
890            f: glib::ffi::gpointer,
891        ) {
892            unsafe {
893                let f: &F = &*(f as *const F);
894                f(&from_glib_borrow(this))
895            }
896        }
897        unsafe {
898            let f: Box_<F> = Box_::new(f);
899            connect_raw(
900                self.as_ptr() as *mut _,
901                c"activate".as_ptr() as *const _,
902                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
903                    activate_trampoline::<F> as *const (),
904                )),
905                Box_::into_raw(f),
906            )
907        }
908    }
909
910    pub fn emit_activate(&self) {
911        self.emit_by_name::<()>("activate", &[]);
912    }
913
914    /// Emitted when the user initiates a move to the next match
915    /// for the current search string.
916    ///
917    /// This is a [keybinding signal](class.SignalAction.html).
918    ///
919    /// Applications should connect to it, to implement moving
920    /// between matches.
921    ///
922    /// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>g</kbd>.
923    #[doc(alias = "next-match")]
924    pub fn connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
925        unsafe extern "C" fn next_match_trampoline<F: Fn(&SearchEntry) + 'static>(
926            this: *mut ffi::GtkSearchEntry,
927            f: glib::ffi::gpointer,
928        ) {
929            unsafe {
930                let f: &F = &*(f as *const F);
931                f(&from_glib_borrow(this))
932            }
933        }
934        unsafe {
935            let f: Box_<F> = Box_::new(f);
936            connect_raw(
937                self.as_ptr() as *mut _,
938                c"next-match".as_ptr() as *const _,
939                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
940                    next_match_trampoline::<F> as *const (),
941                )),
942                Box_::into_raw(f),
943            )
944        }
945    }
946
947    pub fn emit_next_match(&self) {
948        self.emit_by_name::<()>("next-match", &[]);
949    }
950
951    /// Emitted when the user initiates a move to the previous match
952    /// for the current search string.
953    ///
954    /// This is a [keybinding signal](class.SignalAction.html).
955    ///
956    /// Applications should connect to it, to implement moving
957    /// between matches.
958    ///
959    /// The default bindings for this signal is
960    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>g</kbd>.
961    #[doc(alias = "previous-match")]
962    pub fn connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
963        unsafe extern "C" fn previous_match_trampoline<F: Fn(&SearchEntry) + 'static>(
964            this: *mut ffi::GtkSearchEntry,
965            f: glib::ffi::gpointer,
966        ) {
967            unsafe {
968                let f: &F = &*(f as *const F);
969                f(&from_glib_borrow(this))
970            }
971        }
972        unsafe {
973            let f: Box_<F> = Box_::new(f);
974            connect_raw(
975                self.as_ptr() as *mut _,
976                c"previous-match".as_ptr() as *const _,
977                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
978                    previous_match_trampoline::<F> as *const (),
979                )),
980                Box_::into_raw(f),
981            )
982        }
983    }
984
985    pub fn emit_previous_match(&self) {
986        self.emit_by_name::<()>("previous-match", &[]);
987    }
988
989    /// Emitted with a delay. The length of the delay can be
990    /// changed with the [`search-delay`][struct@crate::SearchEntry#search-delay]
991    /// property.
992    #[doc(alias = "search-changed")]
993    pub fn connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
994        unsafe extern "C" fn search_changed_trampoline<F: Fn(&SearchEntry) + 'static>(
995            this: *mut ffi::GtkSearchEntry,
996            f: glib::ffi::gpointer,
997        ) {
998            unsafe {
999                let f: &F = &*(f as *const F);
1000                f(&from_glib_borrow(this))
1001            }
1002        }
1003        unsafe {
1004            let f: Box_<F> = Box_::new(f);
1005            connect_raw(
1006                self.as_ptr() as *mut _,
1007                c"search-changed".as_ptr() as *const _,
1008                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1009                    search_changed_trampoline::<F> as *const (),
1010                )),
1011                Box_::into_raw(f),
1012            )
1013        }
1014    }
1015
1016    /// Emitted when the user initiated a search on the entry.
1017    #[doc(alias = "search-started")]
1018    pub fn connect_search_started<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1019        unsafe extern "C" fn search_started_trampoline<F: Fn(&SearchEntry) + 'static>(
1020            this: *mut ffi::GtkSearchEntry,
1021            f: glib::ffi::gpointer,
1022        ) {
1023            unsafe {
1024                let f: &F = &*(f as *const F);
1025                f(&from_glib_borrow(this))
1026            }
1027        }
1028        unsafe {
1029            let f: Box_<F> = Box_::new(f);
1030            connect_raw(
1031                self.as_ptr() as *mut _,
1032                c"search-started".as_ptr() as *const _,
1033                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1034                    search_started_trampoline::<F> as *const (),
1035                )),
1036                Box_::into_raw(f),
1037            )
1038        }
1039    }
1040
1041    /// Emitted when the user stops a search via keyboard input.
1042    ///
1043    /// This is a [keybinding signal](class.SignalAction.html).
1044    ///
1045    /// Applications should connect to it, to implement hiding
1046    /// the search entry in this case.
1047    ///
1048    /// The default bindings for this signal is <kbd>Escape</kbd>.
1049    #[doc(alias = "stop-search")]
1050    pub fn connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1051        unsafe extern "C" fn stop_search_trampoline<F: Fn(&SearchEntry) + 'static>(
1052            this: *mut ffi::GtkSearchEntry,
1053            f: glib::ffi::gpointer,
1054        ) {
1055            unsafe {
1056                let f: &F = &*(f as *const F);
1057                f(&from_glib_borrow(this))
1058            }
1059        }
1060        unsafe {
1061            let f: Box_<F> = Box_::new(f);
1062            connect_raw(
1063                self.as_ptr() as *mut _,
1064                c"stop-search".as_ptr() as *const _,
1065                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1066                    stop_search_trampoline::<F> as *const (),
1067                )),
1068                Box_::into_raw(f),
1069            )
1070        }
1071    }
1072
1073    pub fn emit_stop_search(&self) {
1074        self.emit_by_name::<()>("stop-search", &[]);
1075    }
1076
1077    #[doc(alias = "activates-default")]
1078    pub fn connect_activates_default_notify<F: Fn(&Self) + 'static>(
1079        &self,
1080        f: F,
1081    ) -> SignalHandlerId {
1082        unsafe extern "C" fn notify_activates_default_trampoline<F: Fn(&SearchEntry) + 'static>(
1083            this: *mut ffi::GtkSearchEntry,
1084            _param_spec: glib::ffi::gpointer,
1085            f: glib::ffi::gpointer,
1086        ) {
1087            unsafe {
1088                let f: &F = &*(f as *const F);
1089                f(&from_glib_borrow(this))
1090            }
1091        }
1092        unsafe {
1093            let f: Box_<F> = Box_::new(f);
1094            connect_raw(
1095                self.as_ptr() as *mut _,
1096                c"notify::activates-default".as_ptr() as *const _,
1097                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1098                    notify_activates_default_trampoline::<F> as *const (),
1099                )),
1100                Box_::into_raw(f),
1101            )
1102        }
1103    }
1104
1105    #[cfg(feature = "v4_14")]
1106    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1107    #[doc(alias = "input-hints")]
1108    pub fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1109        unsafe extern "C" fn notify_input_hints_trampoline<F: Fn(&SearchEntry) + 'static>(
1110            this: *mut ffi::GtkSearchEntry,
1111            _param_spec: glib::ffi::gpointer,
1112            f: glib::ffi::gpointer,
1113        ) {
1114            unsafe {
1115                let f: &F = &*(f as *const F);
1116                f(&from_glib_borrow(this))
1117            }
1118        }
1119        unsafe {
1120            let f: Box_<F> = Box_::new(f);
1121            connect_raw(
1122                self.as_ptr() as *mut _,
1123                c"notify::input-hints".as_ptr() as *const _,
1124                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1125                    notify_input_hints_trampoline::<F> as *const (),
1126                )),
1127                Box_::into_raw(f),
1128            )
1129        }
1130    }
1131
1132    #[cfg(feature = "v4_14")]
1133    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1134    #[doc(alias = "input-purpose")]
1135    pub fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1136        unsafe extern "C" fn notify_input_purpose_trampoline<F: Fn(&SearchEntry) + 'static>(
1137            this: *mut ffi::GtkSearchEntry,
1138            _param_spec: glib::ffi::gpointer,
1139            f: glib::ffi::gpointer,
1140        ) {
1141            unsafe {
1142                let f: &F = &*(f as *const F);
1143                f(&from_glib_borrow(this))
1144            }
1145        }
1146        unsafe {
1147            let f: Box_<F> = Box_::new(f);
1148            connect_raw(
1149                self.as_ptr() as *mut _,
1150                c"notify::input-purpose".as_ptr() as *const _,
1151                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1152                    notify_input_purpose_trampoline::<F> as *const (),
1153                )),
1154                Box_::into_raw(f),
1155            )
1156        }
1157    }
1158
1159    #[doc(alias = "placeholder-text")]
1160    pub fn connect_placeholder_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1161        unsafe extern "C" fn notify_placeholder_text_trampoline<F: Fn(&SearchEntry) + 'static>(
1162            this: *mut ffi::GtkSearchEntry,
1163            _param_spec: glib::ffi::gpointer,
1164            f: glib::ffi::gpointer,
1165        ) {
1166            unsafe {
1167                let f: &F = &*(f as *const F);
1168                f(&from_glib_borrow(this))
1169            }
1170        }
1171        unsafe {
1172            let f: Box_<F> = Box_::new(f);
1173            connect_raw(
1174                self.as_ptr() as *mut _,
1175                c"notify::placeholder-text".as_ptr() as *const _,
1176                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1177                    notify_placeholder_text_trampoline::<F> as *const (),
1178                )),
1179                Box_::into_raw(f),
1180            )
1181        }
1182    }
1183
1184    #[cfg(feature = "v4_8")]
1185    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1186    #[doc(alias = "search-delay")]
1187    pub fn connect_search_delay_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1188        unsafe extern "C" fn notify_search_delay_trampoline<F: Fn(&SearchEntry) + 'static>(
1189            this: *mut ffi::GtkSearchEntry,
1190            _param_spec: glib::ffi::gpointer,
1191            f: glib::ffi::gpointer,
1192        ) {
1193            unsafe {
1194                let f: &F = &*(f as *const F);
1195                f(&from_glib_borrow(this))
1196            }
1197        }
1198        unsafe {
1199            let f: Box_<F> = Box_::new(f);
1200            connect_raw(
1201                self.as_ptr() as *mut _,
1202                c"notify::search-delay".as_ptr() as *const _,
1203                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1204                    notify_search_delay_trampoline::<F> as *const (),
1205                )),
1206                Box_::into_raw(f),
1207            )
1208        }
1209    }
1210}
1211
1212impl Default for SearchEntry {
1213    fn default() -> Self {
1214        Self::new()
1215    }
1216}
1217
1218// rustdoc-stripper-ignore-next
1219/// A [builder-pattern] type to construct [`SearchEntry`] objects.
1220///
1221/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1222#[must_use = "The builder must be built to be used"]
1223pub struct SearchEntryBuilder {
1224    builder: glib::object::ObjectBuilder<'static, SearchEntry>,
1225}
1226
1227impl SearchEntryBuilder {
1228    fn new() -> Self {
1229        Self {
1230            builder: glib::object::Object::builder(),
1231        }
1232    }
1233
1234    /// Whether to activate the default widget when Enter is pressed.
1235    pub fn activates_default(self, activates_default: bool) -> Self {
1236        Self {
1237            builder: self
1238                .builder
1239                .property("activates-default", activates_default),
1240        }
1241    }
1242
1243    /// The hints about input for the [`SearchEntry`][crate::SearchEntry] used to alter the
1244    /// behaviour of input methods.
1245    #[cfg(feature = "v4_14")]
1246    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1247    pub fn input_hints(self, input_hints: InputHints) -> Self {
1248        Self {
1249            builder: self.builder.property("input-hints", input_hints),
1250        }
1251    }
1252
1253    /// The purpose for the [`SearchEntry`][crate::SearchEntry] input used to alter the
1254    /// behaviour of input methods.
1255    #[cfg(feature = "v4_14")]
1256    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
1257    pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
1258        Self {
1259            builder: self.builder.property("input-purpose", input_purpose),
1260        }
1261    }
1262
1263    /// The text that will be displayed in the [`SearchEntry`][crate::SearchEntry]
1264    /// when it is empty and unfocused.
1265    pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
1266        Self {
1267            builder: self
1268                .builder
1269                .property("placeholder-text", placeholder_text.into()),
1270        }
1271    }
1272
1273    /// The delay in milliseconds from last keypress to the search
1274    /// changed signal.
1275    #[cfg(feature = "v4_8")]
1276    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1277    pub fn search_delay(self, search_delay: u32) -> Self {
1278        Self {
1279            builder: self.builder.property("search-delay", search_delay),
1280        }
1281    }
1282
1283    /// Whether the widget or any of its descendents can accept
1284    /// the input focus.
1285    ///
1286    /// This property is meant to be set by widget implementations,
1287    /// typically in their instance init function.
1288    pub fn can_focus(self, can_focus: bool) -> Self {
1289        Self {
1290            builder: self.builder.property("can-focus", can_focus),
1291        }
1292    }
1293
1294    /// Whether the widget can receive pointer events.
1295    pub fn can_target(self, can_target: bool) -> Self {
1296        Self {
1297            builder: self.builder.property("can-target", can_target),
1298        }
1299    }
1300
1301    /// A list of css classes applied to this widget.
1302    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1303        Self {
1304            builder: self.builder.property("css-classes", css_classes.into()),
1305        }
1306    }
1307
1308    /// The name of this widget in the CSS tree.
1309    ///
1310    /// This property is meant to be set by widget implementations,
1311    /// typically in their instance init function.
1312    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1313        Self {
1314            builder: self.builder.property("css-name", css_name.into()),
1315        }
1316    }
1317
1318    /// The cursor used by @widget.
1319    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1320        Self {
1321            builder: self.builder.property("cursor", cursor.clone()),
1322        }
1323    }
1324
1325    /// Whether the widget should grab focus when it is clicked with the mouse.
1326    ///
1327    /// This property is only relevant for widgets that can take focus.
1328    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1329        Self {
1330            builder: self.builder.property("focus-on-click", focus_on_click),
1331        }
1332    }
1333
1334    /// Whether this widget itself will accept the input focus.
1335    pub fn focusable(self, focusable: bool) -> Self {
1336        Self {
1337            builder: self.builder.property("focusable", focusable),
1338        }
1339    }
1340
1341    /// How to distribute horizontal space if widget gets extra space.
1342    pub fn halign(self, halign: Align) -> Self {
1343        Self {
1344            builder: self.builder.property("halign", halign),
1345        }
1346    }
1347
1348    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1349    /// signal on @widget.
1350    ///
1351    /// A true value indicates that @widget can have a tooltip, in this case
1352    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1353    /// determine whether it will provide a tooltip or not.
1354    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1355        Self {
1356            builder: self.builder.property("has-tooltip", has_tooltip),
1357        }
1358    }
1359
1360    /// Overrides for height request of the widget.
1361    ///
1362    /// If this is -1, the natural request will be used.
1363    pub fn height_request(self, height_request: i32) -> Self {
1364        Self {
1365            builder: self.builder.property("height-request", height_request),
1366        }
1367    }
1368
1369    /// Whether to expand horizontally.
1370    pub fn hexpand(self, hexpand: bool) -> Self {
1371        Self {
1372            builder: self.builder.property("hexpand", hexpand),
1373        }
1374    }
1375
1376    /// Whether to use the `hexpand` property.
1377    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1378        Self {
1379            builder: self.builder.property("hexpand-set", hexpand_set),
1380        }
1381    }
1382
1383    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1384    /// the preferred size of the widget, and allocate its children.
1385    ///
1386    /// This property is meant to be set by widget implementations,
1387    /// typically in their instance init function.
1388    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1389        Self {
1390            builder: self
1391                .builder
1392                .property("layout-manager", layout_manager.clone().upcast()),
1393        }
1394    }
1395
1396    /// Makes this widget act like a modal dialog, with respect to
1397    /// event delivery.
1398    ///
1399    /// Global event controllers will not handle events with targets
1400    /// inside the widget, unless they are set up to ignore propagation
1401    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1402    #[cfg(feature = "v4_18")]
1403    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1404    pub fn limit_events(self, limit_events: bool) -> Self {
1405        Self {
1406            builder: self.builder.property("limit-events", limit_events),
1407        }
1408    }
1409
1410    /// Margin on bottom side of widget.
1411    ///
1412    /// This property adds margin outside of the widget's normal size
1413    /// request, the margin will be added in addition to the size from
1414    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1415    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1416        Self {
1417            builder: self.builder.property("margin-bottom", margin_bottom),
1418        }
1419    }
1420
1421    /// Margin on end of widget, horizontally.
1422    ///
1423    /// This property supports left-to-right and right-to-left text
1424    /// directions.
1425    ///
1426    /// This property adds margin outside of the widget's normal size
1427    /// request, the margin will be added in addition to the size from
1428    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1429    pub fn margin_end(self, margin_end: i32) -> Self {
1430        Self {
1431            builder: self.builder.property("margin-end", margin_end),
1432        }
1433    }
1434
1435    /// Margin on start of widget, horizontally.
1436    ///
1437    /// This property supports left-to-right and right-to-left text
1438    /// directions.
1439    ///
1440    /// This property adds margin outside of the widget's normal size
1441    /// request, the margin will be added in addition to the size from
1442    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1443    pub fn margin_start(self, margin_start: i32) -> Self {
1444        Self {
1445            builder: self.builder.property("margin-start", margin_start),
1446        }
1447    }
1448
1449    /// Margin on top side of widget.
1450    ///
1451    /// This property adds margin outside of the widget's normal size
1452    /// request, the margin will be added in addition to the size from
1453    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1454    pub fn margin_top(self, margin_top: i32) -> Self {
1455        Self {
1456            builder: self.builder.property("margin-top", margin_top),
1457        }
1458    }
1459
1460    /// The name of the widget.
1461    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1462        Self {
1463            builder: self.builder.property("name", name.into()),
1464        }
1465    }
1466
1467    /// The requested opacity of the widget.
1468    pub fn opacity(self, opacity: f64) -> Self {
1469        Self {
1470            builder: self.builder.property("opacity", opacity),
1471        }
1472    }
1473
1474    /// How content outside the widget's content area is treated.
1475    ///
1476    /// This property is meant to be set by widget implementations,
1477    /// typically in their instance init function.
1478    pub fn overflow(self, overflow: Overflow) -> Self {
1479        Self {
1480            builder: self.builder.property("overflow", overflow),
1481        }
1482    }
1483
1484    /// Whether the widget will receive the default action when it is focused.
1485    pub fn receives_default(self, receives_default: bool) -> Self {
1486        Self {
1487            builder: self.builder.property("receives-default", receives_default),
1488        }
1489    }
1490
1491    /// Whether the widget responds to input.
1492    pub fn sensitive(self, sensitive: bool) -> Self {
1493        Self {
1494            builder: self.builder.property("sensitive", sensitive),
1495        }
1496    }
1497
1498    /// Sets the text of tooltip to be the given string, which is marked up
1499    /// with Pango markup.
1500    ///
1501    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1502    ///
1503    /// This is a convenience property which will take care of getting the
1504    /// tooltip shown if the given string is not `NULL`:
1505    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1506    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1507    /// the default signal handler.
1508    ///
1509    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1510    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1511    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1512        Self {
1513            builder: self
1514                .builder
1515                .property("tooltip-markup", tooltip_markup.into()),
1516        }
1517    }
1518
1519    /// Sets the text of tooltip to be the given string.
1520    ///
1521    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1522    ///
1523    /// This is a convenience property which will take care of getting the
1524    /// tooltip shown if the given string is not `NULL`:
1525    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1526    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1527    /// the default signal handler.
1528    ///
1529    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1530    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1531    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1532        Self {
1533            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1534        }
1535    }
1536
1537    /// How to distribute vertical space if widget gets extra space.
1538    pub fn valign(self, valign: Align) -> Self {
1539        Self {
1540            builder: self.builder.property("valign", valign),
1541        }
1542    }
1543
1544    /// Whether to expand vertically.
1545    pub fn vexpand(self, vexpand: bool) -> Self {
1546        Self {
1547            builder: self.builder.property("vexpand", vexpand),
1548        }
1549    }
1550
1551    /// Whether to use the `vexpand` property.
1552    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1553        Self {
1554            builder: self.builder.property("vexpand-set", vexpand_set),
1555        }
1556    }
1557
1558    /// Whether the widget is visible.
1559    pub fn visible(self, visible: bool) -> Self {
1560        Self {
1561            builder: self.builder.property("visible", visible),
1562        }
1563    }
1564
1565    /// Overrides for width request of the widget.
1566    ///
1567    /// If this is -1, the natural request will be used.
1568    pub fn width_request(self, width_request: i32) -> Self {
1569        Self {
1570            builder: self.builder.property("width-request", width_request),
1571        }
1572    }
1573
1574    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1575    ///
1576    /// The accessible role cannot be changed once set.
1577    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1578        Self {
1579            builder: self.builder.property("accessible-role", accessible_role),
1580        }
1581    }
1582
1583    /// Whether the entry contents can be edited.
1584    pub fn editable(self, editable: bool) -> Self {
1585        Self {
1586            builder: self.builder.property("editable", editable),
1587        }
1588    }
1589
1590    /// If undo/redo should be enabled for the editable.
1591    pub fn enable_undo(self, enable_undo: bool) -> Self {
1592        Self {
1593            builder: self.builder.property("enable-undo", enable_undo),
1594        }
1595    }
1596
1597    /// The desired maximum width of the entry, in characters.
1598    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1599        Self {
1600            builder: self.builder.property("max-width-chars", max_width_chars),
1601        }
1602    }
1603
1604    /// The contents of the entry.
1605    pub fn text(self, text: impl Into<glib::GString>) -> Self {
1606        Self {
1607            builder: self.builder.property("text", text.into()),
1608        }
1609    }
1610
1611    /// Number of characters to leave space for in the entry.
1612    pub fn width_chars(self, width_chars: i32) -> Self {
1613        Self {
1614            builder: self.builder.property("width-chars", width_chars),
1615        }
1616    }
1617
1618    /// The horizontal alignment, from 0 (left) to 1 (right).
1619    ///
1620    /// Reversed for RTL layouts.
1621    pub fn xalign(self, xalign: f32) -> Self {
1622        Self {
1623            builder: self.builder.property("xalign", xalign),
1624        }
1625    }
1626
1627    // rustdoc-stripper-ignore-next
1628    /// Build the [`SearchEntry`].
1629    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1630    pub fn build(self) -> SearchEntry {
1631        assert_initialized_main_thread!();
1632        self.builder.build()
1633    }
1634}