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 gdk;
6use gdk_pixbuf;
7use gio;
8#[cfg(any(feature = "v3_16", feature = "dox"))]
9use glib;
10use glib::object::Cast;
11use glib::object::IsA;
12#[cfg(any(feature = "v3_16", feature = "dox"))]
13use glib::object::ObjectExt;
14use glib::signal::connect_raw;
15use glib::signal::SignalHandlerId;
16use glib::translate::*;
17use glib::StaticType;
18use glib::ToValue;
19use glib_sys;
20#[cfg(any(feature = "v3_16", feature = "dox"))]
21use gobject_sys;
22use gtk_sys;
23use pango;
24use std::boxed::Box as Box_;
25use std::fmt;
26use std::mem::transmute;
27use Align;
28use Buildable;
29use CellEditable;
30use Container;
31use Editable;
32use Entry;
33use EntryBuffer;
34use EntryCompletion;
35use InputHints;
36use InputPurpose;
37use ShadowType;
38use Widget;
39
40glib_wrapper! {
41    pub struct SearchEntry(Object<gtk_sys::GtkSearchEntry, gtk_sys::GtkSearchEntryClass, SearchEntryClass>) @extends Entry, Widget, @implements Buildable, CellEditable, Editable;
42
43    match fn {
44        get_type => || gtk_sys::gtk_search_entry_get_type(),
45    }
46}
47
48impl SearchEntry {
49    pub fn new() -> SearchEntry {
50        assert_initialized_main_thread!();
51        unsafe { Widget::from_glib_none(gtk_sys::gtk_search_entry_new()).unsafe_cast() }
52    }
53}
54
55impl Default for SearchEntry {
56    fn default() -> Self {
57        Self::new()
58    }
59}
60
61pub struct SearchEntryBuilder {
62    activates_default: Option<bool>,
63    attributes: Option<pango::AttrList>,
64    buffer: Option<EntryBuffer>,
65    caps_lock_warning: Option<bool>,
66    completion: Option<EntryCompletion>,
67    editable: Option<bool>,
68    enable_emoji_completion: Option<bool>,
69    has_frame: Option<bool>,
70    im_module: Option<String>,
71    input_hints: Option<InputHints>,
72    input_purpose: Option<InputPurpose>,
73    invisible_char: Option<u32>,
74    invisible_char_set: Option<bool>,
75    max_length: Option<i32>,
76    max_width_chars: Option<i32>,
77    overwrite_mode: Option<bool>,
78    placeholder_text: Option<String>,
79    populate_all: Option<bool>,
80    primary_icon_activatable: Option<bool>,
81    primary_icon_gicon: Option<gio::Icon>,
82    primary_icon_name: Option<String>,
83    primary_icon_pixbuf: Option<gdk_pixbuf::Pixbuf>,
84    primary_icon_sensitive: Option<bool>,
85    primary_icon_tooltip_markup: Option<String>,
86    primary_icon_tooltip_text: Option<String>,
87    progress_fraction: Option<f64>,
88    progress_pulse_step: Option<f64>,
89    secondary_icon_activatable: Option<bool>,
90    secondary_icon_gicon: Option<gio::Icon>,
91    secondary_icon_name: Option<String>,
92    secondary_icon_pixbuf: Option<gdk_pixbuf::Pixbuf>,
93    secondary_icon_sensitive: Option<bool>,
94    secondary_icon_tooltip_markup: Option<String>,
95    secondary_icon_tooltip_text: Option<String>,
96    shadow_type: Option<ShadowType>,
97    show_emoji_icon: Option<bool>,
98    tabs: Option<pango::TabArray>,
99    text: Option<String>,
100    truncate_multiline: Option<bool>,
101    visibility: Option<bool>,
102    width_chars: Option<i32>,
103    xalign: Option<f32>,
104    app_paintable: Option<bool>,
105    can_default: Option<bool>,
106    can_focus: Option<bool>,
107    events: Option<gdk::EventMask>,
108    expand: Option<bool>,
109    #[cfg(any(feature = "v3_20", feature = "dox"))]
110    focus_on_click: Option<bool>,
111    halign: Option<Align>,
112    has_default: Option<bool>,
113    has_focus: Option<bool>,
114    has_tooltip: Option<bool>,
115    height_request: Option<i32>,
116    hexpand: Option<bool>,
117    hexpand_set: Option<bool>,
118    is_focus: Option<bool>,
119    margin: Option<i32>,
120    margin_bottom: Option<i32>,
121    margin_end: Option<i32>,
122    margin_start: Option<i32>,
123    margin_top: Option<i32>,
124    name: Option<String>,
125    no_show_all: Option<bool>,
126    opacity: Option<f64>,
127    parent: Option<Container>,
128    receives_default: Option<bool>,
129    sensitive: Option<bool>,
130    //style: /*Unknown type*/,
131    tooltip_markup: Option<String>,
132    tooltip_text: Option<String>,
133    valign: Option<Align>,
134    vexpand: Option<bool>,
135    vexpand_set: Option<bool>,
136    visible: Option<bool>,
137    width_request: Option<i32>,
138}
139
140impl SearchEntryBuilder {
141    pub fn new() -> Self {
142        Self {
143            activates_default: None,
144            attributes: None,
145            buffer: None,
146            caps_lock_warning: None,
147            completion: None,
148            editable: None,
149            enable_emoji_completion: None,
150            has_frame: None,
151            im_module: None,
152            input_hints: None,
153            input_purpose: None,
154            invisible_char: None,
155            invisible_char_set: None,
156            max_length: None,
157            max_width_chars: None,
158            overwrite_mode: None,
159            placeholder_text: None,
160            populate_all: None,
161            primary_icon_activatable: None,
162            primary_icon_gicon: None,
163            primary_icon_name: None,
164            primary_icon_pixbuf: None,
165            primary_icon_sensitive: None,
166            primary_icon_tooltip_markup: None,
167            primary_icon_tooltip_text: None,
168            progress_fraction: None,
169            progress_pulse_step: None,
170            secondary_icon_activatable: None,
171            secondary_icon_gicon: None,
172            secondary_icon_name: None,
173            secondary_icon_pixbuf: None,
174            secondary_icon_sensitive: None,
175            secondary_icon_tooltip_markup: None,
176            secondary_icon_tooltip_text: None,
177            shadow_type: None,
178            show_emoji_icon: None,
179            tabs: None,
180            text: None,
181            truncate_multiline: None,
182            visibility: None,
183            width_chars: None,
184            xalign: None,
185            app_paintable: None,
186            can_default: None,
187            can_focus: None,
188            events: None,
189            expand: None,
190            #[cfg(any(feature = "v3_20", feature = "dox"))]
191            focus_on_click: None,
192            halign: None,
193            has_default: None,
194            has_focus: None,
195            has_tooltip: None,
196            height_request: None,
197            hexpand: None,
198            hexpand_set: None,
199            is_focus: None,
200            margin: None,
201            margin_bottom: None,
202            margin_end: None,
203            margin_start: None,
204            margin_top: None,
205            name: None,
206            no_show_all: None,
207            opacity: None,
208            parent: None,
209            receives_default: None,
210            sensitive: None,
211            tooltip_markup: None,
212            tooltip_text: None,
213            valign: None,
214            vexpand: None,
215            vexpand_set: None,
216            visible: None,
217            width_request: None,
218        }
219    }
220
221    pub fn build(self) -> SearchEntry {
222        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
223        if let Some(ref activates_default) = self.activates_default {
224            properties.push(("activates-default", activates_default));
225        }
226        if let Some(ref attributes) = self.attributes {
227            properties.push(("attributes", attributes));
228        }
229        if let Some(ref buffer) = self.buffer {
230            properties.push(("buffer", buffer));
231        }
232        if let Some(ref caps_lock_warning) = self.caps_lock_warning {
233            properties.push(("caps-lock-warning", caps_lock_warning));
234        }
235        if let Some(ref completion) = self.completion {
236            properties.push(("completion", completion));
237        }
238        if let Some(ref editable) = self.editable {
239            properties.push(("editable", editable));
240        }
241        if let Some(ref enable_emoji_completion) = self.enable_emoji_completion {
242            properties.push(("enable-emoji-completion", enable_emoji_completion));
243        }
244        if let Some(ref has_frame) = self.has_frame {
245            properties.push(("has-frame", has_frame));
246        }
247        if let Some(ref im_module) = self.im_module {
248            properties.push(("im-module", im_module));
249        }
250        if let Some(ref input_hints) = self.input_hints {
251            properties.push(("input-hints", input_hints));
252        }
253        if let Some(ref input_purpose) = self.input_purpose {
254            properties.push(("input-purpose", input_purpose));
255        }
256        if let Some(ref invisible_char) = self.invisible_char {
257            properties.push(("invisible-char", invisible_char));
258        }
259        if let Some(ref invisible_char_set) = self.invisible_char_set {
260            properties.push(("invisible-char-set", invisible_char_set));
261        }
262        if let Some(ref max_length) = self.max_length {
263            properties.push(("max-length", max_length));
264        }
265        if let Some(ref max_width_chars) = self.max_width_chars {
266            properties.push(("max-width-chars", max_width_chars));
267        }
268        if let Some(ref overwrite_mode) = self.overwrite_mode {
269            properties.push(("overwrite-mode", overwrite_mode));
270        }
271        if let Some(ref placeholder_text) = self.placeholder_text {
272            properties.push(("placeholder-text", placeholder_text));
273        }
274        if let Some(ref populate_all) = self.populate_all {
275            properties.push(("populate-all", populate_all));
276        }
277        if let Some(ref primary_icon_activatable) = self.primary_icon_activatable {
278            properties.push(("primary-icon-activatable", primary_icon_activatable));
279        }
280        if let Some(ref primary_icon_gicon) = self.primary_icon_gicon {
281            properties.push(("primary-icon-gicon", primary_icon_gicon));
282        }
283        if let Some(ref primary_icon_name) = self.primary_icon_name {
284            properties.push(("primary-icon-name", primary_icon_name));
285        }
286        if let Some(ref primary_icon_pixbuf) = self.primary_icon_pixbuf {
287            properties.push(("primary-icon-pixbuf", primary_icon_pixbuf));
288        }
289        if let Some(ref primary_icon_sensitive) = self.primary_icon_sensitive {
290            properties.push(("primary-icon-sensitive", primary_icon_sensitive));
291        }
292        if let Some(ref primary_icon_tooltip_markup) = self.primary_icon_tooltip_markup {
293            properties.push(("primary-icon-tooltip-markup", primary_icon_tooltip_markup));
294        }
295        if let Some(ref primary_icon_tooltip_text) = self.primary_icon_tooltip_text {
296            properties.push(("primary-icon-tooltip-text", primary_icon_tooltip_text));
297        }
298        if let Some(ref progress_fraction) = self.progress_fraction {
299            properties.push(("progress-fraction", progress_fraction));
300        }
301        if let Some(ref progress_pulse_step) = self.progress_pulse_step {
302            properties.push(("progress-pulse-step", progress_pulse_step));
303        }
304        if let Some(ref secondary_icon_activatable) = self.secondary_icon_activatable {
305            properties.push(("secondary-icon-activatable", secondary_icon_activatable));
306        }
307        if let Some(ref secondary_icon_gicon) = self.secondary_icon_gicon {
308            properties.push(("secondary-icon-gicon", secondary_icon_gicon));
309        }
310        if let Some(ref secondary_icon_name) = self.secondary_icon_name {
311            properties.push(("secondary-icon-name", secondary_icon_name));
312        }
313        if let Some(ref secondary_icon_pixbuf) = self.secondary_icon_pixbuf {
314            properties.push(("secondary-icon-pixbuf", secondary_icon_pixbuf));
315        }
316        if let Some(ref secondary_icon_sensitive) = self.secondary_icon_sensitive {
317            properties.push(("secondary-icon-sensitive", secondary_icon_sensitive));
318        }
319        if let Some(ref secondary_icon_tooltip_markup) = self.secondary_icon_tooltip_markup {
320            properties.push((
321                "secondary-icon-tooltip-markup",
322                secondary_icon_tooltip_markup,
323            ));
324        }
325        if let Some(ref secondary_icon_tooltip_text) = self.secondary_icon_tooltip_text {
326            properties.push(("secondary-icon-tooltip-text", secondary_icon_tooltip_text));
327        }
328        if let Some(ref shadow_type) = self.shadow_type {
329            properties.push(("shadow-type", shadow_type));
330        }
331        if let Some(ref show_emoji_icon) = self.show_emoji_icon {
332            properties.push(("show-emoji-icon", show_emoji_icon));
333        }
334        if let Some(ref tabs) = self.tabs {
335            properties.push(("tabs", tabs));
336        }
337        if let Some(ref text) = self.text {
338            properties.push(("text", text));
339        }
340        if let Some(ref truncate_multiline) = self.truncate_multiline {
341            properties.push(("truncate-multiline", truncate_multiline));
342        }
343        if let Some(ref visibility) = self.visibility {
344            properties.push(("visibility", visibility));
345        }
346        if let Some(ref width_chars) = self.width_chars {
347            properties.push(("width-chars", width_chars));
348        }
349        if let Some(ref xalign) = self.xalign {
350            properties.push(("xalign", xalign));
351        }
352        if let Some(ref app_paintable) = self.app_paintable {
353            properties.push(("app-paintable", app_paintable));
354        }
355        if let Some(ref can_default) = self.can_default {
356            properties.push(("can-default", can_default));
357        }
358        if let Some(ref can_focus) = self.can_focus {
359            properties.push(("can-focus", can_focus));
360        }
361        if let Some(ref events) = self.events {
362            properties.push(("events", events));
363        }
364        if let Some(ref expand) = self.expand {
365            properties.push(("expand", expand));
366        }
367        #[cfg(any(feature = "v3_20", feature = "dox"))]
368        {
369            if let Some(ref focus_on_click) = self.focus_on_click {
370                properties.push(("focus-on-click", focus_on_click));
371            }
372        }
373        if let Some(ref halign) = self.halign {
374            properties.push(("halign", halign));
375        }
376        if let Some(ref has_default) = self.has_default {
377            properties.push(("has-default", has_default));
378        }
379        if let Some(ref has_focus) = self.has_focus {
380            properties.push(("has-focus", has_focus));
381        }
382        if let Some(ref has_tooltip) = self.has_tooltip {
383            properties.push(("has-tooltip", has_tooltip));
384        }
385        if let Some(ref height_request) = self.height_request {
386            properties.push(("height-request", height_request));
387        }
388        if let Some(ref hexpand) = self.hexpand {
389            properties.push(("hexpand", hexpand));
390        }
391        if let Some(ref hexpand_set) = self.hexpand_set {
392            properties.push(("hexpand-set", hexpand_set));
393        }
394        if let Some(ref is_focus) = self.is_focus {
395            properties.push(("is-focus", is_focus));
396        }
397        if let Some(ref margin) = self.margin {
398            properties.push(("margin", margin));
399        }
400        if let Some(ref margin_bottom) = self.margin_bottom {
401            properties.push(("margin-bottom", margin_bottom));
402        }
403        if let Some(ref margin_end) = self.margin_end {
404            properties.push(("margin-end", margin_end));
405        }
406        if let Some(ref margin_start) = self.margin_start {
407            properties.push(("margin-start", margin_start));
408        }
409        if let Some(ref margin_top) = self.margin_top {
410            properties.push(("margin-top", margin_top));
411        }
412        if let Some(ref name) = self.name {
413            properties.push(("name", name));
414        }
415        if let Some(ref no_show_all) = self.no_show_all {
416            properties.push(("no-show-all", no_show_all));
417        }
418        if let Some(ref opacity) = self.opacity {
419            properties.push(("opacity", opacity));
420        }
421        if let Some(ref parent) = self.parent {
422            properties.push(("parent", parent));
423        }
424        if let Some(ref receives_default) = self.receives_default {
425            properties.push(("receives-default", receives_default));
426        }
427        if let Some(ref sensitive) = self.sensitive {
428            properties.push(("sensitive", sensitive));
429        }
430        if let Some(ref tooltip_markup) = self.tooltip_markup {
431            properties.push(("tooltip-markup", tooltip_markup));
432        }
433        if let Some(ref tooltip_text) = self.tooltip_text {
434            properties.push(("tooltip-text", tooltip_text));
435        }
436        if let Some(ref valign) = self.valign {
437            properties.push(("valign", valign));
438        }
439        if let Some(ref vexpand) = self.vexpand {
440            properties.push(("vexpand", vexpand));
441        }
442        if let Some(ref vexpand_set) = self.vexpand_set {
443            properties.push(("vexpand-set", vexpand_set));
444        }
445        if let Some(ref visible) = self.visible {
446            properties.push(("visible", visible));
447        }
448        if let Some(ref width_request) = self.width_request {
449            properties.push(("width-request", width_request));
450        }
451        glib::Object::new(SearchEntry::static_type(), &properties)
452            .expect("object new")
453            .downcast()
454            .expect("downcast")
455    }
456
457    pub fn activates_default(mut self, activates_default: bool) -> Self {
458        self.activates_default = Some(activates_default);
459        self
460    }
461
462    pub fn attributes(mut self, attributes: &pango::AttrList) -> Self {
463        self.attributes = Some(attributes.clone());
464        self
465    }
466
467    pub fn buffer(mut self, buffer: &EntryBuffer) -> Self {
468        self.buffer = Some(buffer.clone());
469        self
470    }
471
472    pub fn caps_lock_warning(mut self, caps_lock_warning: bool) -> Self {
473        self.caps_lock_warning = Some(caps_lock_warning);
474        self
475    }
476
477    pub fn completion(mut self, completion: &EntryCompletion) -> Self {
478        self.completion = Some(completion.clone());
479        self
480    }
481
482    pub fn editable(mut self, editable: bool) -> Self {
483        self.editable = Some(editable);
484        self
485    }
486
487    pub fn enable_emoji_completion(mut self, enable_emoji_completion: bool) -> Self {
488        self.enable_emoji_completion = Some(enable_emoji_completion);
489        self
490    }
491
492    pub fn has_frame(mut self, has_frame: bool) -> Self {
493        self.has_frame = Some(has_frame);
494        self
495    }
496
497    pub fn im_module(mut self, im_module: &str) -> Self {
498        self.im_module = Some(im_module.to_string());
499        self
500    }
501
502    pub fn input_hints(mut self, input_hints: InputHints) -> Self {
503        self.input_hints = Some(input_hints);
504        self
505    }
506
507    pub fn input_purpose(mut self, input_purpose: InputPurpose) -> Self {
508        self.input_purpose = Some(input_purpose);
509        self
510    }
511
512    pub fn invisible_char(mut self, invisible_char: u32) -> Self {
513        self.invisible_char = Some(invisible_char);
514        self
515    }
516
517    pub fn invisible_char_set(mut self, invisible_char_set: bool) -> Self {
518        self.invisible_char_set = Some(invisible_char_set);
519        self
520    }
521
522    pub fn max_length(mut self, max_length: i32) -> Self {
523        self.max_length = Some(max_length);
524        self
525    }
526
527    pub fn max_width_chars(mut self, max_width_chars: i32) -> Self {
528        self.max_width_chars = Some(max_width_chars);
529        self
530    }
531
532    pub fn overwrite_mode(mut self, overwrite_mode: bool) -> Self {
533        self.overwrite_mode = Some(overwrite_mode);
534        self
535    }
536
537    pub fn placeholder_text(mut self, placeholder_text: &str) -> Self {
538        self.placeholder_text = Some(placeholder_text.to_string());
539        self
540    }
541
542    pub fn populate_all(mut self, populate_all: bool) -> Self {
543        self.populate_all = Some(populate_all);
544        self
545    }
546
547    pub fn primary_icon_activatable(mut self, primary_icon_activatable: bool) -> Self {
548        self.primary_icon_activatable = Some(primary_icon_activatable);
549        self
550    }
551
552    pub fn primary_icon_gicon(mut self, primary_icon_gicon: &gio::Icon) -> Self {
553        self.primary_icon_gicon = Some(primary_icon_gicon.clone());
554        self
555    }
556
557    pub fn primary_icon_name(mut self, primary_icon_name: &str) -> Self {
558        self.primary_icon_name = Some(primary_icon_name.to_string());
559        self
560    }
561
562    pub fn primary_icon_pixbuf(mut self, primary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
563        self.primary_icon_pixbuf = Some(primary_icon_pixbuf.clone());
564        self
565    }
566
567    pub fn primary_icon_sensitive(mut self, primary_icon_sensitive: bool) -> Self {
568        self.primary_icon_sensitive = Some(primary_icon_sensitive);
569        self
570    }
571
572    pub fn primary_icon_tooltip_markup(mut self, primary_icon_tooltip_markup: &str) -> Self {
573        self.primary_icon_tooltip_markup = Some(primary_icon_tooltip_markup.to_string());
574        self
575    }
576
577    pub fn primary_icon_tooltip_text(mut self, primary_icon_tooltip_text: &str) -> Self {
578        self.primary_icon_tooltip_text = Some(primary_icon_tooltip_text.to_string());
579        self
580    }
581
582    pub fn progress_fraction(mut self, progress_fraction: f64) -> Self {
583        self.progress_fraction = Some(progress_fraction);
584        self
585    }
586
587    pub fn progress_pulse_step(mut self, progress_pulse_step: f64) -> Self {
588        self.progress_pulse_step = Some(progress_pulse_step);
589        self
590    }
591
592    pub fn secondary_icon_activatable(mut self, secondary_icon_activatable: bool) -> Self {
593        self.secondary_icon_activatable = Some(secondary_icon_activatable);
594        self
595    }
596
597    pub fn secondary_icon_gicon(mut self, secondary_icon_gicon: &gio::Icon) -> Self {
598        self.secondary_icon_gicon = Some(secondary_icon_gicon.clone());
599        self
600    }
601
602    pub fn secondary_icon_name(mut self, secondary_icon_name: &str) -> Self {
603        self.secondary_icon_name = Some(secondary_icon_name.to_string());
604        self
605    }
606
607    pub fn secondary_icon_pixbuf(mut self, secondary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self {
608        self.secondary_icon_pixbuf = Some(secondary_icon_pixbuf.clone());
609        self
610    }
611
612    pub fn secondary_icon_sensitive(mut self, secondary_icon_sensitive: bool) -> Self {
613        self.secondary_icon_sensitive = Some(secondary_icon_sensitive);
614        self
615    }
616
617    pub fn secondary_icon_tooltip_markup(mut self, secondary_icon_tooltip_markup: &str) -> Self {
618        self.secondary_icon_tooltip_markup = Some(secondary_icon_tooltip_markup.to_string());
619        self
620    }
621
622    pub fn secondary_icon_tooltip_text(mut self, secondary_icon_tooltip_text: &str) -> Self {
623        self.secondary_icon_tooltip_text = Some(secondary_icon_tooltip_text.to_string());
624        self
625    }
626
627    pub fn shadow_type(mut self, shadow_type: ShadowType) -> Self {
628        self.shadow_type = Some(shadow_type);
629        self
630    }
631
632    pub fn show_emoji_icon(mut self, show_emoji_icon: bool) -> Self {
633        self.show_emoji_icon = Some(show_emoji_icon);
634        self
635    }
636
637    pub fn tabs(mut self, tabs: &pango::TabArray) -> Self {
638        self.tabs = Some(tabs.clone());
639        self
640    }
641
642    pub fn text(mut self, text: &str) -> Self {
643        self.text = Some(text.to_string());
644        self
645    }
646
647    pub fn truncate_multiline(mut self, truncate_multiline: bool) -> Self {
648        self.truncate_multiline = Some(truncate_multiline);
649        self
650    }
651
652    pub fn visibility(mut self, visibility: bool) -> Self {
653        self.visibility = Some(visibility);
654        self
655    }
656
657    pub fn width_chars(mut self, width_chars: i32) -> Self {
658        self.width_chars = Some(width_chars);
659        self
660    }
661
662    pub fn xalign(mut self, xalign: f32) -> Self {
663        self.xalign = Some(xalign);
664        self
665    }
666
667    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
668        self.app_paintable = Some(app_paintable);
669        self
670    }
671
672    pub fn can_default(mut self, can_default: bool) -> Self {
673        self.can_default = Some(can_default);
674        self
675    }
676
677    pub fn can_focus(mut self, can_focus: bool) -> Self {
678        self.can_focus = Some(can_focus);
679        self
680    }
681
682    pub fn events(mut self, events: gdk::EventMask) -> Self {
683        self.events = Some(events);
684        self
685    }
686
687    pub fn expand(mut self, expand: bool) -> Self {
688        self.expand = Some(expand);
689        self
690    }
691
692    #[cfg(any(feature = "v3_20", feature = "dox"))]
693    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
694        self.focus_on_click = Some(focus_on_click);
695        self
696    }
697
698    pub fn halign(mut self, halign: Align) -> Self {
699        self.halign = Some(halign);
700        self
701    }
702
703    pub fn has_default(mut self, has_default: bool) -> Self {
704        self.has_default = Some(has_default);
705        self
706    }
707
708    pub fn has_focus(mut self, has_focus: bool) -> Self {
709        self.has_focus = Some(has_focus);
710        self
711    }
712
713    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
714        self.has_tooltip = Some(has_tooltip);
715        self
716    }
717
718    pub fn height_request(mut self, height_request: i32) -> Self {
719        self.height_request = Some(height_request);
720        self
721    }
722
723    pub fn hexpand(mut self, hexpand: bool) -> Self {
724        self.hexpand = Some(hexpand);
725        self
726    }
727
728    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
729        self.hexpand_set = Some(hexpand_set);
730        self
731    }
732
733    pub fn is_focus(mut self, is_focus: bool) -> Self {
734        self.is_focus = Some(is_focus);
735        self
736    }
737
738    pub fn margin(mut self, margin: i32) -> Self {
739        self.margin = Some(margin);
740        self
741    }
742
743    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
744        self.margin_bottom = Some(margin_bottom);
745        self
746    }
747
748    pub fn margin_end(mut self, margin_end: i32) -> Self {
749        self.margin_end = Some(margin_end);
750        self
751    }
752
753    pub fn margin_start(mut self, margin_start: i32) -> Self {
754        self.margin_start = Some(margin_start);
755        self
756    }
757
758    pub fn margin_top(mut self, margin_top: i32) -> Self {
759        self.margin_top = Some(margin_top);
760        self
761    }
762
763    pub fn name(mut self, name: &str) -> Self {
764        self.name = Some(name.to_string());
765        self
766    }
767
768    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
769        self.no_show_all = Some(no_show_all);
770        self
771    }
772
773    pub fn opacity(mut self, opacity: f64) -> Self {
774        self.opacity = Some(opacity);
775        self
776    }
777
778    pub fn parent(mut self, parent: &Container) -> Self {
779        self.parent = Some(parent.clone());
780        self
781    }
782
783    pub fn receives_default(mut self, receives_default: bool) -> Self {
784        self.receives_default = Some(receives_default);
785        self
786    }
787
788    pub fn sensitive(mut self, sensitive: bool) -> Self {
789        self.sensitive = Some(sensitive);
790        self
791    }
792
793    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
794        self.tooltip_markup = Some(tooltip_markup.to_string());
795        self
796    }
797
798    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
799        self.tooltip_text = Some(tooltip_text.to_string());
800        self
801    }
802
803    pub fn valign(mut self, valign: Align) -> Self {
804        self.valign = Some(valign);
805        self
806    }
807
808    pub fn vexpand(mut self, vexpand: bool) -> Self {
809        self.vexpand = Some(vexpand);
810        self
811    }
812
813    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
814        self.vexpand_set = Some(vexpand_set);
815        self
816    }
817
818    pub fn visible(mut self, visible: bool) -> Self {
819        self.visible = Some(visible);
820        self
821    }
822
823    pub fn width_request(mut self, width_request: i32) -> Self {
824        self.width_request = Some(width_request);
825        self
826    }
827}
828
829pub const NONE_SEARCH_ENTRY: Option<&SearchEntry> = None;
830
831pub trait SearchEntryExt: 'static {
832    #[cfg(any(feature = "v3_16", feature = "dox"))]
833    fn handle_event(&self, event: &gdk::Event) -> bool;
834
835    #[cfg(any(feature = "v3_16", feature = "dox"))]
836    fn connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
837
838    #[cfg(any(feature = "v3_16", feature = "dox"))]
839    fn emit_next_match(&self);
840
841    #[cfg(any(feature = "v3_16", feature = "dox"))]
842    fn connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
843
844    #[cfg(any(feature = "v3_16", feature = "dox"))]
845    fn emit_previous_match(&self);
846
847    fn connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
848
849    #[cfg(any(feature = "v3_16", feature = "dox"))]
850    fn connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
851
852    #[cfg(any(feature = "v3_16", feature = "dox"))]
853    fn emit_stop_search(&self);
854}
855
856impl<O: IsA<SearchEntry>> SearchEntryExt for O {
857    #[cfg(any(feature = "v3_16", feature = "dox"))]
858    fn handle_event(&self, event: &gdk::Event) -> bool {
859        unsafe {
860            from_glib(gtk_sys::gtk_search_entry_handle_event(
861                self.as_ref().to_glib_none().0,
862                mut_override(event.to_glib_none().0),
863            ))
864        }
865    }
866
867    #[cfg(any(feature = "v3_16", feature = "dox"))]
868    fn connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
869        unsafe extern "C" fn next_match_trampoline<P, F: Fn(&P) + 'static>(
870            this: *mut gtk_sys::GtkSearchEntry,
871            f: glib_sys::gpointer,
872        ) where
873            P: IsA<SearchEntry>,
874        {
875            let f: &F = &*(f as *const F);
876            f(&SearchEntry::from_glib_borrow(this).unsafe_cast())
877        }
878        unsafe {
879            let f: Box_<F> = Box_::new(f);
880            connect_raw(
881                self.as_ptr() as *mut _,
882                b"next-match\0".as_ptr() as *const _,
883                Some(transmute(next_match_trampoline::<Self, F> as usize)),
884                Box_::into_raw(f),
885            )
886        }
887    }
888
889    #[cfg(any(feature = "v3_16", feature = "dox"))]
890    fn emit_next_match(&self) {
891        let _ = unsafe {
892            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
893                .emit("next-match", &[])
894                .unwrap()
895        };
896    }
897
898    #[cfg(any(feature = "v3_16", feature = "dox"))]
899    fn connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
900        unsafe extern "C" fn previous_match_trampoline<P, F: Fn(&P) + 'static>(
901            this: *mut gtk_sys::GtkSearchEntry,
902            f: glib_sys::gpointer,
903        ) where
904            P: IsA<SearchEntry>,
905        {
906            let f: &F = &*(f as *const F);
907            f(&SearchEntry::from_glib_borrow(this).unsafe_cast())
908        }
909        unsafe {
910            let f: Box_<F> = Box_::new(f);
911            connect_raw(
912                self.as_ptr() as *mut _,
913                b"previous-match\0".as_ptr() as *const _,
914                Some(transmute(previous_match_trampoline::<Self, F> as usize)),
915                Box_::into_raw(f),
916            )
917        }
918    }
919
920    #[cfg(any(feature = "v3_16", feature = "dox"))]
921    fn emit_previous_match(&self) {
922        let _ = unsafe {
923            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
924                .emit("previous-match", &[])
925                .unwrap()
926        };
927    }
928
929    fn connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
930        unsafe extern "C" fn search_changed_trampoline<P, F: Fn(&P) + 'static>(
931            this: *mut gtk_sys::GtkSearchEntry,
932            f: glib_sys::gpointer,
933        ) where
934            P: IsA<SearchEntry>,
935        {
936            let f: &F = &*(f as *const F);
937            f(&SearchEntry::from_glib_borrow(this).unsafe_cast())
938        }
939        unsafe {
940            let f: Box_<F> = Box_::new(f);
941            connect_raw(
942                self.as_ptr() as *mut _,
943                b"search-changed\0".as_ptr() as *const _,
944                Some(transmute(search_changed_trampoline::<Self, F> as usize)),
945                Box_::into_raw(f),
946            )
947        }
948    }
949
950    #[cfg(any(feature = "v3_16", feature = "dox"))]
951    fn connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
952        unsafe extern "C" fn stop_search_trampoline<P, F: Fn(&P) + 'static>(
953            this: *mut gtk_sys::GtkSearchEntry,
954            f: glib_sys::gpointer,
955        ) where
956            P: IsA<SearchEntry>,
957        {
958            let f: &F = &*(f as *const F);
959            f(&SearchEntry::from_glib_borrow(this).unsafe_cast())
960        }
961        unsafe {
962            let f: Box_<F> = Box_::new(f);
963            connect_raw(
964                self.as_ptr() as *mut _,
965                b"stop-search\0".as_ptr() as *const _,
966                Some(transmute(stop_search_trampoline::<Self, F> as usize)),
967                Box_::into_raw(f),
968            )
969        }
970    }
971
972    #[cfg(any(feature = "v3_16", feature = "dox"))]
973    fn emit_stop_search(&self) {
974        let _ = unsafe {
975            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
976                .emit("stop-search", &[])
977                .unwrap()
978        };
979    }
980}
981
982impl fmt::Display for SearchEntry {
983    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
984        write!(f, "SearchEntry")
985    }
986}