gtk/auto/
calendar.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 glib::object::Cast;
7use glib::object::IsA;
8use glib::signal::connect_raw;
9use glib::signal::SignalHandlerId;
10use glib::translate::*;
11use glib::GString;
12use glib::StaticType;
13use glib::ToValue;
14use glib::Value;
15use glib_sys;
16use gobject_sys;
17use gtk_sys;
18use std::boxed::Box as Box_;
19use std::fmt;
20use std::mem;
21use std::mem::transmute;
22use Align;
23use Buildable;
24use CalendarDisplayOptions;
25use Container;
26use Widget;
27
28glib_wrapper! {
29    pub struct Calendar(Object<gtk_sys::GtkCalendar, gtk_sys::GtkCalendarClass, CalendarClass>) @extends Widget, @implements Buildable;
30
31    match fn {
32        get_type => || gtk_sys::gtk_calendar_get_type(),
33    }
34}
35
36impl Calendar {
37    pub fn new() -> Calendar {
38        assert_initialized_main_thread!();
39        unsafe { Widget::from_glib_none(gtk_sys::gtk_calendar_new()).unsafe_cast() }
40    }
41}
42
43impl Default for Calendar {
44    fn default() -> Self {
45        Self::new()
46    }
47}
48
49pub struct CalendarBuilder {
50    day: Option<i32>,
51    detail_height_rows: Option<i32>,
52    detail_width_chars: Option<i32>,
53    month: Option<i32>,
54    no_month_change: Option<bool>,
55    show_day_names: Option<bool>,
56    show_details: Option<bool>,
57    show_heading: Option<bool>,
58    show_week_numbers: Option<bool>,
59    year: Option<i32>,
60    app_paintable: Option<bool>,
61    can_default: Option<bool>,
62    can_focus: Option<bool>,
63    events: Option<gdk::EventMask>,
64    expand: Option<bool>,
65    #[cfg(any(feature = "v3_20", feature = "dox"))]
66    focus_on_click: Option<bool>,
67    halign: Option<Align>,
68    has_default: Option<bool>,
69    has_focus: Option<bool>,
70    has_tooltip: Option<bool>,
71    height_request: Option<i32>,
72    hexpand: Option<bool>,
73    hexpand_set: Option<bool>,
74    is_focus: Option<bool>,
75    margin: Option<i32>,
76    margin_bottom: Option<i32>,
77    margin_end: Option<i32>,
78    margin_start: Option<i32>,
79    margin_top: Option<i32>,
80    name: Option<String>,
81    no_show_all: Option<bool>,
82    opacity: Option<f64>,
83    parent: Option<Container>,
84    receives_default: Option<bool>,
85    sensitive: Option<bool>,
86    //style: /*Unknown type*/,
87    tooltip_markup: Option<String>,
88    tooltip_text: Option<String>,
89    valign: Option<Align>,
90    vexpand: Option<bool>,
91    vexpand_set: Option<bool>,
92    visible: Option<bool>,
93    width_request: Option<i32>,
94}
95
96impl CalendarBuilder {
97    pub fn new() -> Self {
98        Self {
99            day: None,
100            detail_height_rows: None,
101            detail_width_chars: None,
102            month: None,
103            no_month_change: None,
104            show_day_names: None,
105            show_details: None,
106            show_heading: None,
107            show_week_numbers: None,
108            year: None,
109            app_paintable: None,
110            can_default: None,
111            can_focus: None,
112            events: None,
113            expand: None,
114            #[cfg(any(feature = "v3_20", feature = "dox"))]
115            focus_on_click: None,
116            halign: None,
117            has_default: None,
118            has_focus: None,
119            has_tooltip: None,
120            height_request: None,
121            hexpand: None,
122            hexpand_set: None,
123            is_focus: None,
124            margin: None,
125            margin_bottom: None,
126            margin_end: None,
127            margin_start: None,
128            margin_top: None,
129            name: None,
130            no_show_all: None,
131            opacity: None,
132            parent: None,
133            receives_default: None,
134            sensitive: None,
135            tooltip_markup: None,
136            tooltip_text: None,
137            valign: None,
138            vexpand: None,
139            vexpand_set: None,
140            visible: None,
141            width_request: None,
142        }
143    }
144
145    pub fn build(self) -> Calendar {
146        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
147        if let Some(ref day) = self.day {
148            properties.push(("day", day));
149        }
150        if let Some(ref detail_height_rows) = self.detail_height_rows {
151            properties.push(("detail-height-rows", detail_height_rows));
152        }
153        if let Some(ref detail_width_chars) = self.detail_width_chars {
154            properties.push(("detail-width-chars", detail_width_chars));
155        }
156        if let Some(ref month) = self.month {
157            properties.push(("month", month));
158        }
159        if let Some(ref no_month_change) = self.no_month_change {
160            properties.push(("no-month-change", no_month_change));
161        }
162        if let Some(ref show_day_names) = self.show_day_names {
163            properties.push(("show-day-names", show_day_names));
164        }
165        if let Some(ref show_details) = self.show_details {
166            properties.push(("show-details", show_details));
167        }
168        if let Some(ref show_heading) = self.show_heading {
169            properties.push(("show-heading", show_heading));
170        }
171        if let Some(ref show_week_numbers) = self.show_week_numbers {
172            properties.push(("show-week-numbers", show_week_numbers));
173        }
174        if let Some(ref year) = self.year {
175            properties.push(("year", year));
176        }
177        if let Some(ref app_paintable) = self.app_paintable {
178            properties.push(("app-paintable", app_paintable));
179        }
180        if let Some(ref can_default) = self.can_default {
181            properties.push(("can-default", can_default));
182        }
183        if let Some(ref can_focus) = self.can_focus {
184            properties.push(("can-focus", can_focus));
185        }
186        if let Some(ref events) = self.events {
187            properties.push(("events", events));
188        }
189        if let Some(ref expand) = self.expand {
190            properties.push(("expand", expand));
191        }
192        #[cfg(any(feature = "v3_20", feature = "dox"))]
193        {
194            if let Some(ref focus_on_click) = self.focus_on_click {
195                properties.push(("focus-on-click", focus_on_click));
196            }
197        }
198        if let Some(ref halign) = self.halign {
199            properties.push(("halign", halign));
200        }
201        if let Some(ref has_default) = self.has_default {
202            properties.push(("has-default", has_default));
203        }
204        if let Some(ref has_focus) = self.has_focus {
205            properties.push(("has-focus", has_focus));
206        }
207        if let Some(ref has_tooltip) = self.has_tooltip {
208            properties.push(("has-tooltip", has_tooltip));
209        }
210        if let Some(ref height_request) = self.height_request {
211            properties.push(("height-request", height_request));
212        }
213        if let Some(ref hexpand) = self.hexpand {
214            properties.push(("hexpand", hexpand));
215        }
216        if let Some(ref hexpand_set) = self.hexpand_set {
217            properties.push(("hexpand-set", hexpand_set));
218        }
219        if let Some(ref is_focus) = self.is_focus {
220            properties.push(("is-focus", is_focus));
221        }
222        if let Some(ref margin) = self.margin {
223            properties.push(("margin", margin));
224        }
225        if let Some(ref margin_bottom) = self.margin_bottom {
226            properties.push(("margin-bottom", margin_bottom));
227        }
228        if let Some(ref margin_end) = self.margin_end {
229            properties.push(("margin-end", margin_end));
230        }
231        if let Some(ref margin_start) = self.margin_start {
232            properties.push(("margin-start", margin_start));
233        }
234        if let Some(ref margin_top) = self.margin_top {
235            properties.push(("margin-top", margin_top));
236        }
237        if let Some(ref name) = self.name {
238            properties.push(("name", name));
239        }
240        if let Some(ref no_show_all) = self.no_show_all {
241            properties.push(("no-show-all", no_show_all));
242        }
243        if let Some(ref opacity) = self.opacity {
244            properties.push(("opacity", opacity));
245        }
246        if let Some(ref parent) = self.parent {
247            properties.push(("parent", parent));
248        }
249        if let Some(ref receives_default) = self.receives_default {
250            properties.push(("receives-default", receives_default));
251        }
252        if let Some(ref sensitive) = self.sensitive {
253            properties.push(("sensitive", sensitive));
254        }
255        if let Some(ref tooltip_markup) = self.tooltip_markup {
256            properties.push(("tooltip-markup", tooltip_markup));
257        }
258        if let Some(ref tooltip_text) = self.tooltip_text {
259            properties.push(("tooltip-text", tooltip_text));
260        }
261        if let Some(ref valign) = self.valign {
262            properties.push(("valign", valign));
263        }
264        if let Some(ref vexpand) = self.vexpand {
265            properties.push(("vexpand", vexpand));
266        }
267        if let Some(ref vexpand_set) = self.vexpand_set {
268            properties.push(("vexpand-set", vexpand_set));
269        }
270        if let Some(ref visible) = self.visible {
271            properties.push(("visible", visible));
272        }
273        if let Some(ref width_request) = self.width_request {
274            properties.push(("width-request", width_request));
275        }
276        glib::Object::new(Calendar::static_type(), &properties)
277            .expect("object new")
278            .downcast()
279            .expect("downcast")
280    }
281
282    pub fn day(mut self, day: i32) -> Self {
283        self.day = Some(day);
284        self
285    }
286
287    pub fn detail_height_rows(mut self, detail_height_rows: i32) -> Self {
288        self.detail_height_rows = Some(detail_height_rows);
289        self
290    }
291
292    pub fn detail_width_chars(mut self, detail_width_chars: i32) -> Self {
293        self.detail_width_chars = Some(detail_width_chars);
294        self
295    }
296
297    pub fn month(mut self, month: i32) -> Self {
298        self.month = Some(month);
299        self
300    }
301
302    pub fn no_month_change(mut self, no_month_change: bool) -> Self {
303        self.no_month_change = Some(no_month_change);
304        self
305    }
306
307    pub fn show_day_names(mut self, show_day_names: bool) -> Self {
308        self.show_day_names = Some(show_day_names);
309        self
310    }
311
312    pub fn show_details(mut self, show_details: bool) -> Self {
313        self.show_details = Some(show_details);
314        self
315    }
316
317    pub fn show_heading(mut self, show_heading: bool) -> Self {
318        self.show_heading = Some(show_heading);
319        self
320    }
321
322    pub fn show_week_numbers(mut self, show_week_numbers: bool) -> Self {
323        self.show_week_numbers = Some(show_week_numbers);
324        self
325    }
326
327    pub fn year(mut self, year: i32) -> Self {
328        self.year = Some(year);
329        self
330    }
331
332    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
333        self.app_paintable = Some(app_paintable);
334        self
335    }
336
337    pub fn can_default(mut self, can_default: bool) -> Self {
338        self.can_default = Some(can_default);
339        self
340    }
341
342    pub fn can_focus(mut self, can_focus: bool) -> Self {
343        self.can_focus = Some(can_focus);
344        self
345    }
346
347    pub fn events(mut self, events: gdk::EventMask) -> Self {
348        self.events = Some(events);
349        self
350    }
351
352    pub fn expand(mut self, expand: bool) -> Self {
353        self.expand = Some(expand);
354        self
355    }
356
357    #[cfg(any(feature = "v3_20", feature = "dox"))]
358    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
359        self.focus_on_click = Some(focus_on_click);
360        self
361    }
362
363    pub fn halign(mut self, halign: Align) -> Self {
364        self.halign = Some(halign);
365        self
366    }
367
368    pub fn has_default(mut self, has_default: bool) -> Self {
369        self.has_default = Some(has_default);
370        self
371    }
372
373    pub fn has_focus(mut self, has_focus: bool) -> Self {
374        self.has_focus = Some(has_focus);
375        self
376    }
377
378    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
379        self.has_tooltip = Some(has_tooltip);
380        self
381    }
382
383    pub fn height_request(mut self, height_request: i32) -> Self {
384        self.height_request = Some(height_request);
385        self
386    }
387
388    pub fn hexpand(mut self, hexpand: bool) -> Self {
389        self.hexpand = Some(hexpand);
390        self
391    }
392
393    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
394        self.hexpand_set = Some(hexpand_set);
395        self
396    }
397
398    pub fn is_focus(mut self, is_focus: bool) -> Self {
399        self.is_focus = Some(is_focus);
400        self
401    }
402
403    pub fn margin(mut self, margin: i32) -> Self {
404        self.margin = Some(margin);
405        self
406    }
407
408    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
409        self.margin_bottom = Some(margin_bottom);
410        self
411    }
412
413    pub fn margin_end(mut self, margin_end: i32) -> Self {
414        self.margin_end = Some(margin_end);
415        self
416    }
417
418    pub fn margin_start(mut self, margin_start: i32) -> Self {
419        self.margin_start = Some(margin_start);
420        self
421    }
422
423    pub fn margin_top(mut self, margin_top: i32) -> Self {
424        self.margin_top = Some(margin_top);
425        self
426    }
427
428    pub fn name(mut self, name: &str) -> Self {
429        self.name = Some(name.to_string());
430        self
431    }
432
433    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
434        self.no_show_all = Some(no_show_all);
435        self
436    }
437
438    pub fn opacity(mut self, opacity: f64) -> Self {
439        self.opacity = Some(opacity);
440        self
441    }
442
443    pub fn parent(mut self, parent: &Container) -> Self {
444        self.parent = Some(parent.clone());
445        self
446    }
447
448    pub fn receives_default(mut self, receives_default: bool) -> Self {
449        self.receives_default = Some(receives_default);
450        self
451    }
452
453    pub fn sensitive(mut self, sensitive: bool) -> Self {
454        self.sensitive = Some(sensitive);
455        self
456    }
457
458    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
459        self.tooltip_markup = Some(tooltip_markup.to_string());
460        self
461    }
462
463    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
464        self.tooltip_text = Some(tooltip_text.to_string());
465        self
466    }
467
468    pub fn valign(mut self, valign: Align) -> Self {
469        self.valign = Some(valign);
470        self
471    }
472
473    pub fn vexpand(mut self, vexpand: bool) -> Self {
474        self.vexpand = Some(vexpand);
475        self
476    }
477
478    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
479        self.vexpand_set = Some(vexpand_set);
480        self
481    }
482
483    pub fn visible(mut self, visible: bool) -> Self {
484        self.visible = Some(visible);
485        self
486    }
487
488    pub fn width_request(mut self, width_request: i32) -> Self {
489        self.width_request = Some(width_request);
490        self
491    }
492}
493
494pub const NONE_CALENDAR: Option<&Calendar> = None;
495
496pub trait CalendarExt: 'static {
497    fn clear_marks(&self);
498
499    fn get_date(&self) -> (u32, u32, u32);
500
501    fn get_day_is_marked(&self, day: u32) -> bool;
502
503    fn get_detail_height_rows(&self) -> i32;
504
505    fn get_detail_width_chars(&self) -> i32;
506
507    fn get_display_options(&self) -> CalendarDisplayOptions;
508
509    fn mark_day(&self, day: u32);
510
511    fn select_day(&self, day: u32);
512
513    fn select_month(&self, month: u32, year: u32);
514
515    fn set_detail_func<P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static>(&self, func: P);
516
517    fn set_detail_height_rows(&self, rows: i32);
518
519    fn set_detail_width_chars(&self, chars: i32);
520
521    fn set_display_options(&self, flags: CalendarDisplayOptions);
522
523    fn unmark_day(&self, day: u32);
524
525    fn get_property_day(&self) -> i32;
526
527    fn set_property_day(&self, day: i32);
528
529    fn get_property_month(&self) -> i32;
530
531    fn set_property_month(&self, month: i32);
532
533    fn get_property_no_month_change(&self) -> bool;
534
535    fn set_property_no_month_change(&self, no_month_change: bool);
536
537    fn get_property_show_day_names(&self) -> bool;
538
539    fn set_property_show_day_names(&self, show_day_names: bool);
540
541    fn get_property_show_details(&self) -> bool;
542
543    fn set_property_show_details(&self, show_details: bool);
544
545    fn get_property_show_heading(&self) -> bool;
546
547    fn set_property_show_heading(&self, show_heading: bool);
548
549    fn get_property_show_week_numbers(&self) -> bool;
550
551    fn set_property_show_week_numbers(&self, show_week_numbers: bool);
552
553    fn get_property_year(&self) -> i32;
554
555    fn set_property_year(&self, year: i32);
556
557    fn connect_day_selected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
558
559    fn connect_day_selected_double_click<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
560
561    fn connect_month_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
562
563    fn connect_next_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
564
565    fn connect_next_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
566
567    fn connect_prev_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
568
569    fn connect_prev_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
570
571    fn connect_property_day_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
572
573    fn connect_property_detail_height_rows_notify<F: Fn(&Self) + 'static>(
574        &self,
575        f: F,
576    ) -> SignalHandlerId;
577
578    fn connect_property_detail_width_chars_notify<F: Fn(&Self) + 'static>(
579        &self,
580        f: F,
581    ) -> SignalHandlerId;
582
583    fn connect_property_month_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
584
585    fn connect_property_no_month_change_notify<F: Fn(&Self) + 'static>(
586        &self,
587        f: F,
588    ) -> SignalHandlerId;
589
590    fn connect_property_show_day_names_notify<F: Fn(&Self) + 'static>(
591        &self,
592        f: F,
593    ) -> SignalHandlerId;
594
595    fn connect_property_show_details_notify<F: Fn(&Self) + 'static>(&self, f: F)
596        -> SignalHandlerId;
597
598    fn connect_property_show_heading_notify<F: Fn(&Self) + 'static>(&self, f: F)
599        -> SignalHandlerId;
600
601    fn connect_property_show_week_numbers_notify<F: Fn(&Self) + 'static>(
602        &self,
603        f: F,
604    ) -> SignalHandlerId;
605
606    fn connect_property_year_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
607}
608
609impl<O: IsA<Calendar>> CalendarExt for O {
610    fn clear_marks(&self) {
611        unsafe {
612            gtk_sys::gtk_calendar_clear_marks(self.as_ref().to_glib_none().0);
613        }
614    }
615
616    fn get_date(&self) -> (u32, u32, u32) {
617        unsafe {
618            let mut year = mem::uninitialized();
619            let mut month = mem::uninitialized();
620            let mut day = mem::uninitialized();
621            gtk_sys::gtk_calendar_get_date(
622                self.as_ref().to_glib_none().0,
623                &mut year,
624                &mut month,
625                &mut day,
626            );
627            (year, month, day)
628        }
629    }
630
631    fn get_day_is_marked(&self, day: u32) -> bool {
632        unsafe {
633            from_glib(gtk_sys::gtk_calendar_get_day_is_marked(
634                self.as_ref().to_glib_none().0,
635                day,
636            ))
637        }
638    }
639
640    fn get_detail_height_rows(&self) -> i32 {
641        unsafe { gtk_sys::gtk_calendar_get_detail_height_rows(self.as_ref().to_glib_none().0) }
642    }
643
644    fn get_detail_width_chars(&self) -> i32 {
645        unsafe { gtk_sys::gtk_calendar_get_detail_width_chars(self.as_ref().to_glib_none().0) }
646    }
647
648    fn get_display_options(&self) -> CalendarDisplayOptions {
649        unsafe {
650            from_glib(gtk_sys::gtk_calendar_get_display_options(
651                self.as_ref().to_glib_none().0,
652            ))
653        }
654    }
655
656    fn mark_day(&self, day: u32) {
657        unsafe {
658            gtk_sys::gtk_calendar_mark_day(self.as_ref().to_glib_none().0, day);
659        }
660    }
661
662    fn select_day(&self, day: u32) {
663        unsafe {
664            gtk_sys::gtk_calendar_select_day(self.as_ref().to_glib_none().0, day);
665        }
666    }
667
668    fn select_month(&self, month: u32, year: u32) {
669        unsafe {
670            gtk_sys::gtk_calendar_select_month(self.as_ref().to_glib_none().0, month, year);
671        }
672    }
673
674    fn set_detail_func<P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static>(
675        &self,
676        func: P,
677    ) {
678        let func_data: Box_<P> = Box::new(func);
679        unsafe extern "C" fn func_func<
680            P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static,
681        >(
682            calendar: *mut gtk_sys::GtkCalendar,
683            year: libc::c_uint,
684            month: libc::c_uint,
685            day: libc::c_uint,
686            user_data: glib_sys::gpointer,
687        ) -> *mut libc::c_char {
688            let calendar = from_glib_borrow(calendar);
689            let callback: &P = &*(user_data as *mut _);
690            let res = (*callback)(&calendar, year, month, day);
691            res.to_glib_full()
692        }
693        let func = Some(func_func::<P> as _);
694        unsafe extern "C" fn destroy_func<
695            P: Fn(&Calendar, u32, u32, u32) -> Option<String> + 'static,
696        >(
697            data: glib_sys::gpointer,
698        ) {
699            let _callback: Box_<P> = Box_::from_raw(data as *mut _);
700        }
701        let destroy_call3 = Some(destroy_func::<P> as _);
702        let super_callback0: Box_<P> = func_data;
703        unsafe {
704            gtk_sys::gtk_calendar_set_detail_func(
705                self.as_ref().to_glib_none().0,
706                func,
707                Box::into_raw(super_callback0) as *mut _,
708                destroy_call3,
709            );
710        }
711    }
712
713    fn set_detail_height_rows(&self, rows: i32) {
714        unsafe {
715            gtk_sys::gtk_calendar_set_detail_height_rows(self.as_ref().to_glib_none().0, rows);
716        }
717    }
718
719    fn set_detail_width_chars(&self, chars: i32) {
720        unsafe {
721            gtk_sys::gtk_calendar_set_detail_width_chars(self.as_ref().to_glib_none().0, chars);
722        }
723    }
724
725    fn set_display_options(&self, flags: CalendarDisplayOptions) {
726        unsafe {
727            gtk_sys::gtk_calendar_set_display_options(
728                self.as_ref().to_glib_none().0,
729                flags.to_glib(),
730            );
731        }
732    }
733
734    fn unmark_day(&self, day: u32) {
735        unsafe {
736            gtk_sys::gtk_calendar_unmark_day(self.as_ref().to_glib_none().0, day);
737        }
738    }
739
740    fn get_property_day(&self) -> i32 {
741        unsafe {
742            let mut value = Value::from_type(<i32 as StaticType>::static_type());
743            gobject_sys::g_object_get_property(
744                self.to_glib_none().0 as *mut gobject_sys::GObject,
745                b"day\0".as_ptr() as *const _,
746                value.to_glib_none_mut().0,
747            );
748            value.get().unwrap()
749        }
750    }
751
752    fn set_property_day(&self, day: i32) {
753        unsafe {
754            gobject_sys::g_object_set_property(
755                self.to_glib_none().0 as *mut gobject_sys::GObject,
756                b"day\0".as_ptr() as *const _,
757                Value::from(&day).to_glib_none().0,
758            );
759        }
760    }
761
762    fn get_property_month(&self) -> i32 {
763        unsafe {
764            let mut value = Value::from_type(<i32 as StaticType>::static_type());
765            gobject_sys::g_object_get_property(
766                self.to_glib_none().0 as *mut gobject_sys::GObject,
767                b"month\0".as_ptr() as *const _,
768                value.to_glib_none_mut().0,
769            );
770            value.get().unwrap()
771        }
772    }
773
774    fn set_property_month(&self, month: i32) {
775        unsafe {
776            gobject_sys::g_object_set_property(
777                self.to_glib_none().0 as *mut gobject_sys::GObject,
778                b"month\0".as_ptr() as *const _,
779                Value::from(&month).to_glib_none().0,
780            );
781        }
782    }
783
784    fn get_property_no_month_change(&self) -> bool {
785        unsafe {
786            let mut value = Value::from_type(<bool as StaticType>::static_type());
787            gobject_sys::g_object_get_property(
788                self.to_glib_none().0 as *mut gobject_sys::GObject,
789                b"no-month-change\0".as_ptr() as *const _,
790                value.to_glib_none_mut().0,
791            );
792            value.get().unwrap()
793        }
794    }
795
796    fn set_property_no_month_change(&self, no_month_change: bool) {
797        unsafe {
798            gobject_sys::g_object_set_property(
799                self.to_glib_none().0 as *mut gobject_sys::GObject,
800                b"no-month-change\0".as_ptr() as *const _,
801                Value::from(&no_month_change).to_glib_none().0,
802            );
803        }
804    }
805
806    fn get_property_show_day_names(&self) -> bool {
807        unsafe {
808            let mut value = Value::from_type(<bool as StaticType>::static_type());
809            gobject_sys::g_object_get_property(
810                self.to_glib_none().0 as *mut gobject_sys::GObject,
811                b"show-day-names\0".as_ptr() as *const _,
812                value.to_glib_none_mut().0,
813            );
814            value.get().unwrap()
815        }
816    }
817
818    fn set_property_show_day_names(&self, show_day_names: bool) {
819        unsafe {
820            gobject_sys::g_object_set_property(
821                self.to_glib_none().0 as *mut gobject_sys::GObject,
822                b"show-day-names\0".as_ptr() as *const _,
823                Value::from(&show_day_names).to_glib_none().0,
824            );
825        }
826    }
827
828    fn get_property_show_details(&self) -> bool {
829        unsafe {
830            let mut value = Value::from_type(<bool as StaticType>::static_type());
831            gobject_sys::g_object_get_property(
832                self.to_glib_none().0 as *mut gobject_sys::GObject,
833                b"show-details\0".as_ptr() as *const _,
834                value.to_glib_none_mut().0,
835            );
836            value.get().unwrap()
837        }
838    }
839
840    fn set_property_show_details(&self, show_details: bool) {
841        unsafe {
842            gobject_sys::g_object_set_property(
843                self.to_glib_none().0 as *mut gobject_sys::GObject,
844                b"show-details\0".as_ptr() as *const _,
845                Value::from(&show_details).to_glib_none().0,
846            );
847        }
848    }
849
850    fn get_property_show_heading(&self) -> bool {
851        unsafe {
852            let mut value = Value::from_type(<bool as StaticType>::static_type());
853            gobject_sys::g_object_get_property(
854                self.to_glib_none().0 as *mut gobject_sys::GObject,
855                b"show-heading\0".as_ptr() as *const _,
856                value.to_glib_none_mut().0,
857            );
858            value.get().unwrap()
859        }
860    }
861
862    fn set_property_show_heading(&self, show_heading: bool) {
863        unsafe {
864            gobject_sys::g_object_set_property(
865                self.to_glib_none().0 as *mut gobject_sys::GObject,
866                b"show-heading\0".as_ptr() as *const _,
867                Value::from(&show_heading).to_glib_none().0,
868            );
869        }
870    }
871
872    fn get_property_show_week_numbers(&self) -> bool {
873        unsafe {
874            let mut value = Value::from_type(<bool as StaticType>::static_type());
875            gobject_sys::g_object_get_property(
876                self.to_glib_none().0 as *mut gobject_sys::GObject,
877                b"show-week-numbers\0".as_ptr() as *const _,
878                value.to_glib_none_mut().0,
879            );
880            value.get().unwrap()
881        }
882    }
883
884    fn set_property_show_week_numbers(&self, show_week_numbers: bool) {
885        unsafe {
886            gobject_sys::g_object_set_property(
887                self.to_glib_none().0 as *mut gobject_sys::GObject,
888                b"show-week-numbers\0".as_ptr() as *const _,
889                Value::from(&show_week_numbers).to_glib_none().0,
890            );
891        }
892    }
893
894    fn get_property_year(&self) -> i32 {
895        unsafe {
896            let mut value = Value::from_type(<i32 as StaticType>::static_type());
897            gobject_sys::g_object_get_property(
898                self.to_glib_none().0 as *mut gobject_sys::GObject,
899                b"year\0".as_ptr() as *const _,
900                value.to_glib_none_mut().0,
901            );
902            value.get().unwrap()
903        }
904    }
905
906    fn set_property_year(&self, year: i32) {
907        unsafe {
908            gobject_sys::g_object_set_property(
909                self.to_glib_none().0 as *mut gobject_sys::GObject,
910                b"year\0".as_ptr() as *const _,
911                Value::from(&year).to_glib_none().0,
912            );
913        }
914    }
915
916    fn connect_day_selected<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
917        unsafe extern "C" fn day_selected_trampoline<P, F: Fn(&P) + 'static>(
918            this: *mut gtk_sys::GtkCalendar,
919            f: glib_sys::gpointer,
920        ) where
921            P: IsA<Calendar>,
922        {
923            let f: &F = &*(f as *const F);
924            f(&Calendar::from_glib_borrow(this).unsafe_cast())
925        }
926        unsafe {
927            let f: Box_<F> = Box_::new(f);
928            connect_raw(
929                self.as_ptr() as *mut _,
930                b"day-selected\0".as_ptr() as *const _,
931                Some(transmute(day_selected_trampoline::<Self, F> as usize)),
932                Box_::into_raw(f),
933            )
934        }
935    }
936
937    fn connect_day_selected_double_click<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
938        unsafe extern "C" fn day_selected_double_click_trampoline<P, F: Fn(&P) + 'static>(
939            this: *mut gtk_sys::GtkCalendar,
940            f: glib_sys::gpointer,
941        ) where
942            P: IsA<Calendar>,
943        {
944            let f: &F = &*(f as *const F);
945            f(&Calendar::from_glib_borrow(this).unsafe_cast())
946        }
947        unsafe {
948            let f: Box_<F> = Box_::new(f);
949            connect_raw(
950                self.as_ptr() as *mut _,
951                b"day-selected-double-click\0".as_ptr() as *const _,
952                Some(transmute(
953                    day_selected_double_click_trampoline::<Self, F> as usize,
954                )),
955                Box_::into_raw(f),
956            )
957        }
958    }
959
960    fn connect_month_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
961        unsafe extern "C" fn month_changed_trampoline<P, F: Fn(&P) + 'static>(
962            this: *mut gtk_sys::GtkCalendar,
963            f: glib_sys::gpointer,
964        ) where
965            P: IsA<Calendar>,
966        {
967            let f: &F = &*(f as *const F);
968            f(&Calendar::from_glib_borrow(this).unsafe_cast())
969        }
970        unsafe {
971            let f: Box_<F> = Box_::new(f);
972            connect_raw(
973                self.as_ptr() as *mut _,
974                b"month-changed\0".as_ptr() as *const _,
975                Some(transmute(month_changed_trampoline::<Self, F> as usize)),
976                Box_::into_raw(f),
977            )
978        }
979    }
980
981    fn connect_next_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
982        unsafe extern "C" fn next_month_trampoline<P, F: Fn(&P) + 'static>(
983            this: *mut gtk_sys::GtkCalendar,
984            f: glib_sys::gpointer,
985        ) where
986            P: IsA<Calendar>,
987        {
988            let f: &F = &*(f as *const F);
989            f(&Calendar::from_glib_borrow(this).unsafe_cast())
990        }
991        unsafe {
992            let f: Box_<F> = Box_::new(f);
993            connect_raw(
994                self.as_ptr() as *mut _,
995                b"next-month\0".as_ptr() as *const _,
996                Some(transmute(next_month_trampoline::<Self, F> as usize)),
997                Box_::into_raw(f),
998            )
999        }
1000    }
1001
1002    fn connect_next_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1003        unsafe extern "C" fn next_year_trampoline<P, F: Fn(&P) + 'static>(
1004            this: *mut gtk_sys::GtkCalendar,
1005            f: glib_sys::gpointer,
1006        ) where
1007            P: IsA<Calendar>,
1008        {
1009            let f: &F = &*(f as *const F);
1010            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1011        }
1012        unsafe {
1013            let f: Box_<F> = Box_::new(f);
1014            connect_raw(
1015                self.as_ptr() as *mut _,
1016                b"next-year\0".as_ptr() as *const _,
1017                Some(transmute(next_year_trampoline::<Self, F> as usize)),
1018                Box_::into_raw(f),
1019            )
1020        }
1021    }
1022
1023    fn connect_prev_month<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1024        unsafe extern "C" fn prev_month_trampoline<P, F: Fn(&P) + 'static>(
1025            this: *mut gtk_sys::GtkCalendar,
1026            f: glib_sys::gpointer,
1027        ) where
1028            P: IsA<Calendar>,
1029        {
1030            let f: &F = &*(f as *const F);
1031            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1032        }
1033        unsafe {
1034            let f: Box_<F> = Box_::new(f);
1035            connect_raw(
1036                self.as_ptr() as *mut _,
1037                b"prev-month\0".as_ptr() as *const _,
1038                Some(transmute(prev_month_trampoline::<Self, F> as usize)),
1039                Box_::into_raw(f),
1040            )
1041        }
1042    }
1043
1044    fn connect_prev_year<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1045        unsafe extern "C" fn prev_year_trampoline<P, F: Fn(&P) + 'static>(
1046            this: *mut gtk_sys::GtkCalendar,
1047            f: glib_sys::gpointer,
1048        ) where
1049            P: IsA<Calendar>,
1050        {
1051            let f: &F = &*(f as *const F);
1052            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1053        }
1054        unsafe {
1055            let f: Box_<F> = Box_::new(f);
1056            connect_raw(
1057                self.as_ptr() as *mut _,
1058                b"prev-year\0".as_ptr() as *const _,
1059                Some(transmute(prev_year_trampoline::<Self, F> as usize)),
1060                Box_::into_raw(f),
1061            )
1062        }
1063    }
1064
1065    fn connect_property_day_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1066        unsafe extern "C" fn notify_day_trampoline<P, F: Fn(&P) + 'static>(
1067            this: *mut gtk_sys::GtkCalendar,
1068            _param_spec: glib_sys::gpointer,
1069            f: glib_sys::gpointer,
1070        ) where
1071            P: IsA<Calendar>,
1072        {
1073            let f: &F = &*(f as *const F);
1074            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1075        }
1076        unsafe {
1077            let f: Box_<F> = Box_::new(f);
1078            connect_raw(
1079                self.as_ptr() as *mut _,
1080                b"notify::day\0".as_ptr() as *const _,
1081                Some(transmute(notify_day_trampoline::<Self, F> as usize)),
1082                Box_::into_raw(f),
1083            )
1084        }
1085    }
1086
1087    fn connect_property_detail_height_rows_notify<F: Fn(&Self) + 'static>(
1088        &self,
1089        f: F,
1090    ) -> SignalHandlerId {
1091        unsafe extern "C" fn notify_detail_height_rows_trampoline<P, F: Fn(&P) + 'static>(
1092            this: *mut gtk_sys::GtkCalendar,
1093            _param_spec: glib_sys::gpointer,
1094            f: glib_sys::gpointer,
1095        ) where
1096            P: IsA<Calendar>,
1097        {
1098            let f: &F = &*(f as *const F);
1099            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1100        }
1101        unsafe {
1102            let f: Box_<F> = Box_::new(f);
1103            connect_raw(
1104                self.as_ptr() as *mut _,
1105                b"notify::detail-height-rows\0".as_ptr() as *const _,
1106                Some(transmute(
1107                    notify_detail_height_rows_trampoline::<Self, F> as usize,
1108                )),
1109                Box_::into_raw(f),
1110            )
1111        }
1112    }
1113
1114    fn connect_property_detail_width_chars_notify<F: Fn(&Self) + 'static>(
1115        &self,
1116        f: F,
1117    ) -> SignalHandlerId {
1118        unsafe extern "C" fn notify_detail_width_chars_trampoline<P, F: Fn(&P) + 'static>(
1119            this: *mut gtk_sys::GtkCalendar,
1120            _param_spec: glib_sys::gpointer,
1121            f: glib_sys::gpointer,
1122        ) where
1123            P: IsA<Calendar>,
1124        {
1125            let f: &F = &*(f as *const F);
1126            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1127        }
1128        unsafe {
1129            let f: Box_<F> = Box_::new(f);
1130            connect_raw(
1131                self.as_ptr() as *mut _,
1132                b"notify::detail-width-chars\0".as_ptr() as *const _,
1133                Some(transmute(
1134                    notify_detail_width_chars_trampoline::<Self, F> as usize,
1135                )),
1136                Box_::into_raw(f),
1137            )
1138        }
1139    }
1140
1141    fn connect_property_month_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1142        unsafe extern "C" fn notify_month_trampoline<P, F: Fn(&P) + 'static>(
1143            this: *mut gtk_sys::GtkCalendar,
1144            _param_spec: glib_sys::gpointer,
1145            f: glib_sys::gpointer,
1146        ) where
1147            P: IsA<Calendar>,
1148        {
1149            let f: &F = &*(f as *const F);
1150            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1151        }
1152        unsafe {
1153            let f: Box_<F> = Box_::new(f);
1154            connect_raw(
1155                self.as_ptr() as *mut _,
1156                b"notify::month\0".as_ptr() as *const _,
1157                Some(transmute(notify_month_trampoline::<Self, F> as usize)),
1158                Box_::into_raw(f),
1159            )
1160        }
1161    }
1162
1163    fn connect_property_no_month_change_notify<F: Fn(&Self) + 'static>(
1164        &self,
1165        f: F,
1166    ) -> SignalHandlerId {
1167        unsafe extern "C" fn notify_no_month_change_trampoline<P, F: Fn(&P) + 'static>(
1168            this: *mut gtk_sys::GtkCalendar,
1169            _param_spec: glib_sys::gpointer,
1170            f: glib_sys::gpointer,
1171        ) where
1172            P: IsA<Calendar>,
1173        {
1174            let f: &F = &*(f as *const F);
1175            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1176        }
1177        unsafe {
1178            let f: Box_<F> = Box_::new(f);
1179            connect_raw(
1180                self.as_ptr() as *mut _,
1181                b"notify::no-month-change\0".as_ptr() as *const _,
1182                Some(transmute(
1183                    notify_no_month_change_trampoline::<Self, F> as usize,
1184                )),
1185                Box_::into_raw(f),
1186            )
1187        }
1188    }
1189
1190    fn connect_property_show_day_names_notify<F: Fn(&Self) + 'static>(
1191        &self,
1192        f: F,
1193    ) -> SignalHandlerId {
1194        unsafe extern "C" fn notify_show_day_names_trampoline<P, F: Fn(&P) + 'static>(
1195            this: *mut gtk_sys::GtkCalendar,
1196            _param_spec: glib_sys::gpointer,
1197            f: glib_sys::gpointer,
1198        ) where
1199            P: IsA<Calendar>,
1200        {
1201            let f: &F = &*(f as *const F);
1202            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1203        }
1204        unsafe {
1205            let f: Box_<F> = Box_::new(f);
1206            connect_raw(
1207                self.as_ptr() as *mut _,
1208                b"notify::show-day-names\0".as_ptr() as *const _,
1209                Some(transmute(
1210                    notify_show_day_names_trampoline::<Self, F> as usize,
1211                )),
1212                Box_::into_raw(f),
1213            )
1214        }
1215    }
1216
1217    fn connect_property_show_details_notify<F: Fn(&Self) + 'static>(
1218        &self,
1219        f: F,
1220    ) -> SignalHandlerId {
1221        unsafe extern "C" fn notify_show_details_trampoline<P, F: Fn(&P) + 'static>(
1222            this: *mut gtk_sys::GtkCalendar,
1223            _param_spec: glib_sys::gpointer,
1224            f: glib_sys::gpointer,
1225        ) where
1226            P: IsA<Calendar>,
1227        {
1228            let f: &F = &*(f as *const F);
1229            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1230        }
1231        unsafe {
1232            let f: Box_<F> = Box_::new(f);
1233            connect_raw(
1234                self.as_ptr() as *mut _,
1235                b"notify::show-details\0".as_ptr() as *const _,
1236                Some(transmute(
1237                    notify_show_details_trampoline::<Self, F> as usize,
1238                )),
1239                Box_::into_raw(f),
1240            )
1241        }
1242    }
1243
1244    fn connect_property_show_heading_notify<F: Fn(&Self) + 'static>(
1245        &self,
1246        f: F,
1247    ) -> SignalHandlerId {
1248        unsafe extern "C" fn notify_show_heading_trampoline<P, F: Fn(&P) + 'static>(
1249            this: *mut gtk_sys::GtkCalendar,
1250            _param_spec: glib_sys::gpointer,
1251            f: glib_sys::gpointer,
1252        ) where
1253            P: IsA<Calendar>,
1254        {
1255            let f: &F = &*(f as *const F);
1256            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1257        }
1258        unsafe {
1259            let f: Box_<F> = Box_::new(f);
1260            connect_raw(
1261                self.as_ptr() as *mut _,
1262                b"notify::show-heading\0".as_ptr() as *const _,
1263                Some(transmute(
1264                    notify_show_heading_trampoline::<Self, F> as usize,
1265                )),
1266                Box_::into_raw(f),
1267            )
1268        }
1269    }
1270
1271    fn connect_property_show_week_numbers_notify<F: Fn(&Self) + 'static>(
1272        &self,
1273        f: F,
1274    ) -> SignalHandlerId {
1275        unsafe extern "C" fn notify_show_week_numbers_trampoline<P, F: Fn(&P) + 'static>(
1276            this: *mut gtk_sys::GtkCalendar,
1277            _param_spec: glib_sys::gpointer,
1278            f: glib_sys::gpointer,
1279        ) where
1280            P: IsA<Calendar>,
1281        {
1282            let f: &F = &*(f as *const F);
1283            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1284        }
1285        unsafe {
1286            let f: Box_<F> = Box_::new(f);
1287            connect_raw(
1288                self.as_ptr() as *mut _,
1289                b"notify::show-week-numbers\0".as_ptr() as *const _,
1290                Some(transmute(
1291                    notify_show_week_numbers_trampoline::<Self, F> as usize,
1292                )),
1293                Box_::into_raw(f),
1294            )
1295        }
1296    }
1297
1298    fn connect_property_year_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1299        unsafe extern "C" fn notify_year_trampoline<P, F: Fn(&P) + 'static>(
1300            this: *mut gtk_sys::GtkCalendar,
1301            _param_spec: glib_sys::gpointer,
1302            f: glib_sys::gpointer,
1303        ) where
1304            P: IsA<Calendar>,
1305        {
1306            let f: &F = &*(f as *const F);
1307            f(&Calendar::from_glib_borrow(this).unsafe_cast())
1308        }
1309        unsafe {
1310            let f: Box_<F> = Box_::new(f);
1311            connect_raw(
1312                self.as_ptr() as *mut _,
1313                b"notify::year\0".as_ptr() as *const _,
1314                Some(transmute(notify_year_trampoline::<Self, F> as usize)),
1315                Box_::into_raw(f),
1316            )
1317        }
1318    }
1319}
1320
1321impl fmt::Display for Calendar {
1322    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1323        write!(f, "Calendar")
1324    }
1325}