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::Container; 8 use crate::Justification; 9 use crate::Label; 10 use crate::Misc; 11 use crate::Widget; 12 use glib::object::Cast; 13 use glib::object::IsA; 14 use glib::signal::connect_raw; 15 use glib::signal::SignalHandlerId; 16 use glib::translate::*; 17 use glib::StaticType; 18 use glib::ToValue; 19 use std::boxed::Box as Box_; 20 use std::fmt; 21 use std::mem; 22 use std::mem::transmute; 23 24 glib::wrapper! { 25 #[doc(alias = "GtkAccelLabel")] 26 pub struct AccelLabel(Object<ffi::GtkAccelLabel, ffi::GtkAccelLabelClass>) @extends Label, Misc, Widget, @implements Buildable; 27 28 match fn { 29 type_ => || ffi::gtk_accel_label_get_type(), 30 } 31 } 32 33 impl AccelLabel { 34 #[doc(alias = "gtk_accel_label_new")] new(string: &str) -> AccelLabel35 pub fn new(string: &str) -> AccelLabel { 36 assert_initialized_main_thread!(); 37 unsafe { 38 Widget::from_glib_none(ffi::gtk_accel_label_new(string.to_glib_none().0)).unsafe_cast() 39 } 40 } 41 42 // rustdoc-stripper-ignore-next 43 /// Creates a new builder-pattern struct instance to construct [`AccelLabel`] objects. 44 /// 45 /// This method returns an instance of [`AccelLabelBuilder`] which can be used to create [`AccelLabel`] objects. builder() -> AccelLabelBuilder46 pub fn builder() -> AccelLabelBuilder { 47 AccelLabelBuilder::default() 48 } 49 } 50 51 #[derive(Clone, Default)] 52 // rustdoc-stripper-ignore-next 53 /// A [builder-pattern] type to construct [`AccelLabel`] objects. 54 /// 55 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 56 pub struct AccelLabelBuilder { 57 accel_closure: Option<glib::Closure>, 58 accel_widget: Option<Widget>, 59 angle: Option<f64>, 60 attributes: Option<pango::AttrList>, 61 ellipsize: Option<pango::EllipsizeMode>, 62 justify: Option<Justification>, 63 label: Option<String>, 64 lines: Option<i32>, 65 max_width_chars: Option<i32>, 66 mnemonic_widget: Option<Widget>, 67 pattern: Option<String>, 68 selectable: Option<bool>, 69 single_line_mode: Option<bool>, 70 track_visited_links: Option<bool>, 71 use_markup: Option<bool>, 72 use_underline: Option<bool>, 73 width_chars: Option<i32>, 74 wrap: Option<bool>, 75 wrap_mode: Option<pango::WrapMode>, 76 xalign: Option<f32>, 77 yalign: Option<f32>, 78 app_paintable: Option<bool>, 79 can_default: Option<bool>, 80 can_focus: Option<bool>, 81 events: Option<gdk::EventMask>, 82 expand: Option<bool>, 83 #[cfg(any(feature = "v3_20", feature = "dox"))] 84 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 85 focus_on_click: Option<bool>, 86 halign: Option<Align>, 87 has_default: Option<bool>, 88 has_focus: Option<bool>, 89 has_tooltip: Option<bool>, 90 height_request: Option<i32>, 91 hexpand: Option<bool>, 92 hexpand_set: Option<bool>, 93 is_focus: Option<bool>, 94 margin: Option<i32>, 95 margin_bottom: Option<i32>, 96 margin_end: Option<i32>, 97 margin_start: Option<i32>, 98 margin_top: Option<i32>, 99 name: Option<String>, 100 no_show_all: Option<bool>, 101 opacity: Option<f64>, 102 parent: Option<Container>, 103 receives_default: Option<bool>, 104 sensitive: Option<bool>, 105 tooltip_markup: Option<String>, 106 tooltip_text: Option<String>, 107 valign: Option<Align>, 108 vexpand: Option<bool>, 109 vexpand_set: Option<bool>, 110 visible: Option<bool>, 111 width_request: Option<i32>, 112 } 113 114 impl AccelLabelBuilder { 115 // rustdoc-stripper-ignore-next 116 /// Create a new [`AccelLabelBuilder`]. new() -> Self117 pub fn new() -> Self { 118 Self::default() 119 } 120 121 // rustdoc-stripper-ignore-next 122 /// Build the [`AccelLabel`]. build(self) -> AccelLabel123 pub fn build(self) -> AccelLabel { 124 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 125 if let Some(ref accel_closure) = self.accel_closure { 126 properties.push(("accel-closure", accel_closure)); 127 } 128 if let Some(ref accel_widget) = self.accel_widget { 129 properties.push(("accel-widget", accel_widget)); 130 } 131 if let Some(ref angle) = self.angle { 132 properties.push(("angle", angle)); 133 } 134 if let Some(ref attributes) = self.attributes { 135 properties.push(("attributes", attributes)); 136 } 137 if let Some(ref ellipsize) = self.ellipsize { 138 properties.push(("ellipsize", ellipsize)); 139 } 140 if let Some(ref justify) = self.justify { 141 properties.push(("justify", justify)); 142 } 143 if let Some(ref label) = self.label { 144 properties.push(("label", label)); 145 } 146 if let Some(ref lines) = self.lines { 147 properties.push(("lines", lines)); 148 } 149 if let Some(ref max_width_chars) = self.max_width_chars { 150 properties.push(("max-width-chars", max_width_chars)); 151 } 152 if let Some(ref mnemonic_widget) = self.mnemonic_widget { 153 properties.push(("mnemonic-widget", mnemonic_widget)); 154 } 155 if let Some(ref pattern) = self.pattern { 156 properties.push(("pattern", pattern)); 157 } 158 if let Some(ref selectable) = self.selectable { 159 properties.push(("selectable", selectable)); 160 } 161 if let Some(ref single_line_mode) = self.single_line_mode { 162 properties.push(("single-line-mode", single_line_mode)); 163 } 164 if let Some(ref track_visited_links) = self.track_visited_links { 165 properties.push(("track-visited-links", track_visited_links)); 166 } 167 if let Some(ref use_markup) = self.use_markup { 168 properties.push(("use-markup", use_markup)); 169 } 170 if let Some(ref use_underline) = self.use_underline { 171 properties.push(("use-underline", use_underline)); 172 } 173 if let Some(ref width_chars) = self.width_chars { 174 properties.push(("width-chars", width_chars)); 175 } 176 if let Some(ref wrap) = self.wrap { 177 properties.push(("wrap", wrap)); 178 } 179 if let Some(ref wrap_mode) = self.wrap_mode { 180 properties.push(("wrap-mode", wrap_mode)); 181 } 182 if let Some(ref xalign) = self.xalign { 183 properties.push(("xalign", xalign)); 184 } 185 if let Some(ref yalign) = self.yalign { 186 properties.push(("yalign", yalign)); 187 } 188 if let Some(ref app_paintable) = self.app_paintable { 189 properties.push(("app-paintable", app_paintable)); 190 } 191 if let Some(ref can_default) = self.can_default { 192 properties.push(("can-default", can_default)); 193 } 194 if let Some(ref can_focus) = self.can_focus { 195 properties.push(("can-focus", can_focus)); 196 } 197 if let Some(ref events) = self.events { 198 properties.push(("events", events)); 199 } 200 if let Some(ref expand) = self.expand { 201 properties.push(("expand", expand)); 202 } 203 #[cfg(any(feature = "v3_20", feature = "dox"))] 204 if let Some(ref focus_on_click) = self.focus_on_click { 205 properties.push(("focus-on-click", focus_on_click)); 206 } 207 if let Some(ref halign) = self.halign { 208 properties.push(("halign", halign)); 209 } 210 if let Some(ref has_default) = self.has_default { 211 properties.push(("has-default", has_default)); 212 } 213 if let Some(ref has_focus) = self.has_focus { 214 properties.push(("has-focus", has_focus)); 215 } 216 if let Some(ref has_tooltip) = self.has_tooltip { 217 properties.push(("has-tooltip", has_tooltip)); 218 } 219 if let Some(ref height_request) = self.height_request { 220 properties.push(("height-request", height_request)); 221 } 222 if let Some(ref hexpand) = self.hexpand { 223 properties.push(("hexpand", hexpand)); 224 } 225 if let Some(ref hexpand_set) = self.hexpand_set { 226 properties.push(("hexpand-set", hexpand_set)); 227 } 228 if let Some(ref is_focus) = self.is_focus { 229 properties.push(("is-focus", is_focus)); 230 } 231 if let Some(ref margin) = self.margin { 232 properties.push(("margin", margin)); 233 } 234 if let Some(ref margin_bottom) = self.margin_bottom { 235 properties.push(("margin-bottom", margin_bottom)); 236 } 237 if let Some(ref margin_end) = self.margin_end { 238 properties.push(("margin-end", margin_end)); 239 } 240 if let Some(ref margin_start) = self.margin_start { 241 properties.push(("margin-start", margin_start)); 242 } 243 if let Some(ref margin_top) = self.margin_top { 244 properties.push(("margin-top", margin_top)); 245 } 246 if let Some(ref name) = self.name { 247 properties.push(("name", name)); 248 } 249 if let Some(ref no_show_all) = self.no_show_all { 250 properties.push(("no-show-all", no_show_all)); 251 } 252 if let Some(ref opacity) = self.opacity { 253 properties.push(("opacity", opacity)); 254 } 255 if let Some(ref parent) = self.parent { 256 properties.push(("parent", parent)); 257 } 258 if let Some(ref receives_default) = self.receives_default { 259 properties.push(("receives-default", receives_default)); 260 } 261 if let Some(ref sensitive) = self.sensitive { 262 properties.push(("sensitive", sensitive)); 263 } 264 if let Some(ref tooltip_markup) = self.tooltip_markup { 265 properties.push(("tooltip-markup", tooltip_markup)); 266 } 267 if let Some(ref tooltip_text) = self.tooltip_text { 268 properties.push(("tooltip-text", tooltip_text)); 269 } 270 if let Some(ref valign) = self.valign { 271 properties.push(("valign", valign)); 272 } 273 if let Some(ref vexpand) = self.vexpand { 274 properties.push(("vexpand", vexpand)); 275 } 276 if let Some(ref vexpand_set) = self.vexpand_set { 277 properties.push(("vexpand-set", vexpand_set)); 278 } 279 if let Some(ref visible) = self.visible { 280 properties.push(("visible", visible)); 281 } 282 if let Some(ref width_request) = self.width_request { 283 properties.push(("width-request", width_request)); 284 } 285 glib::Object::new::<AccelLabel>(&properties) 286 .expect("Failed to create an instance of AccelLabel") 287 } 288 accel_closure(mut self, accel_closure: &glib::Closure) -> Self289 pub fn accel_closure(mut self, accel_closure: &glib::Closure) -> Self { 290 self.accel_closure = Some(accel_closure.clone()); 291 self 292 } 293 accel_widget<P: IsA<Widget>>(mut self, accel_widget: &P) -> Self294 pub fn accel_widget<P: IsA<Widget>>(mut self, accel_widget: &P) -> Self { 295 self.accel_widget = Some(accel_widget.clone().upcast()); 296 self 297 } 298 angle(mut self, angle: f64) -> Self299 pub fn angle(mut self, angle: f64) -> Self { 300 self.angle = Some(angle); 301 self 302 } 303 attributes(mut self, attributes: &pango::AttrList) -> Self304 pub fn attributes(mut self, attributes: &pango::AttrList) -> Self { 305 self.attributes = Some(attributes.clone()); 306 self 307 } 308 ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self309 pub fn ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self { 310 self.ellipsize = Some(ellipsize); 311 self 312 } 313 justify(mut self, justify: Justification) -> Self314 pub fn justify(mut self, justify: Justification) -> Self { 315 self.justify = Some(justify); 316 self 317 } 318 label(mut self, label: &str) -> Self319 pub fn label(mut self, label: &str) -> Self { 320 self.label = Some(label.to_string()); 321 self 322 } 323 lines(mut self, lines: i32) -> Self324 pub fn lines(mut self, lines: i32) -> Self { 325 self.lines = Some(lines); 326 self 327 } 328 max_width_chars(mut self, max_width_chars: i32) -> Self329 pub fn max_width_chars(mut self, max_width_chars: i32) -> Self { 330 self.max_width_chars = Some(max_width_chars); 331 self 332 } 333 mnemonic_widget<P: IsA<Widget>>(mut self, mnemonic_widget: &P) -> Self334 pub fn mnemonic_widget<P: IsA<Widget>>(mut self, mnemonic_widget: &P) -> Self { 335 self.mnemonic_widget = Some(mnemonic_widget.clone().upcast()); 336 self 337 } 338 pattern(mut self, pattern: &str) -> Self339 pub fn pattern(mut self, pattern: &str) -> Self { 340 self.pattern = Some(pattern.to_string()); 341 self 342 } 343 selectable(mut self, selectable: bool) -> Self344 pub fn selectable(mut self, selectable: bool) -> Self { 345 self.selectable = Some(selectable); 346 self 347 } 348 single_line_mode(mut self, single_line_mode: bool) -> Self349 pub fn single_line_mode(mut self, single_line_mode: bool) -> Self { 350 self.single_line_mode = Some(single_line_mode); 351 self 352 } 353 track_visited_links(mut self, track_visited_links: bool) -> Self354 pub fn track_visited_links(mut self, track_visited_links: bool) -> Self { 355 self.track_visited_links = Some(track_visited_links); 356 self 357 } 358 use_markup(mut self, use_markup: bool) -> Self359 pub fn use_markup(mut self, use_markup: bool) -> Self { 360 self.use_markup = Some(use_markup); 361 self 362 } 363 use_underline(mut self, use_underline: bool) -> Self364 pub fn use_underline(mut self, use_underline: bool) -> Self { 365 self.use_underline = Some(use_underline); 366 self 367 } 368 width_chars(mut self, width_chars: i32) -> Self369 pub fn width_chars(mut self, width_chars: i32) -> Self { 370 self.width_chars = Some(width_chars); 371 self 372 } 373 wrap(mut self, wrap: bool) -> Self374 pub fn wrap(mut self, wrap: bool) -> Self { 375 self.wrap = Some(wrap); 376 self 377 } 378 wrap_mode(mut self, wrap_mode: pango::WrapMode) -> Self379 pub fn wrap_mode(mut self, wrap_mode: pango::WrapMode) -> Self { 380 self.wrap_mode = Some(wrap_mode); 381 self 382 } 383 xalign(mut self, xalign: f32) -> Self384 pub fn xalign(mut self, xalign: f32) -> Self { 385 self.xalign = Some(xalign); 386 self 387 } 388 yalign(mut self, yalign: f32) -> Self389 pub fn yalign(mut self, yalign: f32) -> Self { 390 self.yalign = Some(yalign); 391 self 392 } 393 app_paintable(mut self, app_paintable: bool) -> Self394 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 395 self.app_paintable = Some(app_paintable); 396 self 397 } 398 can_default(mut self, can_default: bool) -> Self399 pub fn can_default(mut self, can_default: bool) -> Self { 400 self.can_default = Some(can_default); 401 self 402 } 403 can_focus(mut self, can_focus: bool) -> Self404 pub fn can_focus(mut self, can_focus: bool) -> Self { 405 self.can_focus = Some(can_focus); 406 self 407 } 408 events(mut self, events: gdk::EventMask) -> Self409 pub fn events(mut self, events: gdk::EventMask) -> Self { 410 self.events = Some(events); 411 self 412 } 413 expand(mut self, expand: bool) -> Self414 pub fn expand(mut self, expand: bool) -> Self { 415 self.expand = Some(expand); 416 self 417 } 418 419 #[cfg(any(feature = "v3_20", feature = "dox"))] 420 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self421 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 422 self.focus_on_click = Some(focus_on_click); 423 self 424 } 425 halign(mut self, halign: Align) -> Self426 pub fn halign(mut self, halign: Align) -> Self { 427 self.halign = Some(halign); 428 self 429 } 430 has_default(mut self, has_default: bool) -> Self431 pub fn has_default(mut self, has_default: bool) -> Self { 432 self.has_default = Some(has_default); 433 self 434 } 435 has_focus(mut self, has_focus: bool) -> Self436 pub fn has_focus(mut self, has_focus: bool) -> Self { 437 self.has_focus = Some(has_focus); 438 self 439 } 440 has_tooltip(mut self, has_tooltip: bool) -> Self441 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 442 self.has_tooltip = Some(has_tooltip); 443 self 444 } 445 height_request(mut self, height_request: i32) -> Self446 pub fn height_request(mut self, height_request: i32) -> Self { 447 self.height_request = Some(height_request); 448 self 449 } 450 hexpand(mut self, hexpand: bool) -> Self451 pub fn hexpand(mut self, hexpand: bool) -> Self { 452 self.hexpand = Some(hexpand); 453 self 454 } 455 hexpand_set(mut self, hexpand_set: bool) -> Self456 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 457 self.hexpand_set = Some(hexpand_set); 458 self 459 } 460 is_focus(mut self, is_focus: bool) -> Self461 pub fn is_focus(mut self, is_focus: bool) -> Self { 462 self.is_focus = Some(is_focus); 463 self 464 } 465 margin(mut self, margin: i32) -> Self466 pub fn margin(mut self, margin: i32) -> Self { 467 self.margin = Some(margin); 468 self 469 } 470 margin_bottom(mut self, margin_bottom: i32) -> Self471 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 472 self.margin_bottom = Some(margin_bottom); 473 self 474 } 475 margin_end(mut self, margin_end: i32) -> Self476 pub fn margin_end(mut self, margin_end: i32) -> Self { 477 self.margin_end = Some(margin_end); 478 self 479 } 480 margin_start(mut self, margin_start: i32) -> Self481 pub fn margin_start(mut self, margin_start: i32) -> Self { 482 self.margin_start = Some(margin_start); 483 self 484 } 485 margin_top(mut self, margin_top: i32) -> Self486 pub fn margin_top(mut self, margin_top: i32) -> Self { 487 self.margin_top = Some(margin_top); 488 self 489 } 490 name(mut self, name: &str) -> Self491 pub fn name(mut self, name: &str) -> Self { 492 self.name = Some(name.to_string()); 493 self 494 } 495 no_show_all(mut self, no_show_all: bool) -> Self496 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 497 self.no_show_all = Some(no_show_all); 498 self 499 } 500 opacity(mut self, opacity: f64) -> Self501 pub fn opacity(mut self, opacity: f64) -> Self { 502 self.opacity = Some(opacity); 503 self 504 } 505 parent<P: IsA<Container>>(mut self, parent: &P) -> Self506 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 507 self.parent = Some(parent.clone().upcast()); 508 self 509 } 510 receives_default(mut self, receives_default: bool) -> Self511 pub fn receives_default(mut self, receives_default: bool) -> Self { 512 self.receives_default = Some(receives_default); 513 self 514 } 515 sensitive(mut self, sensitive: bool) -> Self516 pub fn sensitive(mut self, sensitive: bool) -> Self { 517 self.sensitive = Some(sensitive); 518 self 519 } 520 tooltip_markup(mut self, tooltip_markup: &str) -> Self521 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 522 self.tooltip_markup = Some(tooltip_markup.to_string()); 523 self 524 } 525 tooltip_text(mut self, tooltip_text: &str) -> Self526 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 527 self.tooltip_text = Some(tooltip_text.to_string()); 528 self 529 } 530 valign(mut self, valign: Align) -> Self531 pub fn valign(mut self, valign: Align) -> Self { 532 self.valign = Some(valign); 533 self 534 } 535 vexpand(mut self, vexpand: bool) -> Self536 pub fn vexpand(mut self, vexpand: bool) -> Self { 537 self.vexpand = Some(vexpand); 538 self 539 } 540 vexpand_set(mut self, vexpand_set: bool) -> Self541 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 542 self.vexpand_set = Some(vexpand_set); 543 self 544 } 545 visible(mut self, visible: bool) -> Self546 pub fn visible(mut self, visible: bool) -> Self { 547 self.visible = Some(visible); 548 self 549 } 550 width_request(mut self, width_request: i32) -> Self551 pub fn width_request(mut self, width_request: i32) -> Self { 552 self.width_request = Some(width_request); 553 self 554 } 555 } 556 557 pub const NONE_ACCEL_LABEL: Option<&AccelLabel> = None; 558 559 pub trait AccelLabelExt: 'static { 560 #[doc(alias = "gtk_accel_label_get_accel")] 561 #[doc(alias = "get_accel")] accel(&self) -> (u32, gdk::ModifierType)562 fn accel(&self) -> (u32, gdk::ModifierType); 563 564 #[doc(alias = "gtk_accel_label_get_accel_widget")] 565 #[doc(alias = "get_accel_widget")] accel_widget(&self) -> Option<Widget>566 fn accel_widget(&self) -> Option<Widget>; 567 568 #[doc(alias = "gtk_accel_label_get_accel_width")] 569 #[doc(alias = "get_accel_width")] accel_width(&self) -> u32570 fn accel_width(&self) -> u32; 571 572 #[doc(alias = "gtk_accel_label_refetch")] refetch(&self) -> bool573 fn refetch(&self) -> bool; 574 575 #[doc(alias = "gtk_accel_label_set_accel")] set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType)576 fn set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType); 577 578 #[doc(alias = "gtk_accel_label_set_accel_closure")] set_accel_closure(&self, accel_closure: Option<&glib::Closure>)579 fn set_accel_closure(&self, accel_closure: Option<&glib::Closure>); 580 581 #[doc(alias = "gtk_accel_label_set_accel_widget")] set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>)582 fn set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>); 583 584 #[doc(alias = "accel-closure")] accel_closure(&self) -> Option<glib::Closure>585 fn accel_closure(&self) -> Option<glib::Closure>; 586 587 #[doc(alias = "accel-closure")] connect_accel_closure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId588 fn connect_accel_closure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 589 590 #[doc(alias = "accel-widget")] connect_accel_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId591 fn connect_accel_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 592 } 593 594 impl<O: IsA<AccelLabel>> AccelLabelExt for O { accel(&self) -> (u32, gdk::ModifierType)595 fn accel(&self) -> (u32, gdk::ModifierType) { 596 unsafe { 597 let mut accelerator_key = mem::MaybeUninit::uninit(); 598 let mut accelerator_mods = mem::MaybeUninit::uninit(); 599 ffi::gtk_accel_label_get_accel( 600 self.as_ref().to_glib_none().0, 601 accelerator_key.as_mut_ptr(), 602 accelerator_mods.as_mut_ptr(), 603 ); 604 let accelerator_key = accelerator_key.assume_init(); 605 let accelerator_mods = accelerator_mods.assume_init(); 606 (accelerator_key, from_glib(accelerator_mods)) 607 } 608 } 609 accel_widget(&self) -> Option<Widget>610 fn accel_widget(&self) -> Option<Widget> { 611 unsafe { 612 from_glib_none(ffi::gtk_accel_label_get_accel_widget( 613 self.as_ref().to_glib_none().0, 614 )) 615 } 616 } 617 accel_width(&self) -> u32618 fn accel_width(&self) -> u32 { 619 unsafe { ffi::gtk_accel_label_get_accel_width(self.as_ref().to_glib_none().0) } 620 } 621 refetch(&self) -> bool622 fn refetch(&self) -> bool { 623 unsafe { from_glib(ffi::gtk_accel_label_refetch(self.as_ref().to_glib_none().0)) } 624 } 625 set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType)626 fn set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType) { 627 unsafe { 628 ffi::gtk_accel_label_set_accel( 629 self.as_ref().to_glib_none().0, 630 accelerator_key, 631 accelerator_mods.into_glib(), 632 ); 633 } 634 } 635 set_accel_closure(&self, accel_closure: Option<&glib::Closure>)636 fn set_accel_closure(&self, accel_closure: Option<&glib::Closure>) { 637 unsafe { 638 ffi::gtk_accel_label_set_accel_closure( 639 self.as_ref().to_glib_none().0, 640 accel_closure.to_glib_none().0, 641 ); 642 } 643 } 644 set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>)645 fn set_accel_widget<P: IsA<Widget>>(&self, accel_widget: Option<&P>) { 646 unsafe { 647 ffi::gtk_accel_label_set_accel_widget( 648 self.as_ref().to_glib_none().0, 649 accel_widget.map(|p| p.as_ref()).to_glib_none().0, 650 ); 651 } 652 } 653 accel_closure(&self) -> Option<glib::Closure>654 fn accel_closure(&self) -> Option<glib::Closure> { 655 unsafe { 656 let mut value = glib::Value::from_type(<glib::Closure as StaticType>::static_type()); 657 glib::gobject_ffi::g_object_get_property( 658 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 659 b"accel-closure\0".as_ptr() as *const _, 660 value.to_glib_none_mut().0, 661 ); 662 value 663 .get() 664 .expect("Return Value for property `accel-closure` getter") 665 } 666 } 667 connect_accel_closure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId668 fn connect_accel_closure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 669 unsafe extern "C" fn notify_accel_closure_trampoline< 670 P: IsA<AccelLabel>, 671 F: Fn(&P) + 'static, 672 >( 673 this: *mut ffi::GtkAccelLabel, 674 _param_spec: glib::ffi::gpointer, 675 f: glib::ffi::gpointer, 676 ) { 677 let f: &F = &*(f as *const F); 678 f(AccelLabel::from_glib_borrow(this).unsafe_cast_ref()) 679 } 680 unsafe { 681 let f: Box_<F> = Box_::new(f); 682 connect_raw( 683 self.as_ptr() as *mut _, 684 b"notify::accel-closure\0".as_ptr() as *const _, 685 Some(transmute::<_, unsafe extern "C" fn()>( 686 notify_accel_closure_trampoline::<Self, F> as *const (), 687 )), 688 Box_::into_raw(f), 689 ) 690 } 691 } 692 connect_accel_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId693 fn connect_accel_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 694 unsafe extern "C" fn notify_accel_widget_trampoline< 695 P: IsA<AccelLabel>, 696 F: Fn(&P) + 'static, 697 >( 698 this: *mut ffi::GtkAccelLabel, 699 _param_spec: glib::ffi::gpointer, 700 f: glib::ffi::gpointer, 701 ) { 702 let f: &F = &*(f as *const F); 703 f(AccelLabel::from_glib_borrow(this).unsafe_cast_ref()) 704 } 705 unsafe { 706 let f: Box_<F> = Box_::new(f); 707 connect_raw( 708 self.as_ptr() as *mut _, 709 b"notify::accel-widget\0".as_ptr() as *const _, 710 Some(transmute::<_, unsafe extern "C" fn()>( 711 notify_accel_widget_trampoline::<Self, F> as *const (), 712 )), 713 Box_::into_raw(f), 714 ) 715 } 716 } 717 } 718 719 impl fmt::Display for AccelLabel { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result720 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 721 f.write_str("AccelLabel") 722 } 723 } 724