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