gtk/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 Align, Buildable, CellEditable, Container, Editable, Entry, EntryBuffer, EntryCompletion,
7 InputHints, InputPurpose, Widget, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// [`SearchEntry`][crate::SearchEntry] is a subclass of [`Entry`][crate::Entry] that has been
19 /// tailored for use as a search entry.
20 ///
21 /// It will show an inactive symbolic “find” icon when the search
22 /// entry is empty, and a symbolic “clear” icon when there is text.
23 /// Clicking on the “clear” icon will empty the search entry.
24 ///
25 /// Note that the search/clear icon is shown using a secondary
26 /// icon, and thus does not work if you are using the secondary
27 /// icon position for some other purpose.
28 ///
29 /// To make filtering appear more reactive, it is a good idea to
30 /// not react to every change in the entry text immediately, but
31 /// only after a short delay. To support this, [`SearchEntry`][crate::SearchEntry]
32 /// emits the [`search-changed`][struct@crate::SearchEntry#search-changed] signal which can
33 /// be used instead of the [`changed`][struct@crate::Editable#changed] signal.
34 ///
35 /// The [`previous-match`][struct@crate::SearchEntry#previous-match], [`next-match`][struct@crate::SearchEntry#next-match]
36 /// and [`stop-search`][struct@crate::SearchEntry#stop-search] signals can be used to implement
37 /// moving between search results and ending the search.
38 ///
39 /// Often, GtkSearchEntry will be fed events by means of being
40 /// placed inside a [`SearchBar`][crate::SearchBar]. If that is not the case,
41 /// you can use [`SearchEntryExt::handle_event()`][crate::prelude::SearchEntryExt::handle_event()] to pass events.
42 ///
43 /// ## Signals
44 ///
45 ///
46 /// #### `next-match`
47 /// The ::next-match signal is a [keybinding signal][GtkBindingSignal]
48 /// which gets emitted when the user initiates a move to the next match
49 /// for the current search string.
50 ///
51 /// Applications should connect to it, to implement moving between
52 /// matches.
53 ///
54 /// The default bindings for this signal is Ctrl-g.
55 ///
56 /// Action
57 ///
58 ///
59 /// #### `previous-match`
60 /// The ::previous-match signal is a [keybinding signal][GtkBindingSignal]
61 /// which gets emitted when the user initiates a move to the previous match
62 /// for the current search string.
63 ///
64 /// Applications should connect to it, to implement moving between
65 /// matches.
66 ///
67 /// The default bindings for this signal is Ctrl-Shift-g.
68 ///
69 /// Action
70 ///
71 ///
72 /// #### `search-changed`
73 /// The [`search-changed`][struct@crate::SearchEntry#search-changed] signal is emitted with a short
74 /// delay of 150 milliseconds after the last change to the entry text.
75 ///
76 ///
77 ///
78 ///
79 /// #### `stop-search`
80 /// The ::stop-search signal is a [keybinding signal][GtkBindingSignal]
81 /// which gets emitted when the user stops a search via keyboard input.
82 ///
83 /// Applications should connect to it, to implement hiding the search
84 /// entry in this case.
85 ///
86 /// The default bindings for this signal is Escape.
87 ///
88 /// Action
89 /// <details><summary><h4>Entry</h4></summary>
90 ///
91 ///
92 /// #### `activate`
93 /// The ::activate signal is emitted when the user hits
94 /// the Enter key.
95 ///
96 /// While this signal is used as a
97 /// [keybinding signal][GtkBindingSignal],
98 /// it is also commonly used by applications to intercept
99 /// activation of entries.
100 ///
101 /// The default bindings for this signal are all forms of the Enter key.
102 ///
103 /// Action
104 ///
105 ///
106 /// #### `backspace`
107 /// The ::backspace signal is a
108 /// [keybinding signal][GtkBindingSignal]
109 /// which gets emitted when the user asks for it.
110 ///
111 /// The default bindings for this signal are
112 /// Backspace and Shift-Backspace.
113 ///
114 /// Action
115 ///
116 ///
117 /// #### `copy-clipboard`
118 /// The ::copy-clipboard signal is a
119 /// [keybinding signal][GtkBindingSignal]
120 /// which gets emitted to copy the selection to the clipboard.
121 ///
122 /// The default bindings for this signal are
123 /// Ctrl-c and Ctrl-Insert.
124 ///
125 /// Action
126 ///
127 ///
128 /// #### `cut-clipboard`
129 /// The ::cut-clipboard signal is a
130 /// [keybinding signal][GtkBindingSignal]
131 /// which gets emitted to cut the selection to the clipboard.
132 ///
133 /// The default bindings for this signal are
134 /// Ctrl-x and Shift-Delete.
135 ///
136 /// Action
137 ///
138 ///
139 /// #### `delete-from-cursor`
140 /// The ::delete-from-cursor signal is a
141 /// [keybinding signal][GtkBindingSignal]
142 /// which gets emitted when the user initiates a text deletion.
143 ///
144 /// If the `type_` is [`DeleteType::Chars`][crate::DeleteType::Chars], GTK+ deletes the selection
145 /// if there is one, otherwise it deletes the requested number
146 /// of characters.
147 ///
148 /// The default bindings for this signal are
149 /// Delete for deleting a character and Ctrl-Delete for
150 /// deleting a word.
151 ///
152 /// Action
153 ///
154 ///
155 /// #### `icon-press`
156 /// The ::icon-press signal is emitted when an activatable icon
157 /// is clicked.
158 ///
159 ///
160 ///
161 ///
162 /// #### `icon-release`
163 /// The ::icon-release signal is emitted on the button release from a
164 /// mouse click over an activatable icon.
165 ///
166 ///
167 ///
168 ///
169 /// #### `insert-at-cursor`
170 /// The ::insert-at-cursor signal is a
171 /// [keybinding signal][GtkBindingSignal]
172 /// which gets emitted when the user initiates the insertion of a
173 /// fixed string at the cursor.
174 ///
175 /// This signal has no default bindings.
176 ///
177 /// Action
178 ///
179 ///
180 /// #### `insert-emoji`
181 /// The ::insert-emoji signal is a
182 /// [keybinding signal][GtkBindingSignal]
183 /// which gets emitted to present the Emoji chooser for the `entry`.
184 ///
185 /// The default bindings for this signal are Ctrl-. and Ctrl-;
186 ///
187 /// Action
188 ///
189 ///
190 /// #### `move-cursor`
191 /// The ::move-cursor signal is a
192 /// [keybinding signal][GtkBindingSignal]
193 /// which gets emitted when the user initiates a cursor movement.
194 /// If the cursor is not visible in `entry`, this signal causes
195 /// the viewport to be moved instead.
196 ///
197 /// Applications should not connect to it, but may emit it with
198 /// `g_signal_emit_by_name()` if they need to control the cursor
199 /// programmatically.
200 ///
201 /// The default bindings for this signal come in two variants,
202 /// the variant with the Shift modifier extends the selection,
203 /// the variant without the Shift modifer does not.
204 /// There are too many key combinations to list them all here.
205 /// - Arrow keys move by individual characters/lines
206 /// - Ctrl-arrow key combinations move by words/paragraphs
207 /// - Home/End keys move to the ends of the buffer
208 ///
209 /// Action
210 ///
211 ///
212 /// #### `paste-clipboard`
213 /// The ::paste-clipboard signal is a
214 /// [keybinding signal][GtkBindingSignal]
215 /// which gets emitted to paste the contents of the clipboard
216 /// into the text view.
217 ///
218 /// The default bindings for this signal are
219 /// Ctrl-v and Shift-Insert.
220 ///
221 /// Action
222 ///
223 ///
224 /// #### `populate-popup`
225 /// The ::populate-popup signal gets emitted before showing the
226 /// context menu of the entry.
227 ///
228 /// If you need to add items to the context menu, connect
229 /// to this signal and append your items to the `widget`, which
230 /// will be a [`Menu`][crate::Menu] in this case.
231 ///
232 /// If [`populate-all`][struct@crate::Entry#populate-all] is [`true`], this signal will
233 /// also be emitted to populate touch popups. In this case,
234 /// `widget` will be a different container, e.g. a [`Toolbar`][crate::Toolbar].
235 /// The signal handler should not make assumptions about the
236 /// type of `widget`.
237 ///
238 ///
239 ///
240 ///
241 /// #### `preedit-changed`
242 /// If an input method is used, the typed text will not immediately
243 /// be committed to the buffer. So if you are interested in the text,
244 /// connect to this signal.
245 ///
246 /// Action
247 ///
248 ///
249 /// #### `toggle-direction`
250 /// Action
251 ///
252 ///
253 /// #### `toggle-overwrite`
254 /// The ::toggle-overwrite signal is a
255 /// [keybinding signal][GtkBindingSignal]
256 /// which gets emitted to toggle the overwrite mode of the entry.
257 ///
258 /// The default bindings for this signal is Insert.
259 ///
260 /// Action
261 /// </details>
262 /// <details><summary><h4>Widget</h4></summary>
263 ///
264 ///
265 /// #### `accel-closures-changed`
266 ///
267 ///
268 ///
269 /// #### `button-press-event`
270 /// The ::button-press-event signal will be emitted when a button
271 /// (typically from a mouse) is pressed.
272 ///
273 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
274 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
275 ///
276 /// This signal will be sent to the grab widget if there is one.
277 ///
278 ///
279 ///
280 ///
281 /// #### `button-release-event`
282 /// The ::button-release-event signal will be emitted when a button
283 /// (typically from a mouse) is released.
284 ///
285 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
286 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
287 ///
288 /// This signal will be sent to the grab widget if there is one.
289 ///
290 ///
291 ///
292 ///
293 /// #### `can-activate-accel`
294 /// Determines whether an accelerator that activates the signal
295 /// identified by `signal_id` can currently be activated.
296 /// This signal is present to allow applications and derived
297 /// widgets to override the default [`Widget`][crate::Widget] handling
298 /// for determining whether an accelerator can be activated.
299 ///
300 ///
301 ///
302 ///
303 /// #### `child-notify`
304 /// The ::child-notify signal is emitted for each
305 /// [child property][child-properties] that has
306 /// changed on an object. The signal's detail holds the property name.
307 ///
308 /// Detailed
309 ///
310 ///
311 /// #### `composited-changed`
312 /// The ::composited-changed signal is emitted when the composited
313 /// status of `widgets` screen changes.
314 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
315 ///
316 /// Action
317 ///
318 ///
319 /// #### `configure-event`
320 /// The ::configure-event signal will be emitted when the size, position or
321 /// stacking of the `widget`'s window has changed.
322 ///
323 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
324 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
325 /// automatically for all new windows.
326 ///
327 ///
328 ///
329 ///
330 /// #### `damage-event`
331 /// Emitted when a redirected window belonging to `widget` gets drawn into.
332 /// The region/area members of the event shows what area of the redirected
333 /// drawable was drawn into.
334 ///
335 ///
336 ///
337 ///
338 /// #### `delete-event`
339 /// The ::delete-event signal is emitted if a user requests that
340 /// a toplevel window is closed. The default handler for this signal
341 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
342 /// this signal will cause the window to be hidden instead, so that
343 /// it can later be shown again without reconstructing it.
344 ///
345 ///
346 ///
347 ///
348 /// #### `destroy`
349 /// Signals that all holders of a reference to the widget should release
350 /// the reference that they hold. May result in finalization of the widget
351 /// if all references are released.
352 ///
353 /// This signal is not suitable for saving widget state.
354 ///
355 ///
356 ///
357 ///
358 /// #### `destroy-event`
359 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
360 /// You rarely get this signal, because most widgets disconnect themselves
361 /// from their window before they destroy it, so no widget owns the
362 /// window at destroy time.
363 ///
364 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
365 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
366 /// automatically for all new windows.
367 ///
368 ///
369 ///
370 ///
371 /// #### `direction-changed`
372 /// The ::direction-changed signal is emitted when the text direction
373 /// of a widget changes.
374 ///
375 ///
376 ///
377 ///
378 /// #### `drag-begin`
379 /// The ::drag-begin signal is emitted on the drag source when a drag is
380 /// started. A typical reason to connect to this signal is to set up a
381 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
382 ///
383 /// Note that some widgets set up a drag icon in the default handler of
384 /// this signal, so you may have to use `g_signal_connect_after()` to
385 /// override what the default handler did.
386 ///
387 ///
388 ///
389 ///
390 /// #### `drag-data-delete`
391 /// The ::drag-data-delete signal is emitted on the drag source when a drag
392 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
393 /// handler is responsible for deleting the data that has been dropped. What
394 /// "delete" means depends on the context of the drag operation.
395 ///
396 ///
397 ///
398 ///
399 /// #### `drag-data-get`
400 /// The ::drag-data-get signal is emitted on the drag source when the drop
401 /// site requests the data which is dragged. It is the responsibility of
402 /// the signal handler to fill `data` with the data in the format which
403 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
404 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
405 ///
406 ///
407 ///
408 ///
409 /// #### `drag-data-received`
410 /// format == 8))
411 /// {
412 /// GdkDragAction action;
413 ///
414 /// // handle data here
415 ///
416 /// action = gdk_drag_context_get_selected_action (context);
417 /// if (action == GDK_ACTION_ASK)
418 /// {
419 /// GtkWidget *dialog;
420 /// gint response;
421 ///
422 /// dialog = gtk_message_dialog_new (NULL,
423 /// GTK_DIALOG_MODAL |
424 /// GTK_DIALOG_DESTROY_WITH_PARENT,
425 /// GTK_MESSAGE_INFO,
426 /// GTK_BUTTONS_YES_NO,
427 /// "Move the data ?\n");
428 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
429 /// gtk_widget_destroy (dialog);
430 ///
431 /// if (response == GTK_RESPONSE_YES)
432 /// action = GDK_ACTION_MOVE;
433 /// else
434 /// action = GDK_ACTION_COPY;
435 /// }
436 ///
437 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
438 /// }
439 /// else
440 /// gtk_drag_finish (context, FALSE, FALSE, time);
441 /// }
442 /// ]|
443 ///
444 ///
445 ///
446 ///
447 /// #### `drag-drop`
448 /// The ::drag-drop signal is emitted on the drop site when the user drops
449 /// the data onto the widget. The signal handler must determine whether
450 /// the cursor position is in a drop zone or not. If it is not in a drop
451 /// zone, it returns [`false`] and no further processing is necessary.
452 /// Otherwise, the handler returns [`true`]. In this case, the handler must
453 /// ensure that `gtk_drag_finish()` is called to let the source know that
454 /// the drop is done. The call to `gtk_drag_finish()` can be done either
455 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
456 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
457 /// or more of the supported targets.
458 ///
459 ///
460 ///
461 ///
462 /// #### `drag-end`
463 /// The ::drag-end signal is emitted on the drag source when a drag is
464 /// finished. A typical reason to connect to this signal is to undo
465 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
466 ///
467 ///
468 ///
469 ///
470 /// #### `drag-failed`
471 /// The ::drag-failed signal is emitted on the drag source when a drag has
472 /// failed. The signal handler may hook custom code to handle a failed DnD
473 /// operation based on the type of error, it returns [`true`] is the failure has
474 /// been already handled (not showing the default "drag operation failed"
475 /// animation), otherwise it returns [`false`].
476 ///
477 ///
478 ///
479 ///
480 /// #### `drag-leave`
481 /// The ::drag-leave signal is emitted on the drop site when the cursor
482 /// leaves the widget. A typical reason to connect to this signal is to
483 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
484 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
485 ///
486 ///
487 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
488 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
489 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
490 ///
491 ///
492 ///
493 ///
494 /// #### `drag-motion`
495 /// suggested_action,
496 /// time);
497 /// }
498 /// else
499 /// {
500 /// // accept the drop
501 /// }
502 /// }
503 /// ]|
504 ///
505 ///
506 ///
507 ///
508 /// #### `draw`
509 /// This signal is emitted when a widget is supposed to render itself.
510 /// The `widget`'s top left corner must be painted at the origin of
511 /// the passed in context and be sized to the values returned by
512 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
513 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
514 ///
515 /// Signal handlers connected to this signal can modify the cairo
516 /// context passed as `cr` in any way they like and don't need to
517 /// restore it. The signal emission takes care of calling `cairo_save()`
518 /// before and `cairo_restore()` after invoking the handler.
519 ///
520 /// The signal handler will get a `cr` with a clip region already set to the
521 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
522 /// widgets that want to avoid redrawing themselves completely can get the full
523 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
524 /// get a finer-grained representation of the dirty region with
525 /// `cairo_copy_clip_rectangle_list()`.
526 ///
527 ///
528 ///
529 ///
530 /// #### `enter-notify-event`
531 /// The ::enter-notify-event will be emitted when the pointer enters
532 /// the `widget`'s window.
533 ///
534 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
535 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
536 ///
537 /// This signal will be sent to the grab widget if there is one.
538 ///
539 ///
540 ///
541 ///
542 /// #### `event`
543 /// The GTK+ main loop will emit three signals for each GDK event delivered
544 /// to a widget: one generic ::event signal, another, more specific,
545 /// signal that matches the type of event delivered (e.g.
546 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
547 /// [`event-after`][struct@crate::Widget#event-after] signal.
548 ///
549 ///
550 ///
551 ///
552 /// #### `event-after`
553 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
554 /// the second more specific signal, ::event-after will be emitted
555 /// regardless of the previous two signals handlers return values.
556 ///
557 ///
558 ///
559 ///
560 /// #### `focus`
561 ///
562 ///
563 ///
564 /// #### `focus-in-event`
565 /// The ::focus-in-event signal will be emitted when the keyboard focus
566 /// enters the `widget`'s window.
567 ///
568 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
569 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
570 ///
571 ///
572 ///
573 ///
574 /// #### `focus-out-event`
575 /// The ::focus-out-event signal will be emitted when the keyboard focus
576 /// leaves the `widget`'s window.
577 ///
578 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
579 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
580 ///
581 ///
582 ///
583 ///
584 /// #### `grab-broken-event`
585 /// Emitted when a pointer or keyboard grab on a window belonging
586 /// to `widget` gets broken.
587 ///
588 /// On X11, this happens when the grab window becomes unviewable
589 /// (i.e. it or one of its ancestors is unmapped), or if the same
590 /// application grabs the pointer or keyboard again.
591 ///
592 ///
593 ///
594 ///
595 /// #### `grab-focus`
596 /// Action
597 ///
598 ///
599 /// #### `grab-notify`
600 /// The ::grab-notify signal is emitted when a widget becomes
601 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
602 /// another widget, or when it becomes unshadowed due to a grab
603 /// being removed.
604 ///
605 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
606 /// grab widget in the grab stack of its window group is not
607 /// its ancestor.
608 ///
609 ///
610 ///
611 ///
612 /// #### `hide`
613 /// The ::hide signal is emitted when `widget` is hidden, for example with
614 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
615 ///
616 ///
617 ///
618 ///
619 /// #### `hierarchy-changed`
620 /// The ::hierarchy-changed signal is emitted when the
621 /// anchored state of a widget changes. A widget is
622 /// “anchored” when its toplevel
623 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
624 /// a widget changes from un-anchored to anchored or vice-versa.
625 ///
626 ///
627 ///
628 ///
629 /// #### `key-press-event`
630 /// The ::key-press-event signal is emitted when a key is pressed. The signal
631 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
632 ///
633 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
634 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
635 ///
636 /// This signal will be sent to the grab widget if there is one.
637 ///
638 ///
639 ///
640 ///
641 /// #### `key-release-event`
642 /// The ::key-release-event signal is emitted when a key is released.
643 ///
644 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
645 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
646 ///
647 /// This signal will be sent to the grab widget if there is one.
648 ///
649 ///
650 ///
651 ///
652 /// #### `keynav-failed`
653 /// Gets emitted if keyboard navigation fails.
654 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
655 ///
656 ///
657 ///
658 ///
659 /// #### `leave-notify-event`
660 /// The ::leave-notify-event will be emitted when the pointer leaves
661 /// the `widget`'s window.
662 ///
663 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
664 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
665 ///
666 /// This signal will be sent to the grab widget if there is one.
667 ///
668 ///
669 ///
670 ///
671 /// #### `map`
672 /// The ::map signal is emitted when `widget` is going to be mapped, that is
673 /// when the widget is visible (which is controlled with
674 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
675 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
676 /// be emitted.
677 ///
678 /// The ::map signal can be used to determine whether a widget will be drawn,
679 /// for instance it can resume an animation that was stopped during the
680 /// emission of [`unmap`][struct@crate::Widget#unmap].
681 ///
682 ///
683 ///
684 ///
685 /// #### `map-event`
686 /// The ::map-event signal will be emitted when the `widget`'s window is
687 /// mapped. A window is mapped when it becomes visible on the screen.
688 ///
689 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
690 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
691 /// automatically for all new windows.
692 ///
693 ///
694 ///
695 ///
696 /// #### `mnemonic-activate`
697 /// The default handler for this signal activates `widget` if `group_cycling`
698 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
699 ///
700 ///
701 ///
702 ///
703 /// #### `motion-notify-event`
704 /// The ::motion-notify-event signal is emitted when the pointer moves
705 /// over the widget's [`gdk::Window`][crate::gdk::Window].
706 ///
707 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
708 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
709 ///
710 /// This signal will be sent to the grab widget if there is one.
711 ///
712 ///
713 ///
714 ///
715 /// #### `move-focus`
716 /// Action
717 ///
718 ///
719 /// #### `parent-set`
720 /// The ::parent-set signal is emitted when a new parent
721 /// has been set on a widget.
722 ///
723 ///
724 ///
725 ///
726 /// #### `popup-menu`
727 /// This signal gets emitted whenever a widget should pop up a context
728 /// menu. This usually happens through the standard key binding mechanism;
729 /// by pressing a certain key while a widget is focused, the user can cause
730 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
731 /// a menu with clipboard commands. See the
732 /// [Popup Menu Migration Checklist][checklist-popup-menu]
733 /// for an example of how to use this signal.
734 ///
735 /// Action
736 ///
737 ///
738 /// #### `property-notify-event`
739 /// The ::property-notify-event signal will be emitted when a property on
740 /// the `widget`'s window has been changed or deleted.
741 ///
742 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
743 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
744 ///
745 ///
746 ///
747 ///
748 /// #### `proximity-in-event`
749 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
750 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
751 ///
752 /// This signal will be sent to the grab widget if there is one.
753 ///
754 ///
755 ///
756 ///
757 /// #### `proximity-out-event`
758 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
759 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
760 ///
761 /// This signal will be sent to the grab widget if there is one.
762 ///
763 ///
764 ///
765 ///
766 /// #### `query-tooltip`
767 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
768 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
769 /// focus in keyboard mode.
770 ///
771 /// Using the given coordinates, the signal handler should determine
772 /// whether a tooltip should be shown for `widget`. If this is the case
773 /// [`true`] should be returned, [`false`] otherwise. Note that if
774 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
775 /// should not be used.
776 ///
777 /// The signal handler is free to manipulate `tooltip` with the therefore
778 /// destined function calls.
779 ///
780 ///
781 ///
782 ///
783 /// #### `realize`
784 /// The ::realize signal is emitted when `widget` is associated with a
785 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
786 /// widget has been mapped (that is, it is going to be drawn).
787 ///
788 ///
789 ///
790 ///
791 /// #### `screen-changed`
792 /// The ::screen-changed signal gets emitted when the
793 /// screen of a widget has changed.
794 ///
795 ///
796 ///
797 ///
798 /// #### `scroll-event`
799 /// The ::scroll-event signal is emitted when a button in the 4 to 7
800 /// range is pressed. Wheel mice are usually configured to generate
801 /// button press events for buttons 4 and 5 when the wheel is turned.
802 ///
803 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
804 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
805 ///
806 /// This signal will be sent to the grab widget if there is one.
807 ///
808 ///
809 ///
810 ///
811 /// #### `selection-clear-event`
812 /// The ::selection-clear-event signal will be emitted when the
813 /// the `widget`'s window has lost ownership of a selection.
814 ///
815 ///
816 ///
817 ///
818 /// #### `selection-get`
819 ///
820 ///
821 ///
822 /// #### `selection-notify-event`
823 ///
824 ///
825 ///
826 /// #### `selection-received`
827 ///
828 ///
829 ///
830 /// #### `selection-request-event`
831 /// The ::selection-request-event signal will be emitted when
832 /// another client requests ownership of the selection owned by
833 /// the `widget`'s window.
834 ///
835 ///
836 ///
837 ///
838 /// #### `show`
839 /// The ::show signal is emitted when `widget` is shown, for example with
840 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
841 ///
842 ///
843 ///
844 ///
845 /// #### `show-help`
846 /// Action
847 ///
848 ///
849 /// #### `size-allocate`
850 ///
851 ///
852 ///
853 /// #### `state-changed`
854 /// The ::state-changed signal is emitted when the widget state changes.
855 /// See `gtk_widget_get_state()`.
856 ///
857 ///
858 ///
859 ///
860 /// #### `state-flags-changed`
861 /// The ::state-flags-changed signal is emitted when the widget state
862 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
863 ///
864 ///
865 ///
866 ///
867 /// #### `style-set`
868 /// The ::style-set signal is emitted when a new style has been set
869 /// on a widget. Note that style-modifying functions like
870 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
871 ///
872 /// Note that this signal is emitted for changes to the deprecated
873 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
874 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
875 ///
876 ///
877 ///
878 ///
879 /// #### `style-updated`
880 /// The ::style-updated signal is a convenience signal that is emitted when the
881 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
882 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
883 ///
884 /// Note that style-modifying functions like `gtk_widget_override_color()` also
885 /// cause this signal to be emitted.
886 ///
887 ///
888 ///
889 ///
890 /// #### `touch-event`
891 ///
892 ///
893 ///
894 /// #### `unmap`
895 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
896 /// means that either it or any of its parents up to the toplevel widget have
897 /// been set as hidden.
898 ///
899 /// As ::unmap indicates that a widget will not be shown any longer, it can be
900 /// used to, for example, stop an animation on the widget.
901 ///
902 ///
903 ///
904 ///
905 /// #### `unmap-event`
906 /// The ::unmap-event signal will be emitted when the `widget`'s window is
907 /// unmapped. A window is unmapped when it becomes invisible on the screen.
908 ///
909 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
910 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
911 /// automatically for all new windows.
912 ///
913 ///
914 ///
915 ///
916 /// #### `unrealize`
917 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
918 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
919 /// called or the widget has been unmapped (that is, it is going to be
920 /// hidden).
921 ///
922 ///
923 ///
924 ///
925 /// #### `visibility-notify-event`
926 /// The ::visibility-notify-event will be emitted when the `widget`'s
927 /// window is obscured or unobscured.
928 ///
929 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
930 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
931 ///
932 ///
933 ///
934 ///
935 /// #### `window-state-event`
936 /// The ::window-state-event will be emitted when the state of the
937 /// toplevel window associated to the `widget` changes.
938 ///
939 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
940 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
941 /// this mask automatically for all new windows.
942 ///
943 ///
944 /// </details>
945 /// <details><summary><h4>CellEditable</h4></summary>
946 ///
947 ///
948 /// #### `editing-done`
949 /// This signal is a sign for the cell renderer to update its
950 /// value from the `cell_editable`.
951 ///
952 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
953 /// emitting this signal when they are done editing, e.g.
954 /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
955 /// do in a handler for ::editing-done are to capture the edited value,
956 /// disconnect the `cell_editable` from signals on the [`CellRenderer`][crate::CellRenderer], etc.
957 ///
958 /// [`CellEditableExt::editing_done()`][crate::prelude::CellEditableExt::editing_done()] is a convenience method
959 /// for emitting [`editing-done`][struct@crate::CellEditable#editing-done].
960 ///
961 ///
962 ///
963 ///
964 /// #### `remove-widget`
965 /// This signal is meant to indicate that the cell is finished
966 /// editing, and the `cell_editable` widget is being removed and may
967 /// subsequently be destroyed.
968 ///
969 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
970 /// emitting this signal when they are done editing. It must
971 /// be emitted after the [`editing-done`][struct@crate::CellEditable#editing-done] signal,
972 /// to give the cell renderer a chance to update the cell's value
973 /// before the widget is removed.
974 ///
975 /// [`CellEditableExt::remove_widget()`][crate::prelude::CellEditableExt::remove_widget()] is a convenience method
976 /// for emitting [`remove-widget`][struct@crate::CellEditable#remove-widget].
977 ///
978 ///
979 /// </details>
980 /// <details><summary><h4>Editable</h4></summary>
981 ///
982 ///
983 /// #### `changed`
984 /// The ::changed signal is emitted at the end of a single
985 /// user-visible operation on the contents of the [`Editable`][crate::Editable].
986 ///
987 /// E.g., a paste operation that replaces the contents of the
988 /// selection will cause only one signal emission (even though it
989 /// is implemented by first deleting the selection, then inserting
990 /// the new content, and may cause multiple ::notify::text signals
991 /// to be emitted).
992 ///
993 ///
994 ///
995 ///
996 /// #### `delete-text`
997 /// This signal is emitted when text is deleted from
998 /// the widget by the user. The default handler for
999 /// this signal will normally be responsible for deleting
1000 /// the text, so by connecting to this signal and then
1001 /// stopping the signal with `g_signal_stop_emission()`, it
1002 /// is possible to modify the range of deleted text, or
1003 /// prevent it from being deleted entirely. The `start_pos`
1004 /// and `end_pos` parameters are interpreted as for
1005 /// [`EditableExt::delete_text()`][crate::prelude::EditableExt::delete_text()].
1006 ///
1007 ///
1008 ///
1009 ///
1010 /// #### `insert-text`
1011 /// This signal is emitted when text is inserted into
1012 /// the widget by the user. The default handler for
1013 /// this signal will normally be responsible for inserting
1014 /// the text, so by connecting to this signal and then
1015 /// stopping the signal with `g_signal_stop_emission()`, it
1016 /// is possible to modify the inserted text, or prevent
1017 /// it from being inserted entirely.
1018 ///
1019 ///
1020 /// </details>
1021 ///
1022 /// # Implements
1023 ///
1024 /// [`SearchEntryExt`][trait@crate::prelude::SearchEntryExt], [`EntryExt`][trait@crate::prelude::EntryExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`CellEditableExt`][trait@crate::prelude::CellEditableExt], [`EditableExt`][trait@crate::prelude::EditableExt], [`EntryExtManual`][trait@crate::prelude::EntryExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual], [`EditableSignals`][trait@crate::prelude::EditableSignals]
1025 #[doc(alias = "GtkSearchEntry")]
1026 pub struct SearchEntry(Object<ffi::GtkSearchEntry, ffi::GtkSearchEntryClass>) @extends Entry, Widget, @implements Buildable, CellEditable, Editable;
1027
1028 match fn {
1029 type_ => || ffi::gtk_search_entry_get_type(),
1030 }
1031}
1032
1033impl SearchEntry {
1034 pub const NONE: Option<&'static SearchEntry> = None;
1035
1036 /// Creates a [`SearchEntry`][crate::SearchEntry], with a find icon when the search field is
1037 /// empty, and a clear icon when it isn't.
1038 ///
1039 /// # Returns
1040 ///
1041 /// a new [`SearchEntry`][crate::SearchEntry]
1042 #[doc(alias = "gtk_search_entry_new")]
1043 pub fn new() -> SearchEntry {
1044 assert_initialized_main_thread!();
1045 unsafe { Widget::from_glib_none(ffi::gtk_search_entry_new()).unsafe_cast() }
1046 }
1047
1048 // rustdoc-stripper-ignore-next
1049 /// Creates a new builder-pattern struct instance to construct [`SearchEntry`] objects.
1050 ///
1051 /// This method returns an instance of [`SearchEntryBuilder`](crate::builders::SearchEntryBuilder) which can be used to create [`SearchEntry`] objects.
1052 pub fn builder() -> SearchEntryBuilder {
1053 SearchEntryBuilder::new()
1054 }
1055}
1056
1057impl Default for SearchEntry {
1058 fn default() -> Self {
1059 Self::new()
1060 }
1061}
1062
1063// rustdoc-stripper-ignore-next
1064/// A [builder-pattern] type to construct [`SearchEntry`] objects.
1065///
1066/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1067#[must_use = "The builder must be built to be used"]
1068pub struct SearchEntryBuilder {
1069 builder: glib::object::ObjectBuilder<'static, SearchEntry>,
1070}
1071
1072impl SearchEntryBuilder {
1073 fn new() -> Self {
1074 Self {
1075 builder: glib::object::Object::builder(),
1076 }
1077 }
1078
1079 pub fn activates_default(self, activates_default: bool) -> Self {
1080 Self {
1081 builder: self
1082 .builder
1083 .property("activates-default", activates_default),
1084 }
1085 }
1086
1087 /// A list of Pango attributes to apply to the text of the entry.
1088 ///
1089 /// This is mainly useful to change the size or weight of the text.
1090 ///
1091 /// The `PangoAttribute`'s `start_index` and `end_index` must refer to the
1092 /// [`EntryBuffer`][crate::EntryBuffer] text, i.e. without the preedit string.
1093 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
1094 Self {
1095 builder: self.builder.property("attributes", attributes.clone()),
1096 }
1097 }
1098
1099 pub fn buffer(self, buffer: &impl IsA<EntryBuffer>) -> Self {
1100 Self {
1101 builder: self.builder.property("buffer", buffer.clone().upcast()),
1102 }
1103 }
1104
1105 /// Whether password entries will show a warning when Caps Lock is on.
1106 ///
1107 /// Note that the warning is shown using a secondary icon, and thus
1108 /// does not work if you are using the secondary icon position for some
1109 /// other purpose.
1110 pub fn caps_lock_warning(self, caps_lock_warning: bool) -> Self {
1111 Self {
1112 builder: self
1113 .builder
1114 .property("caps-lock-warning", caps_lock_warning),
1115 }
1116 }
1117
1118 /// The auxiliary completion object to use with the entry.
1119 pub fn completion(self, completion: &impl IsA<EntryCompletion>) -> Self {
1120 Self {
1121 builder: self
1122 .builder
1123 .property("completion", completion.clone().upcast()),
1124 }
1125 }
1126
1127 pub fn editable(self, editable: bool) -> Self {
1128 Self {
1129 builder: self.builder.property("editable", editable),
1130 }
1131 }
1132
1133 pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
1134 Self {
1135 builder: self
1136 .builder
1137 .property("enable-emoji-completion", enable_emoji_completion),
1138 }
1139 }
1140
1141 pub fn has_frame(self, has_frame: bool) -> Self {
1142 Self {
1143 builder: self.builder.property("has-frame", has_frame),
1144 }
1145 }
1146
1147 /// Which IM (input method) module should be used for this entry.
1148 /// See [`IMContext`][crate::IMContext].
1149 ///
1150 /// Setting this to a non-[`None`] value overrides the
1151 /// system-wide IM module setting. See the GtkSettings
1152 /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
1153 pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
1154 Self {
1155 builder: self.builder.property("im-module", im_module.into()),
1156 }
1157 }
1158
1159 /// Additional hints (beyond [`input-purpose`][struct@crate::Entry#input-purpose]) that
1160 /// allow input methods to fine-tune their behaviour.
1161 pub fn input_hints(self, input_hints: InputHints) -> Self {
1162 Self {
1163 builder: self.builder.property("input-hints", input_hints),
1164 }
1165 }
1166
1167 /// The purpose of this text field.
1168 ///
1169 /// This property can be used by on-screen keyboards and other input
1170 /// methods to adjust their behaviour.
1171 ///
1172 /// Note that setting the purpose to [`InputPurpose::Password`][crate::InputPurpose::Password] or
1173 /// [`InputPurpose::Pin`][crate::InputPurpose::Pin] is independent from setting
1174 /// [`visibility`][struct@crate::Entry#visibility].
1175 pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
1176 Self {
1177 builder: self.builder.property("input-purpose", input_purpose),
1178 }
1179 }
1180
1181 /// The invisible character is used when masking entry contents (in
1182 /// \"password mode\")"). When it is not explicitly set with the
1183 /// [`invisible-char`][struct@crate::Entry#invisible-char] property, GTK+ determines the character
1184 /// to use from a list of possible candidates, depending on availability
1185 /// in the current font.
1186 ///
1187 /// This style property allows the theme to prepend a character
1188 /// to the list of candidates.
1189 pub fn invisible_char(self, invisible_char: u32) -> Self {
1190 Self {
1191 builder: self.builder.property("invisible-char", invisible_char),
1192 }
1193 }
1194
1195 /// Whether the invisible char has been set for the [`Entry`][crate::Entry].
1196 pub fn invisible_char_set(self, invisible_char_set: bool) -> Self {
1197 Self {
1198 builder: self
1199 .builder
1200 .property("invisible-char-set", invisible_char_set),
1201 }
1202 }
1203
1204 pub fn max_length(self, max_length: i32) -> Self {
1205 Self {
1206 builder: self.builder.property("max-length", max_length),
1207 }
1208 }
1209
1210 /// The desired maximum width of the entry, in characters.
1211 /// If this property is set to -1, the width will be calculated
1212 /// automatically.
1213 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1214 Self {
1215 builder: self.builder.property("max-width-chars", max_width_chars),
1216 }
1217 }
1218
1219 /// If text is overwritten when typing in the [`Entry`][crate::Entry].
1220 pub fn overwrite_mode(self, overwrite_mode: bool) -> Self {
1221 Self {
1222 builder: self.builder.property("overwrite-mode", overwrite_mode),
1223 }
1224 }
1225
1226 /// The text that will be displayed in the [`Entry`][crate::Entry] when it is empty
1227 /// and unfocused.
1228 pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
1229 Self {
1230 builder: self
1231 .builder
1232 .property("placeholder-text", placeholder_text.into()),
1233 }
1234 }
1235
1236 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::Entry#populate-popup]
1237 /// signal is also emitted for touch popups.
1238 pub fn populate_all(self, populate_all: bool) -> Self {
1239 Self {
1240 builder: self.builder.property("populate-all", populate_all),
1241 }
1242 }
1243
1244 /// Whether the primary icon is activatable.
1245 ///
1246 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
1247 /// signals only on sensitive, activatable icons.
1248 ///
1249 /// Sensitive, but non-activatable icons can be used for purely
1250 /// informational purposes.
1251 pub fn primary_icon_activatable(self, primary_icon_activatable: bool) -> Self {
1252 Self {
1253 builder: self
1254 .builder
1255 .property("primary-icon-activatable", primary_icon_activatable),
1256 }
1257 }
1258
1259 /// The [`gio::Icon`][crate::gio::Icon] to use for the primary icon for the entry.
1260 pub fn primary_icon_gicon(self, primary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
1261 Self {
1262 builder: self
1263 .builder
1264 .property("primary-icon-gicon", primary_icon_gicon.clone().upcast()),
1265 }
1266 }
1267
1268 /// The icon name to use for the primary icon for the entry.
1269 pub fn primary_icon_name(self, primary_icon_name: impl Into<glib::GString>) -> Self {
1270 Self {
1271 builder: self
1272 .builder
1273 .property("primary-icon-name", primary_icon_name.into()),
1274 }
1275 }
1276
1277 /// A pixbuf to use as the primary icon for the entry.
1278 pub fn primary_icon_pixbuf(self, primary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
1279 Self {
1280 builder: self
1281 .builder
1282 .property("primary-icon-pixbuf", primary_icon_pixbuf.clone()),
1283 }
1284 }
1285
1286 /// Whether the primary icon is sensitive.
1287 ///
1288 /// An insensitive icon appears grayed out. GTK+ does not emit the
1289 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
1290 /// does not allow DND from insensitive icons.
1291 ///
1292 /// An icon should be set insensitive if the action that would trigger
1293 /// when clicked is currently not available.
1294 pub fn primary_icon_sensitive(self, primary_icon_sensitive: bool) -> Self {
1295 Self {
1296 builder: self
1297 .builder
1298 .property("primary-icon-sensitive", primary_icon_sensitive),
1299 }
1300 }
1301
1302 /// The contents of the tooltip on the primary icon, which is marked up
1303 /// with the [Pango text markup language][PangoMarkupFormat].
1304 ///
1305 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
1306 pub fn primary_icon_tooltip_markup(
1307 self,
1308 primary_icon_tooltip_markup: impl Into<glib::GString>,
1309 ) -> Self {
1310 Self {
1311 builder: self.builder.property(
1312 "primary-icon-tooltip-markup",
1313 primary_icon_tooltip_markup.into(),
1314 ),
1315 }
1316 }
1317
1318 /// The contents of the tooltip on the primary icon.
1319 ///
1320 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
1321 pub fn primary_icon_tooltip_text(
1322 self,
1323 primary_icon_tooltip_text: impl Into<glib::GString>,
1324 ) -> Self {
1325 Self {
1326 builder: self.builder.property(
1327 "primary-icon-tooltip-text",
1328 primary_icon_tooltip_text.into(),
1329 ),
1330 }
1331 }
1332
1333 /// The current fraction of the task that's been completed.
1334 pub fn progress_fraction(self, progress_fraction: f64) -> Self {
1335 Self {
1336 builder: self
1337 .builder
1338 .property("progress-fraction", progress_fraction),
1339 }
1340 }
1341
1342 /// The fraction of total entry width to move the progress
1343 /// bouncing block for each call to [`EntryExt::progress_pulse()`][crate::prelude::EntryExt::progress_pulse()].
1344 pub fn progress_pulse_step(self, progress_pulse_step: f64) -> Self {
1345 Self {
1346 builder: self
1347 .builder
1348 .property("progress-pulse-step", progress_pulse_step),
1349 }
1350 }
1351
1352 /// Whether the secondary icon is activatable.
1353 ///
1354 /// GTK+ emits the [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release]
1355 /// signals only on sensitive, activatable icons.
1356 ///
1357 /// Sensitive, but non-activatable icons can be used for purely
1358 /// informational purposes.
1359 pub fn secondary_icon_activatable(self, secondary_icon_activatable: bool) -> Self {
1360 Self {
1361 builder: self
1362 .builder
1363 .property("secondary-icon-activatable", secondary_icon_activatable),
1364 }
1365 }
1366
1367 /// The [`gio::Icon`][crate::gio::Icon] to use for the secondary icon for the entry.
1368 pub fn secondary_icon_gicon(self, secondary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
1369 Self {
1370 builder: self.builder.property(
1371 "secondary-icon-gicon",
1372 secondary_icon_gicon.clone().upcast(),
1373 ),
1374 }
1375 }
1376
1377 /// The icon name to use for the secondary icon for the entry.
1378 pub fn secondary_icon_name(self, secondary_icon_name: impl Into<glib::GString>) -> Self {
1379 Self {
1380 builder: self
1381 .builder
1382 .property("secondary-icon-name", secondary_icon_name.into()),
1383 }
1384 }
1385
1386 /// An pixbuf to use as the secondary icon for the entry.
1387 pub fn secondary_icon_pixbuf(self, secondary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
1388 Self {
1389 builder: self
1390 .builder
1391 .property("secondary-icon-pixbuf", secondary_icon_pixbuf.clone()),
1392 }
1393 }
1394
1395 /// Whether the secondary icon is sensitive.
1396 ///
1397 /// An insensitive icon appears grayed out. GTK+ does not emit the
1398 /// [`icon-press`][struct@crate::Entry#icon-press] and [`icon-release`][struct@crate::Entry#icon-release] signals and
1399 /// does not allow DND from insensitive icons.
1400 ///
1401 /// An icon should be set insensitive if the action that would trigger
1402 /// when clicked is currently not available.
1403 pub fn secondary_icon_sensitive(self, secondary_icon_sensitive: bool) -> Self {
1404 Self {
1405 builder: self
1406 .builder
1407 .property("secondary-icon-sensitive", secondary_icon_sensitive),
1408 }
1409 }
1410
1411 /// The contents of the tooltip on the secondary icon, which is marked up
1412 /// with the [Pango text markup language][PangoMarkupFormat].
1413 ///
1414 /// Also see [`EntryExt::set_icon_tooltip_markup()`][crate::prelude::EntryExt::set_icon_tooltip_markup()].
1415 pub fn secondary_icon_tooltip_markup(
1416 self,
1417 secondary_icon_tooltip_markup: impl Into<glib::GString>,
1418 ) -> Self {
1419 Self {
1420 builder: self.builder.property(
1421 "secondary-icon-tooltip-markup",
1422 secondary_icon_tooltip_markup.into(),
1423 ),
1424 }
1425 }
1426
1427 /// The contents of the tooltip on the secondary icon.
1428 ///
1429 /// Also see [`EntryExt::set_icon_tooltip_text()`][crate::prelude::EntryExt::set_icon_tooltip_text()].
1430 pub fn secondary_icon_tooltip_text(
1431 self,
1432 secondary_icon_tooltip_text: impl Into<glib::GString>,
1433 ) -> Self {
1434 Self {
1435 builder: self.builder.property(
1436 "secondary-icon-tooltip-text",
1437 secondary_icon_tooltip_text.into(),
1438 ),
1439 }
1440 }
1441
1442 pub fn show_emoji_icon(self, show_emoji_icon: bool) -> Self {
1443 Self {
1444 builder: self.builder.property("show-emoji-icon", show_emoji_icon),
1445 }
1446 }
1447
1448 pub fn tabs(self, tabs: &pango::TabArray) -> Self {
1449 Self {
1450 builder: self.builder.property("tabs", tabs),
1451 }
1452 }
1453
1454 pub fn text(self, text: impl Into<glib::GString>) -> Self {
1455 Self {
1456 builder: self.builder.property("text", text.into()),
1457 }
1458 }
1459
1460 /// When [`true`], pasted multi-line text is truncated to the first line.
1461 pub fn truncate_multiline(self, truncate_multiline: bool) -> Self {
1462 Self {
1463 builder: self
1464 .builder
1465 .property("truncate-multiline", truncate_multiline),
1466 }
1467 }
1468
1469 pub fn visibility(self, visibility: bool) -> Self {
1470 Self {
1471 builder: self.builder.property("visibility", visibility),
1472 }
1473 }
1474
1475 pub fn width_chars(self, width_chars: i32) -> Self {
1476 Self {
1477 builder: self.builder.property("width-chars", width_chars),
1478 }
1479 }
1480
1481 /// The horizontal alignment, from 0 (left) to 1 (right).
1482 /// Reversed for RTL layouts.
1483 pub fn xalign(self, xalign: f32) -> Self {
1484 Self {
1485 builder: self.builder.property("xalign", xalign),
1486 }
1487 }
1488
1489 pub fn app_paintable(self, app_paintable: bool) -> Self {
1490 Self {
1491 builder: self.builder.property("app-paintable", app_paintable),
1492 }
1493 }
1494
1495 pub fn can_default(self, can_default: bool) -> Self {
1496 Self {
1497 builder: self.builder.property("can-default", can_default),
1498 }
1499 }
1500
1501 pub fn can_focus(self, can_focus: bool) -> Self {
1502 Self {
1503 builder: self.builder.property("can-focus", can_focus),
1504 }
1505 }
1506
1507 pub fn events(self, events: gdk::EventMask) -> Self {
1508 Self {
1509 builder: self.builder.property("events", events),
1510 }
1511 }
1512
1513 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1514 pub fn expand(self, expand: bool) -> Self {
1515 Self {
1516 builder: self.builder.property("expand", expand),
1517 }
1518 }
1519
1520 /// Whether the widget should grab focus when it is clicked with the mouse.
1521 ///
1522 /// This property is only relevant for widgets that can take focus.
1523 ///
1524 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1525 /// GtkComboBox) implemented this property individually.
1526 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1527 Self {
1528 builder: self.builder.property("focus-on-click", focus_on_click),
1529 }
1530 }
1531
1532 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1533 pub fn halign(self, halign: Align) -> Self {
1534 Self {
1535 builder: self.builder.property("halign", halign),
1536 }
1537 }
1538
1539 pub fn has_default(self, has_default: bool) -> Self {
1540 Self {
1541 builder: self.builder.property("has-default", has_default),
1542 }
1543 }
1544
1545 pub fn has_focus(self, has_focus: bool) -> Self {
1546 Self {
1547 builder: self.builder.property("has-focus", has_focus),
1548 }
1549 }
1550
1551 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1552 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1553 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1554 /// whether it will provide a tooltip or not.
1555 ///
1556 /// Note that setting this property to [`true`] for the first time will change
1557 /// the event masks of the GdkWindows of this widget to include leave-notify
1558 /// and motion-notify events. This cannot and will not be undone when the
1559 /// property is set to [`false`] again.
1560 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1561 Self {
1562 builder: self.builder.property("has-tooltip", has_tooltip),
1563 }
1564 }
1565
1566 pub fn height_request(self, height_request: i32) -> Self {
1567 Self {
1568 builder: self.builder.property("height-request", height_request),
1569 }
1570 }
1571
1572 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1573 pub fn hexpand(self, hexpand: bool) -> Self {
1574 Self {
1575 builder: self.builder.property("hexpand", hexpand),
1576 }
1577 }
1578
1579 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1580 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1581 Self {
1582 builder: self.builder.property("hexpand-set", hexpand_set),
1583 }
1584 }
1585
1586 pub fn is_focus(self, is_focus: bool) -> Self {
1587 Self {
1588 builder: self.builder.property("is-focus", is_focus),
1589 }
1590 }
1591
1592 /// Sets all four sides' margin at once. If read, returns max
1593 /// margin on any side.
1594 pub fn margin(self, margin: i32) -> Self {
1595 Self {
1596 builder: self.builder.property("margin", margin),
1597 }
1598 }
1599
1600 /// Margin on bottom side of widget.
1601 ///
1602 /// This property adds margin outside of the widget's normal size
1603 /// request, the margin will be added in addition to the size from
1604 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1605 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1606 Self {
1607 builder: self.builder.property("margin-bottom", margin_bottom),
1608 }
1609 }
1610
1611 /// Margin on end of widget, horizontally. This property supports
1612 /// left-to-right and right-to-left text directions.
1613 ///
1614 /// This property adds margin outside of the widget's normal size
1615 /// request, the margin will be added in addition to the size from
1616 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1617 pub fn margin_end(self, margin_end: i32) -> Self {
1618 Self {
1619 builder: self.builder.property("margin-end", margin_end),
1620 }
1621 }
1622
1623 /// Margin on start of widget, horizontally. This property supports
1624 /// left-to-right and right-to-left text directions.
1625 ///
1626 /// This property adds margin outside of the widget's normal size
1627 /// request, the margin will be added in addition to the size from
1628 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1629 pub fn margin_start(self, margin_start: i32) -> Self {
1630 Self {
1631 builder: self.builder.property("margin-start", margin_start),
1632 }
1633 }
1634
1635 /// Margin on top side of widget.
1636 ///
1637 /// This property adds margin outside of the widget's normal size
1638 /// request, the margin will be added in addition to the size from
1639 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1640 pub fn margin_top(self, margin_top: i32) -> Self {
1641 Self {
1642 builder: self.builder.property("margin-top", margin_top),
1643 }
1644 }
1645
1646 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1647 Self {
1648 builder: self.builder.property("name", name.into()),
1649 }
1650 }
1651
1652 pub fn no_show_all(self, no_show_all: bool) -> Self {
1653 Self {
1654 builder: self.builder.property("no-show-all", no_show_all),
1655 }
1656 }
1657
1658 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1659 /// more details about window opacity.
1660 ///
1661 /// Before 3.8 this was only available in GtkWindow
1662 pub fn opacity(self, opacity: f64) -> Self {
1663 Self {
1664 builder: self.builder.property("opacity", opacity),
1665 }
1666 }
1667
1668 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1669 Self {
1670 builder: self.builder.property("parent", parent.clone().upcast()),
1671 }
1672 }
1673
1674 pub fn receives_default(self, receives_default: bool) -> Self {
1675 Self {
1676 builder: self.builder.property("receives-default", receives_default),
1677 }
1678 }
1679
1680 pub fn sensitive(self, sensitive: bool) -> Self {
1681 Self {
1682 builder: self.builder.property("sensitive", sensitive),
1683 }
1684 }
1685
1686 /// Sets the text of tooltip to be the given string, which is marked up
1687 /// with the [Pango text markup language][PangoMarkupFormat].
1688 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1689 ///
1690 /// This is a convenience property which will take care of getting the
1691 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1692 /// will automatically be set to [`true`] and there will be taken care of
1693 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1694 ///
1695 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1696 /// are set, the last one wins.
1697 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1698 Self {
1699 builder: self
1700 .builder
1701 .property("tooltip-markup", tooltip_markup.into()),
1702 }
1703 }
1704
1705 /// Sets the text of tooltip to be the given string.
1706 ///
1707 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1708 ///
1709 /// This is a convenience property which will take care of getting the
1710 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1711 /// will automatically be set to [`true`] and there will be taken care of
1712 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1713 ///
1714 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1715 /// are set, the last one wins.
1716 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1717 Self {
1718 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1719 }
1720 }
1721
1722 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1723 pub fn valign(self, valign: Align) -> Self {
1724 Self {
1725 builder: self.builder.property("valign", valign),
1726 }
1727 }
1728
1729 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1730 pub fn vexpand(self, vexpand: bool) -> Self {
1731 Self {
1732 builder: self.builder.property("vexpand", vexpand),
1733 }
1734 }
1735
1736 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1737 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1738 Self {
1739 builder: self.builder.property("vexpand-set", vexpand_set),
1740 }
1741 }
1742
1743 pub fn visible(self, visible: bool) -> Self {
1744 Self {
1745 builder: self.builder.property("visible", visible),
1746 }
1747 }
1748
1749 pub fn width_request(self, width_request: i32) -> Self {
1750 Self {
1751 builder: self.builder.property("width-request", width_request),
1752 }
1753 }
1754
1755 /// Indicates whether editing on the cell has been canceled.
1756 pub fn editing_canceled(self, editing_canceled: bool) -> Self {
1757 Self {
1758 builder: self.builder.property("editing-canceled", editing_canceled),
1759 }
1760 }
1761
1762 // rustdoc-stripper-ignore-next
1763 /// Build the [`SearchEntry`].
1764 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1765 pub fn build(self) -> SearchEntry {
1766 assert_initialized_main_thread!();
1767 self.builder.build()
1768 }
1769}
1770
1771/// Trait containing all [`struct@SearchEntry`] methods.
1772///
1773/// # Implementors
1774///
1775/// [`SearchEntry`][struct@crate::SearchEntry]
1776pub trait SearchEntryExt: IsA<SearchEntry> + 'static {
1777 /// This function should be called when the top-level window
1778 /// which contains the search entry received a key event. If
1779 /// the entry is part of a [`SearchBar`][crate::SearchBar], it is preferable
1780 /// to call [`SearchBarExt::handle_event()`][crate::prelude::SearchBarExt::handle_event()] instead, which will
1781 /// reveal the entry in addition to passing the event to this
1782 /// function.
1783 ///
1784 /// If the key event is handled by the search entry and starts
1785 /// or continues a search, `GDK_EVENT_STOP` will be returned.
1786 /// The caller should ensure that the entry is shown in this
1787 /// case, and not propagate the event further.
1788 /// ## `event`
1789 /// a key event
1790 ///
1791 /// # Returns
1792 ///
1793 /// `GDK_EVENT_STOP` if the key press event resulted
1794 /// in a search beginning or continuing, `GDK_EVENT_PROPAGATE`
1795 /// otherwise.
1796 #[doc(alias = "gtk_search_entry_handle_event")]
1797 fn handle_event(&self, event: &gdk::Event) -> bool {
1798 unsafe {
1799 from_glib(ffi::gtk_search_entry_handle_event(
1800 self.as_ref().to_glib_none().0,
1801 mut_override(event.to_glib_none().0),
1802 ))
1803 }
1804 }
1805
1806 /// The ::next-match signal is a [keybinding signal][GtkBindingSignal]
1807 /// which gets emitted when the user initiates a move to the next match
1808 /// for the current search string.
1809 ///
1810 /// Applications should connect to it, to implement moving between
1811 /// matches.
1812 ///
1813 /// The default bindings for this signal is Ctrl-g.
1814 #[doc(alias = "next-match")]
1815 fn connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1816 unsafe extern "C" fn next_match_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>(
1817 this: *mut ffi::GtkSearchEntry,
1818 f: glib::ffi::gpointer,
1819 ) {
1820 unsafe {
1821 let f: &F = &*(f as *const F);
1822 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref())
1823 }
1824 }
1825 unsafe {
1826 let f: Box_<F> = Box_::new(f);
1827 connect_raw(
1828 self.as_ptr() as *mut _,
1829 c"next-match".as_ptr(),
1830 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1831 next_match_trampoline::<Self, F> as *const (),
1832 )),
1833 Box_::into_raw(f),
1834 )
1835 }
1836 }
1837
1838 fn emit_next_match(&self) {
1839 self.emit_by_name::<()>("next-match", &[]);
1840 }
1841
1842 /// The ::previous-match signal is a [keybinding signal][GtkBindingSignal]
1843 /// which gets emitted when the user initiates a move to the previous match
1844 /// for the current search string.
1845 ///
1846 /// Applications should connect to it, to implement moving between
1847 /// matches.
1848 ///
1849 /// The default bindings for this signal is Ctrl-Shift-g.
1850 #[doc(alias = "previous-match")]
1851 fn connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1852 unsafe extern "C" fn previous_match_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>(
1853 this: *mut ffi::GtkSearchEntry,
1854 f: glib::ffi::gpointer,
1855 ) {
1856 unsafe {
1857 let f: &F = &*(f as *const F);
1858 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref())
1859 }
1860 }
1861 unsafe {
1862 let f: Box_<F> = Box_::new(f);
1863 connect_raw(
1864 self.as_ptr() as *mut _,
1865 c"previous-match".as_ptr(),
1866 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1867 previous_match_trampoline::<Self, F> as *const (),
1868 )),
1869 Box_::into_raw(f),
1870 )
1871 }
1872 }
1873
1874 fn emit_previous_match(&self) {
1875 self.emit_by_name::<()>("previous-match", &[]);
1876 }
1877
1878 /// The [`search-changed`][struct@crate::SearchEntry#search-changed] signal is emitted with a short
1879 /// delay of 150 milliseconds after the last change to the entry text.
1880 #[doc(alias = "search-changed")]
1881 fn connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1882 unsafe extern "C" fn search_changed_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>(
1883 this: *mut ffi::GtkSearchEntry,
1884 f: glib::ffi::gpointer,
1885 ) {
1886 unsafe {
1887 let f: &F = &*(f as *const F);
1888 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref())
1889 }
1890 }
1891 unsafe {
1892 let f: Box_<F> = Box_::new(f);
1893 connect_raw(
1894 self.as_ptr() as *mut _,
1895 c"search-changed".as_ptr(),
1896 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1897 search_changed_trampoline::<Self, F> as *const (),
1898 )),
1899 Box_::into_raw(f),
1900 )
1901 }
1902 }
1903
1904 /// The ::stop-search signal is a [keybinding signal][GtkBindingSignal]
1905 /// which gets emitted when the user stops a search via keyboard input.
1906 ///
1907 /// Applications should connect to it, to implement hiding the search
1908 /// entry in this case.
1909 ///
1910 /// The default bindings for this signal is Escape.
1911 #[doc(alias = "stop-search")]
1912 fn connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1913 unsafe extern "C" fn stop_search_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>(
1914 this: *mut ffi::GtkSearchEntry,
1915 f: glib::ffi::gpointer,
1916 ) {
1917 unsafe {
1918 let f: &F = &*(f as *const F);
1919 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref())
1920 }
1921 }
1922 unsafe {
1923 let f: Box_<F> = Box_::new(f);
1924 connect_raw(
1925 self.as_ptr() as *mut _,
1926 c"stop-search".as_ptr(),
1927 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1928 stop_search_trampoline::<Self, F> as *const (),
1929 )),
1930 Box_::into_raw(f),
1931 )
1932 }
1933 }
1934
1935 fn emit_stop_search(&self) {
1936 self.emit_by_name::<()>("stop-search", &[]);
1937 }
1938}
1939
1940impl<O: IsA<SearchEntry>> SearchEntryExt for O {}