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