gtk/auto/
combo_box.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, Bin, Buildable, CellArea, CellEditable, CellLayout, Container, ResizeMode, ScrollType,
7    SensitivityType, TreeIter, TreeModel, Widget,
8};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::{boxed::Box as Box_, fmt, mem::transmute};
15
16glib::wrapper! {
17    #[doc(alias = "GtkComboBox")]
18    pub struct ComboBox(Object<ffi::GtkComboBox, ffi::GtkComboBoxClass>) @extends Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout;
19
20    match fn {
21        type_ => || ffi::gtk_combo_box_get_type(),
22    }
23}
24
25impl ComboBox {
26    pub const NONE: Option<&'static ComboBox> = None;
27
28    #[doc(alias = "gtk_combo_box_new")]
29    pub fn new() -> ComboBox {
30        assert_initialized_main_thread!();
31        unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new()).unsafe_cast() }
32    }
33
34    #[doc(alias = "gtk_combo_box_new_with_area")]
35    #[doc(alias = "new_with_area")]
36    pub fn with_area(area: &impl IsA<CellArea>) -> ComboBox {
37        skip_assert_initialized!();
38        unsafe {
39            Widget::from_glib_none(ffi::gtk_combo_box_new_with_area(
40                area.as_ref().to_glib_none().0,
41            ))
42            .unsafe_cast()
43        }
44    }
45
46    #[doc(alias = "gtk_combo_box_new_with_area_and_entry")]
47    #[doc(alias = "new_with_area_and_entry")]
48    pub fn with_area_and_entry(area: &impl IsA<CellArea>) -> ComboBox {
49        skip_assert_initialized!();
50        unsafe {
51            Widget::from_glib_none(ffi::gtk_combo_box_new_with_area_and_entry(
52                area.as_ref().to_glib_none().0,
53            ))
54            .unsafe_cast()
55        }
56    }
57
58    #[doc(alias = "gtk_combo_box_new_with_entry")]
59    #[doc(alias = "new_with_entry")]
60    pub fn with_entry() -> ComboBox {
61        assert_initialized_main_thread!();
62        unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new_with_entry()).unsafe_cast() }
63    }
64
65    #[doc(alias = "gtk_combo_box_new_with_model")]
66    #[doc(alias = "new_with_model")]
67    pub fn with_model(model: &impl IsA<TreeModel>) -> ComboBox {
68        skip_assert_initialized!();
69        unsafe {
70            Widget::from_glib_none(ffi::gtk_combo_box_new_with_model(
71                model.as_ref().to_glib_none().0,
72            ))
73            .unsafe_cast()
74        }
75    }
76
77    #[doc(alias = "gtk_combo_box_new_with_model_and_entry")]
78    #[doc(alias = "new_with_model_and_entry")]
79    pub fn with_model_and_entry(model: &impl IsA<TreeModel>) -> ComboBox {
80        skip_assert_initialized!();
81        unsafe {
82            Widget::from_glib_none(ffi::gtk_combo_box_new_with_model_and_entry(
83                model.as_ref().to_glib_none().0,
84            ))
85            .unsafe_cast()
86        }
87    }
88
89    // rustdoc-stripper-ignore-next
90    /// Creates a new builder-pattern struct instance to construct [`ComboBox`] objects.
91    ///
92    /// This method returns an instance of [`ComboBoxBuilder`](crate::builders::ComboBoxBuilder) which can be used to create [`ComboBox`] objects.
93    pub fn builder() -> ComboBoxBuilder {
94        ComboBoxBuilder::new()
95    }
96}
97
98impl Default for ComboBox {
99    fn default() -> Self {
100        Self::new()
101    }
102}
103
104// rustdoc-stripper-ignore-next
105/// A [builder-pattern] type to construct [`ComboBox`] objects.
106///
107/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
108#[must_use = "The builder must be built to be used"]
109pub struct ComboBoxBuilder {
110    builder: glib::object::ObjectBuilder<'static, ComboBox>,
111}
112
113impl ComboBoxBuilder {
114    fn new() -> Self {
115        Self {
116            builder: glib::object::Object::builder(),
117        }
118    }
119
120    pub fn active(self, active: i32) -> Self {
121        Self {
122            builder: self.builder.property("active", active),
123        }
124    }
125
126    pub fn active_id(self, active_id: impl Into<glib::GString>) -> Self {
127        Self {
128            builder: self.builder.property("active-id", active_id.into()),
129        }
130    }
131
132    pub fn button_sensitivity(self, button_sensitivity: SensitivityType) -> Self {
133        Self {
134            builder: self
135                .builder
136                .property("button-sensitivity", button_sensitivity),
137        }
138    }
139
140    pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
141        Self {
142            builder: self
143                .builder
144                .property("cell-area", cell_area.clone().upcast()),
145        }
146    }
147
148    pub fn column_span_column(self, column_span_column: i32) -> Self {
149        Self {
150            builder: self
151                .builder
152                .property("column-span-column", column_span_column),
153        }
154    }
155
156    pub fn entry_text_column(self, entry_text_column: i32) -> Self {
157        Self {
158            builder: self
159                .builder
160                .property("entry-text-column", entry_text_column),
161        }
162    }
163
164    pub fn has_entry(self, has_entry: bool) -> Self {
165        Self {
166            builder: self.builder.property("has-entry", has_entry),
167        }
168    }
169
170    pub fn has_frame(self, has_frame: bool) -> Self {
171        Self {
172            builder: self.builder.property("has-frame", has_frame),
173        }
174    }
175
176    pub fn id_column(self, id_column: i32) -> Self {
177        Self {
178            builder: self.builder.property("id-column", id_column),
179        }
180    }
181
182    pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
183        Self {
184            builder: self.builder.property("model", model.clone().upcast()),
185        }
186    }
187
188    pub fn popup_fixed_width(self, popup_fixed_width: bool) -> Self {
189        Self {
190            builder: self
191                .builder
192                .property("popup-fixed-width", popup_fixed_width),
193        }
194    }
195
196    pub fn row_span_column(self, row_span_column: i32) -> Self {
197        Self {
198            builder: self.builder.property("row-span-column", row_span_column),
199        }
200    }
201
202    pub fn wrap_width(self, wrap_width: i32) -> Self {
203        Self {
204            builder: self.builder.property("wrap-width", wrap_width),
205        }
206    }
207
208    pub fn border_width(self, border_width: u32) -> Self {
209        Self {
210            builder: self.builder.property("border-width", border_width),
211        }
212    }
213
214    pub fn child(self, child: &impl IsA<Widget>) -> Self {
215        Self {
216            builder: self.builder.property("child", child.clone().upcast()),
217        }
218    }
219
220    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
221        Self {
222            builder: self.builder.property("resize-mode", resize_mode),
223        }
224    }
225
226    pub fn app_paintable(self, app_paintable: bool) -> Self {
227        Self {
228            builder: self.builder.property("app-paintable", app_paintable),
229        }
230    }
231
232    pub fn can_default(self, can_default: bool) -> Self {
233        Self {
234            builder: self.builder.property("can-default", can_default),
235        }
236    }
237
238    pub fn can_focus(self, can_focus: bool) -> Self {
239        Self {
240            builder: self.builder.property("can-focus", can_focus),
241        }
242    }
243
244    pub fn events(self, events: gdk::EventMask) -> Self {
245        Self {
246            builder: self.builder.property("events", events),
247        }
248    }
249
250    pub fn expand(self, expand: bool) -> Self {
251        Self {
252            builder: self.builder.property("expand", expand),
253        }
254    }
255
256    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
257        Self {
258            builder: self.builder.property("focus-on-click", focus_on_click),
259        }
260    }
261
262    pub fn halign(self, halign: Align) -> Self {
263        Self {
264            builder: self.builder.property("halign", halign),
265        }
266    }
267
268    pub fn has_default(self, has_default: bool) -> Self {
269        Self {
270            builder: self.builder.property("has-default", has_default),
271        }
272    }
273
274    pub fn has_focus(self, has_focus: bool) -> Self {
275        Self {
276            builder: self.builder.property("has-focus", has_focus),
277        }
278    }
279
280    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
281        Self {
282            builder: self.builder.property("has-tooltip", has_tooltip),
283        }
284    }
285
286    pub fn height_request(self, height_request: i32) -> Self {
287        Self {
288            builder: self.builder.property("height-request", height_request),
289        }
290    }
291
292    pub fn hexpand(self, hexpand: bool) -> Self {
293        Self {
294            builder: self.builder.property("hexpand", hexpand),
295        }
296    }
297
298    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
299        Self {
300            builder: self.builder.property("hexpand-set", hexpand_set),
301        }
302    }
303
304    pub fn is_focus(self, is_focus: bool) -> Self {
305        Self {
306            builder: self.builder.property("is-focus", is_focus),
307        }
308    }
309
310    pub fn margin(self, margin: i32) -> Self {
311        Self {
312            builder: self.builder.property("margin", margin),
313        }
314    }
315
316    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
317        Self {
318            builder: self.builder.property("margin-bottom", margin_bottom),
319        }
320    }
321
322    pub fn margin_end(self, margin_end: i32) -> Self {
323        Self {
324            builder: self.builder.property("margin-end", margin_end),
325        }
326    }
327
328    pub fn margin_start(self, margin_start: i32) -> Self {
329        Self {
330            builder: self.builder.property("margin-start", margin_start),
331        }
332    }
333
334    pub fn margin_top(self, margin_top: i32) -> Self {
335        Self {
336            builder: self.builder.property("margin-top", margin_top),
337        }
338    }
339
340    pub fn name(self, name: impl Into<glib::GString>) -> Self {
341        Self {
342            builder: self.builder.property("name", name.into()),
343        }
344    }
345
346    pub fn no_show_all(self, no_show_all: bool) -> Self {
347        Self {
348            builder: self.builder.property("no-show-all", no_show_all),
349        }
350    }
351
352    pub fn opacity(self, opacity: f64) -> Self {
353        Self {
354            builder: self.builder.property("opacity", opacity),
355        }
356    }
357
358    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
359        Self {
360            builder: self.builder.property("parent", parent.clone().upcast()),
361        }
362    }
363
364    pub fn receives_default(self, receives_default: bool) -> Self {
365        Self {
366            builder: self.builder.property("receives-default", receives_default),
367        }
368    }
369
370    pub fn sensitive(self, sensitive: bool) -> Self {
371        Self {
372            builder: self.builder.property("sensitive", sensitive),
373        }
374    }
375
376    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
377        Self {
378            builder: self
379                .builder
380                .property("tooltip-markup", tooltip_markup.into()),
381        }
382    }
383
384    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
385        Self {
386            builder: self.builder.property("tooltip-text", tooltip_text.into()),
387        }
388    }
389
390    pub fn valign(self, valign: Align) -> Self {
391        Self {
392            builder: self.builder.property("valign", valign),
393        }
394    }
395
396    pub fn vexpand(self, vexpand: bool) -> Self {
397        Self {
398            builder: self.builder.property("vexpand", vexpand),
399        }
400    }
401
402    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
403        Self {
404            builder: self.builder.property("vexpand-set", vexpand_set),
405        }
406    }
407
408    pub fn visible(self, visible: bool) -> Self {
409        Self {
410            builder: self.builder.property("visible", visible),
411        }
412    }
413
414    pub fn width_request(self, width_request: i32) -> Self {
415        Self {
416            builder: self.builder.property("width-request", width_request),
417        }
418    }
419
420    pub fn editing_canceled(self, editing_canceled: bool) -> Self {
421        Self {
422            builder: self.builder.property("editing-canceled", editing_canceled),
423        }
424    }
425
426    // rustdoc-stripper-ignore-next
427    /// Build the [`ComboBox`].
428    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
429    pub fn build(self) -> ComboBox {
430        self.builder.build()
431    }
432}
433
434mod sealed {
435    pub trait Sealed {}
436    impl<T: super::IsA<super::ComboBox>> Sealed for T {}
437}
438
439pub trait ComboBoxExt: IsA<ComboBox> + sealed::Sealed + 'static {
440    #[doc(alias = "gtk_combo_box_get_active_id")]
441    #[doc(alias = "get_active_id")]
442    fn active_id(&self) -> Option<glib::GString> {
443        unsafe {
444            from_glib_none(ffi::gtk_combo_box_get_active_id(
445                self.as_ref().to_glib_none().0,
446            ))
447        }
448    }
449
450    #[doc(alias = "gtk_combo_box_get_active_iter")]
451    #[doc(alias = "get_active_iter")]
452    fn active_iter(&self) -> Option<TreeIter> {
453        unsafe {
454            let mut iter = TreeIter::uninitialized();
455            let ret = from_glib(ffi::gtk_combo_box_get_active_iter(
456                self.as_ref().to_glib_none().0,
457                iter.to_glib_none_mut().0,
458            ));
459            if ret {
460                Some(iter)
461            } else {
462                None
463            }
464        }
465    }
466
467    #[doc(alias = "gtk_combo_box_get_button_sensitivity")]
468    #[doc(alias = "get_button_sensitivity")]
469    fn button_sensitivity(&self) -> SensitivityType {
470        unsafe {
471            from_glib(ffi::gtk_combo_box_get_button_sensitivity(
472                self.as_ref().to_glib_none().0,
473            ))
474        }
475    }
476
477    #[doc(alias = "gtk_combo_box_get_column_span_column")]
478    #[doc(alias = "get_column_span_column")]
479    fn column_span_column(&self) -> i32 {
480        unsafe { ffi::gtk_combo_box_get_column_span_column(self.as_ref().to_glib_none().0) }
481    }
482
483    #[doc(alias = "gtk_combo_box_get_entry_text_column")]
484    #[doc(alias = "get_entry_text_column")]
485    fn entry_text_column(&self) -> i32 {
486        unsafe { ffi::gtk_combo_box_get_entry_text_column(self.as_ref().to_glib_none().0) }
487    }
488
489    #[doc(alias = "gtk_combo_box_get_has_entry")]
490    #[doc(alias = "get_has_entry")]
491    fn has_entry(&self) -> bool {
492        unsafe {
493            from_glib(ffi::gtk_combo_box_get_has_entry(
494                self.as_ref().to_glib_none().0,
495            ))
496        }
497    }
498
499    #[doc(alias = "gtk_combo_box_get_id_column")]
500    #[doc(alias = "get_id_column")]
501    fn id_column(&self) -> i32 {
502        unsafe { ffi::gtk_combo_box_get_id_column(self.as_ref().to_glib_none().0) }
503    }
504
505    #[doc(alias = "gtk_combo_box_get_model")]
506    #[doc(alias = "get_model")]
507    fn model(&self) -> Option<TreeModel> {
508        unsafe { from_glib_none(ffi::gtk_combo_box_get_model(self.as_ref().to_glib_none().0)) }
509    }
510
511    #[doc(alias = "gtk_combo_box_get_popup_accessible")]
512    #[doc(alias = "get_popup_accessible")]
513    fn popup_accessible(&self) -> Option<atk::Object> {
514        unsafe {
515            from_glib_none(ffi::gtk_combo_box_get_popup_accessible(
516                self.as_ref().to_glib_none().0,
517            ))
518        }
519    }
520
521    #[doc(alias = "gtk_combo_box_get_popup_fixed_width")]
522    #[doc(alias = "get_popup_fixed_width")]
523    fn is_popup_fixed_width(&self) -> bool {
524        unsafe {
525            from_glib(ffi::gtk_combo_box_get_popup_fixed_width(
526                self.as_ref().to_glib_none().0,
527            ))
528        }
529    }
530
531    //#[doc(alias = "gtk_combo_box_get_row_separator_func")]
532    //#[doc(alias = "get_row_separator_func")]
533    //fn row_separator_func(&self) -> Option<Box_<dyn Fn(&TreeModel, &TreeIter) -> bool + 'static>> {
534    //    unsafe { TODO: call ffi:gtk_combo_box_get_row_separator_func() }
535    //}
536
537    #[doc(alias = "gtk_combo_box_get_row_span_column")]
538    #[doc(alias = "get_row_span_column")]
539    fn row_span_column(&self) -> i32 {
540        unsafe { ffi::gtk_combo_box_get_row_span_column(self.as_ref().to_glib_none().0) }
541    }
542
543    #[doc(alias = "gtk_combo_box_get_wrap_width")]
544    #[doc(alias = "get_wrap_width")]
545    fn wrap_width(&self) -> i32 {
546        unsafe { ffi::gtk_combo_box_get_wrap_width(self.as_ref().to_glib_none().0) }
547    }
548
549    #[doc(alias = "gtk_combo_box_popdown")]
550    fn popdown(&self) {
551        unsafe {
552            ffi::gtk_combo_box_popdown(self.as_ref().to_glib_none().0);
553        }
554    }
555
556    #[doc(alias = "gtk_combo_box_popup")]
557    fn popup(&self) {
558        unsafe {
559            ffi::gtk_combo_box_popup(self.as_ref().to_glib_none().0);
560        }
561    }
562
563    #[doc(alias = "gtk_combo_box_popup_for_device")]
564    fn popup_for_device(&self, device: &gdk::Device) {
565        unsafe {
566            ffi::gtk_combo_box_popup_for_device(
567                self.as_ref().to_glib_none().0,
568                device.to_glib_none().0,
569            );
570        }
571    }
572
573    #[doc(alias = "gtk_combo_box_set_active_id")]
574    fn set_active_id(&self, active_id: Option<&str>) -> bool {
575        unsafe {
576            from_glib(ffi::gtk_combo_box_set_active_id(
577                self.as_ref().to_glib_none().0,
578                active_id.to_glib_none().0,
579            ))
580        }
581    }
582
583    #[doc(alias = "gtk_combo_box_set_active_iter")]
584    fn set_active_iter(&self, iter: Option<&TreeIter>) {
585        unsafe {
586            ffi::gtk_combo_box_set_active_iter(
587                self.as_ref().to_glib_none().0,
588                mut_override(iter.to_glib_none().0),
589            );
590        }
591    }
592
593    #[doc(alias = "gtk_combo_box_set_button_sensitivity")]
594    fn set_button_sensitivity(&self, sensitivity: SensitivityType) {
595        unsafe {
596            ffi::gtk_combo_box_set_button_sensitivity(
597                self.as_ref().to_glib_none().0,
598                sensitivity.into_glib(),
599            );
600        }
601    }
602
603    #[doc(alias = "gtk_combo_box_set_column_span_column")]
604    fn set_column_span_column(&self, column_span: i32) {
605        unsafe {
606            ffi::gtk_combo_box_set_column_span_column(self.as_ref().to_glib_none().0, column_span);
607        }
608    }
609
610    #[doc(alias = "gtk_combo_box_set_entry_text_column")]
611    fn set_entry_text_column(&self, text_column: i32) {
612        unsafe {
613            ffi::gtk_combo_box_set_entry_text_column(self.as_ref().to_glib_none().0, text_column);
614        }
615    }
616
617    #[doc(alias = "gtk_combo_box_set_id_column")]
618    fn set_id_column(&self, id_column: i32) {
619        unsafe {
620            ffi::gtk_combo_box_set_id_column(self.as_ref().to_glib_none().0, id_column);
621        }
622    }
623
624    #[doc(alias = "gtk_combo_box_set_model")]
625    fn set_model(&self, model: Option<&impl IsA<TreeModel>>) {
626        unsafe {
627            ffi::gtk_combo_box_set_model(
628                self.as_ref().to_glib_none().0,
629                model.map(|p| p.as_ref()).to_glib_none().0,
630            );
631        }
632    }
633
634    #[doc(alias = "gtk_combo_box_set_popup_fixed_width")]
635    fn set_popup_fixed_width(&self, fixed: bool) {
636        unsafe {
637            ffi::gtk_combo_box_set_popup_fixed_width(
638                self.as_ref().to_glib_none().0,
639                fixed.into_glib(),
640            );
641        }
642    }
643
644    #[doc(alias = "gtk_combo_box_set_row_separator_func")]
645    fn set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P) {
646        let func_data: Box_<P> = Box_::new(func);
647        unsafe extern "C" fn func_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
648            model: *mut ffi::GtkTreeModel,
649            iter: *mut ffi::GtkTreeIter,
650            data: glib::ffi::gpointer,
651        ) -> glib::ffi::gboolean {
652            let model = from_glib_borrow(model);
653            let iter = from_glib_borrow(iter);
654            let callback: &P = &*(data as *mut _);
655            (*callback)(&model, &iter).into_glib()
656        }
657        let func = Some(func_func::<P> as _);
658        unsafe extern "C" fn destroy_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
659            data: glib::ffi::gpointer,
660        ) {
661            let _callback: Box_<P> = Box_::from_raw(data as *mut _);
662        }
663        let destroy_call3 = Some(destroy_func::<P> as _);
664        let super_callback0: Box_<P> = func_data;
665        unsafe {
666            ffi::gtk_combo_box_set_row_separator_func(
667                self.as_ref().to_glib_none().0,
668                func,
669                Box_::into_raw(super_callback0) as *mut _,
670                destroy_call3,
671            );
672        }
673    }
674
675    #[doc(alias = "gtk_combo_box_set_row_span_column")]
676    fn set_row_span_column(&self, row_span: i32) {
677        unsafe {
678            ffi::gtk_combo_box_set_row_span_column(self.as_ref().to_glib_none().0, row_span);
679        }
680    }
681
682    #[doc(alias = "gtk_combo_box_set_wrap_width")]
683    fn set_wrap_width(&self, width: i32) {
684        unsafe {
685            ffi::gtk_combo_box_set_wrap_width(self.as_ref().to_glib_none().0, width);
686        }
687    }
688
689    #[doc(alias = "cell-area")]
690    fn cell_area(&self) -> Option<CellArea> {
691        ObjectExt::property(self.as_ref(), "cell-area")
692    }
693
694    #[doc(alias = "has-frame")]
695    fn has_frame(&self) -> bool {
696        ObjectExt::property(self.as_ref(), "has-frame")
697    }
698
699    #[doc(alias = "has-frame")]
700    fn set_has_frame(&self, has_frame: bool) {
701        ObjectExt::set_property(self.as_ref(), "has-frame", has_frame)
702    }
703
704    #[doc(alias = "popup-shown")]
705    fn is_popup_shown(&self) -> bool {
706        ObjectExt::property(self.as_ref(), "popup-shown")
707    }
708
709    #[doc(alias = "changed")]
710    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
711        unsafe extern "C" fn changed_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
712            this: *mut ffi::GtkComboBox,
713            f: glib::ffi::gpointer,
714        ) {
715            let f: &F = &*(f as *const F);
716            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
717        }
718        unsafe {
719            let f: Box_<F> = Box_::new(f);
720            connect_raw(
721                self.as_ptr() as *mut _,
722                b"changed\0".as_ptr() as *const _,
723                Some(transmute::<_, unsafe extern "C" fn()>(
724                    changed_trampoline::<Self, F> as *const (),
725                )),
726                Box_::into_raw(f),
727            )
728        }
729    }
730
731    #[doc(alias = "format-entry-text")]
732    fn connect_format_entry_text<F: Fn(&Self, &str) -> String + 'static>(
733        &self,
734        f: F,
735    ) -> SignalHandlerId {
736        unsafe extern "C" fn format_entry_text_trampoline<
737            P: IsA<ComboBox>,
738            F: Fn(&P, &str) -> String + 'static,
739        >(
740            this: *mut ffi::GtkComboBox,
741            path: *mut libc::c_char,
742            f: glib::ffi::gpointer,
743        ) -> *mut libc::c_char {
744            let f: &F = &*(f as *const F);
745            f(
746                ComboBox::from_glib_borrow(this).unsafe_cast_ref(),
747                &glib::GString::from_glib_borrow(path),
748            )
749            .to_glib_full()
750        }
751        unsafe {
752            let f: Box_<F> = Box_::new(f);
753            connect_raw(
754                self.as_ptr() as *mut _,
755                b"format-entry-text\0".as_ptr() as *const _,
756                Some(transmute::<_, unsafe extern "C" fn()>(
757                    format_entry_text_trampoline::<Self, F> as *const (),
758                )),
759                Box_::into_raw(f),
760            )
761        }
762    }
763
764    #[doc(alias = "move-active")]
765    fn connect_move_active<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId {
766        unsafe extern "C" fn move_active_trampoline<
767            P: IsA<ComboBox>,
768            F: Fn(&P, ScrollType) + 'static,
769        >(
770            this: *mut ffi::GtkComboBox,
771            scroll_type: ffi::GtkScrollType,
772            f: glib::ffi::gpointer,
773        ) {
774            let f: &F = &*(f as *const F);
775            f(
776                ComboBox::from_glib_borrow(this).unsafe_cast_ref(),
777                from_glib(scroll_type),
778            )
779        }
780        unsafe {
781            let f: Box_<F> = Box_::new(f);
782            connect_raw(
783                self.as_ptr() as *mut _,
784                b"move-active\0".as_ptr() as *const _,
785                Some(transmute::<_, unsafe extern "C" fn()>(
786                    move_active_trampoline::<Self, F> as *const (),
787                )),
788                Box_::into_raw(f),
789            )
790        }
791    }
792
793    fn emit_move_active(&self, scroll_type: ScrollType) {
794        self.emit_by_name::<()>("move-active", &[&scroll_type]);
795    }
796
797    #[doc(alias = "popdown")]
798    fn connect_popdown<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
799        unsafe extern "C" fn popdown_trampoline<P: IsA<ComboBox>, F: Fn(&P) -> bool + 'static>(
800            this: *mut ffi::GtkComboBox,
801            f: glib::ffi::gpointer,
802        ) -> glib::ffi::gboolean {
803            let f: &F = &*(f as *const F);
804            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
805        }
806        unsafe {
807            let f: Box_<F> = Box_::new(f);
808            connect_raw(
809                self.as_ptr() as *mut _,
810                b"popdown\0".as_ptr() as *const _,
811                Some(transmute::<_, unsafe extern "C" fn()>(
812                    popdown_trampoline::<Self, F> as *const (),
813                )),
814                Box_::into_raw(f),
815            )
816        }
817    }
818
819    fn emit_popdown(&self) -> bool {
820        self.emit_by_name("popdown", &[])
821    }
822
823    #[doc(alias = "popup")]
824    fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
825        unsafe extern "C" fn popup_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
826            this: *mut ffi::GtkComboBox,
827            f: glib::ffi::gpointer,
828        ) {
829            let f: &F = &*(f as *const F);
830            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
831        }
832        unsafe {
833            let f: Box_<F> = Box_::new(f);
834            connect_raw(
835                self.as_ptr() as *mut _,
836                b"popup\0".as_ptr() as *const _,
837                Some(transmute::<_, unsafe extern "C" fn()>(
838                    popup_trampoline::<Self, F> as *const (),
839                )),
840                Box_::into_raw(f),
841            )
842        }
843    }
844
845    fn emit_popup(&self) {
846        self.emit_by_name::<()>("popup", &[]);
847    }
848
849    #[doc(alias = "active")]
850    fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
851        unsafe extern "C" fn notify_active_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
852            this: *mut ffi::GtkComboBox,
853            _param_spec: glib::ffi::gpointer,
854            f: glib::ffi::gpointer,
855        ) {
856            let f: &F = &*(f as *const F);
857            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
858        }
859        unsafe {
860            let f: Box_<F> = Box_::new(f);
861            connect_raw(
862                self.as_ptr() as *mut _,
863                b"notify::active\0".as_ptr() as *const _,
864                Some(transmute::<_, unsafe extern "C" fn()>(
865                    notify_active_trampoline::<Self, F> as *const (),
866                )),
867                Box_::into_raw(f),
868            )
869        }
870    }
871
872    #[doc(alias = "active-id")]
873    fn connect_active_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
874        unsafe extern "C" fn notify_active_id_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
875            this: *mut ffi::GtkComboBox,
876            _param_spec: glib::ffi::gpointer,
877            f: glib::ffi::gpointer,
878        ) {
879            let f: &F = &*(f as *const F);
880            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
881        }
882        unsafe {
883            let f: Box_<F> = Box_::new(f);
884            connect_raw(
885                self.as_ptr() as *mut _,
886                b"notify::active-id\0".as_ptr() as *const _,
887                Some(transmute::<_, unsafe extern "C" fn()>(
888                    notify_active_id_trampoline::<Self, F> as *const (),
889                )),
890                Box_::into_raw(f),
891            )
892        }
893    }
894
895    #[doc(alias = "button-sensitivity")]
896    fn connect_button_sensitivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
897        unsafe extern "C" fn notify_button_sensitivity_trampoline<
898            P: IsA<ComboBox>,
899            F: Fn(&P) + 'static,
900        >(
901            this: *mut ffi::GtkComboBox,
902            _param_spec: glib::ffi::gpointer,
903            f: glib::ffi::gpointer,
904        ) {
905            let f: &F = &*(f as *const F);
906            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
907        }
908        unsafe {
909            let f: Box_<F> = Box_::new(f);
910            connect_raw(
911                self.as_ptr() as *mut _,
912                b"notify::button-sensitivity\0".as_ptr() as *const _,
913                Some(transmute::<_, unsafe extern "C" fn()>(
914                    notify_button_sensitivity_trampoline::<Self, F> as *const (),
915                )),
916                Box_::into_raw(f),
917            )
918        }
919    }
920
921    #[doc(alias = "column-span-column")]
922    fn connect_column_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
923        unsafe extern "C" fn notify_column_span_column_trampoline<
924            P: IsA<ComboBox>,
925            F: Fn(&P) + 'static,
926        >(
927            this: *mut ffi::GtkComboBox,
928            _param_spec: glib::ffi::gpointer,
929            f: glib::ffi::gpointer,
930        ) {
931            let f: &F = &*(f as *const F);
932            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
933        }
934        unsafe {
935            let f: Box_<F> = Box_::new(f);
936            connect_raw(
937                self.as_ptr() as *mut _,
938                b"notify::column-span-column\0".as_ptr() as *const _,
939                Some(transmute::<_, unsafe extern "C" fn()>(
940                    notify_column_span_column_trampoline::<Self, F> as *const (),
941                )),
942                Box_::into_raw(f),
943            )
944        }
945    }
946
947    #[doc(alias = "entry-text-column")]
948    fn connect_entry_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
949        unsafe extern "C" fn notify_entry_text_column_trampoline<
950            P: IsA<ComboBox>,
951            F: Fn(&P) + 'static,
952        >(
953            this: *mut ffi::GtkComboBox,
954            _param_spec: glib::ffi::gpointer,
955            f: glib::ffi::gpointer,
956        ) {
957            let f: &F = &*(f as *const F);
958            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
959        }
960        unsafe {
961            let f: Box_<F> = Box_::new(f);
962            connect_raw(
963                self.as_ptr() as *mut _,
964                b"notify::entry-text-column\0".as_ptr() as *const _,
965                Some(transmute::<_, unsafe extern "C" fn()>(
966                    notify_entry_text_column_trampoline::<Self, F> as *const (),
967                )),
968                Box_::into_raw(f),
969            )
970        }
971    }
972
973    #[doc(alias = "has-frame")]
974    fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
975        unsafe extern "C" fn notify_has_frame_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
976            this: *mut ffi::GtkComboBox,
977            _param_spec: glib::ffi::gpointer,
978            f: glib::ffi::gpointer,
979        ) {
980            let f: &F = &*(f as *const F);
981            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
982        }
983        unsafe {
984            let f: Box_<F> = Box_::new(f);
985            connect_raw(
986                self.as_ptr() as *mut _,
987                b"notify::has-frame\0".as_ptr() as *const _,
988                Some(transmute::<_, unsafe extern "C" fn()>(
989                    notify_has_frame_trampoline::<Self, F> as *const (),
990                )),
991                Box_::into_raw(f),
992            )
993        }
994    }
995
996    #[doc(alias = "id-column")]
997    fn connect_id_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
998        unsafe extern "C" fn notify_id_column_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
999            this: *mut ffi::GtkComboBox,
1000            _param_spec: glib::ffi::gpointer,
1001            f: glib::ffi::gpointer,
1002        ) {
1003            let f: &F = &*(f as *const F);
1004            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1005        }
1006        unsafe {
1007            let f: Box_<F> = Box_::new(f);
1008            connect_raw(
1009                self.as_ptr() as *mut _,
1010                b"notify::id-column\0".as_ptr() as *const _,
1011                Some(transmute::<_, unsafe extern "C" fn()>(
1012                    notify_id_column_trampoline::<Self, F> as *const (),
1013                )),
1014                Box_::into_raw(f),
1015            )
1016        }
1017    }
1018
1019    #[doc(alias = "model")]
1020    fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1021        unsafe extern "C" fn notify_model_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
1022            this: *mut ffi::GtkComboBox,
1023            _param_spec: glib::ffi::gpointer,
1024            f: glib::ffi::gpointer,
1025        ) {
1026            let f: &F = &*(f as *const F);
1027            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1028        }
1029        unsafe {
1030            let f: Box_<F> = Box_::new(f);
1031            connect_raw(
1032                self.as_ptr() as *mut _,
1033                b"notify::model\0".as_ptr() as *const _,
1034                Some(transmute::<_, unsafe extern "C" fn()>(
1035                    notify_model_trampoline::<Self, F> as *const (),
1036                )),
1037                Box_::into_raw(f),
1038            )
1039        }
1040    }
1041
1042    #[doc(alias = "popup-fixed-width")]
1043    fn connect_popup_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1044        unsafe extern "C" fn notify_popup_fixed_width_trampoline<
1045            P: IsA<ComboBox>,
1046            F: Fn(&P) + 'static,
1047        >(
1048            this: *mut ffi::GtkComboBox,
1049            _param_spec: glib::ffi::gpointer,
1050            f: glib::ffi::gpointer,
1051        ) {
1052            let f: &F = &*(f as *const F);
1053            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1054        }
1055        unsafe {
1056            let f: Box_<F> = Box_::new(f);
1057            connect_raw(
1058                self.as_ptr() as *mut _,
1059                b"notify::popup-fixed-width\0".as_ptr() as *const _,
1060                Some(transmute::<_, unsafe extern "C" fn()>(
1061                    notify_popup_fixed_width_trampoline::<Self, F> as *const (),
1062                )),
1063                Box_::into_raw(f),
1064            )
1065        }
1066    }
1067
1068    #[doc(alias = "popup-shown")]
1069    fn connect_popup_shown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1070        unsafe extern "C" fn notify_popup_shown_trampoline<
1071            P: IsA<ComboBox>,
1072            F: Fn(&P) + 'static,
1073        >(
1074            this: *mut ffi::GtkComboBox,
1075            _param_spec: glib::ffi::gpointer,
1076            f: glib::ffi::gpointer,
1077        ) {
1078            let f: &F = &*(f as *const F);
1079            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1080        }
1081        unsafe {
1082            let f: Box_<F> = Box_::new(f);
1083            connect_raw(
1084                self.as_ptr() as *mut _,
1085                b"notify::popup-shown\0".as_ptr() as *const _,
1086                Some(transmute::<_, unsafe extern "C" fn()>(
1087                    notify_popup_shown_trampoline::<Self, F> as *const (),
1088                )),
1089                Box_::into_raw(f),
1090            )
1091        }
1092    }
1093
1094    #[doc(alias = "row-span-column")]
1095    fn connect_row_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1096        unsafe extern "C" fn notify_row_span_column_trampoline<
1097            P: IsA<ComboBox>,
1098            F: Fn(&P) + 'static,
1099        >(
1100            this: *mut ffi::GtkComboBox,
1101            _param_spec: glib::ffi::gpointer,
1102            f: glib::ffi::gpointer,
1103        ) {
1104            let f: &F = &*(f as *const F);
1105            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1106        }
1107        unsafe {
1108            let f: Box_<F> = Box_::new(f);
1109            connect_raw(
1110                self.as_ptr() as *mut _,
1111                b"notify::row-span-column\0".as_ptr() as *const _,
1112                Some(transmute::<_, unsafe extern "C" fn()>(
1113                    notify_row_span_column_trampoline::<Self, F> as *const (),
1114                )),
1115                Box_::into_raw(f),
1116            )
1117        }
1118    }
1119
1120    #[doc(alias = "wrap-width")]
1121    fn connect_wrap_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1122        unsafe extern "C" fn notify_wrap_width_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
1123            this: *mut ffi::GtkComboBox,
1124            _param_spec: glib::ffi::gpointer,
1125            f: glib::ffi::gpointer,
1126        ) {
1127            let f: &F = &*(f as *const F);
1128            f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1129        }
1130        unsafe {
1131            let f: Box_<F> = Box_::new(f);
1132            connect_raw(
1133                self.as_ptr() as *mut _,
1134                b"notify::wrap-width\0".as_ptr() as *const _,
1135                Some(transmute::<_, unsafe extern "C" fn()>(
1136                    notify_wrap_width_trampoline::<Self, F> as *const (),
1137                )),
1138                Box_::into_raw(f),
1139            )
1140        }
1141    }
1142}
1143
1144impl<O: IsA<ComboBox>> ComboBoxExt for O {}
1145
1146impl fmt::Display for ComboBox {
1147    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1148        f.write_str("ComboBox")
1149    }
1150}