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