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