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