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::BaselinePosition; 7 use crate::Box; 8 use crate::Buildable; 9 use crate::Button; 10 use crate::Container; 11 use crate::MessageType; 12 use crate::Orientable; 13 use crate::Orientation; 14 use crate::ResizeMode; 15 use crate::ResponseType; 16 use crate::Widget; 17 use glib::object::Cast; 18 use glib::object::IsA; 19 use glib::object::ObjectExt; 20 use glib::signal::connect_raw; 21 use glib::signal::SignalHandlerId; 22 use glib::translate::*; 23 use glib::StaticType; 24 use glib::ToValue; 25 use std::boxed::Box as Box_; 26 use std::fmt; 27 use std::mem::transmute; 28 29 glib::wrapper! { 30 #[doc(alias = "GtkInfoBar")] 31 pub struct InfoBar(Object<ffi::GtkInfoBar, ffi::GtkInfoBarClass>) @extends Box, Container, Widget, @implements Buildable, Orientable; 32 33 match fn { 34 type_ => || ffi::gtk_info_bar_get_type(), 35 } 36 } 37 38 impl InfoBar { 39 #[doc(alias = "gtk_info_bar_new")] new() -> InfoBar40 pub fn new() -> InfoBar { 41 assert_initialized_main_thread!(); 42 unsafe { Widget::from_glib_none(ffi::gtk_info_bar_new()).unsafe_cast() } 43 } 44 45 //#[doc(alias = "gtk_info_bar_new_with_buttons")] 46 //#[doc(alias = "new_with_buttons")] 47 //pub fn with_buttons(first_button_text: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> InfoBar { 48 // unsafe { TODO: call ffi:gtk_info_bar_new_with_buttons() } 49 //} 50 51 // rustdoc-stripper-ignore-next 52 /// Creates a new builder-pattern struct instance to construct [`InfoBar`] objects. 53 /// 54 /// This method returns an instance of [`InfoBarBuilder`] which can be used to create [`InfoBar`] objects. builder() -> InfoBarBuilder55 pub fn builder() -> InfoBarBuilder { 56 InfoBarBuilder::default() 57 } 58 } 59 60 impl Default for InfoBar { default() -> Self61 fn default() -> Self { 62 Self::new() 63 } 64 } 65 66 #[derive(Clone, Default)] 67 // rustdoc-stripper-ignore-next 68 /// A [builder-pattern] type to construct [`InfoBar`] objects. 69 /// 70 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 71 pub struct InfoBarBuilder { 72 message_type: Option<MessageType>, 73 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 74 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] 75 revealed: Option<bool>, 76 show_close_button: Option<bool>, 77 baseline_position: Option<BaselinePosition>, 78 homogeneous: Option<bool>, 79 spacing: Option<i32>, 80 border_width: Option<u32>, 81 child: Option<Widget>, 82 resize_mode: Option<ResizeMode>, 83 app_paintable: Option<bool>, 84 can_default: Option<bool>, 85 can_focus: Option<bool>, 86 events: Option<gdk::EventMask>, 87 expand: Option<bool>, 88 #[cfg(any(feature = "v3_20", feature = "dox"))] 89 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 90 focus_on_click: Option<bool>, 91 halign: Option<Align>, 92 has_default: Option<bool>, 93 has_focus: Option<bool>, 94 has_tooltip: Option<bool>, 95 height_request: Option<i32>, 96 hexpand: Option<bool>, 97 hexpand_set: Option<bool>, 98 is_focus: Option<bool>, 99 margin: Option<i32>, 100 margin_bottom: Option<i32>, 101 margin_end: Option<i32>, 102 margin_start: Option<i32>, 103 margin_top: Option<i32>, 104 name: Option<String>, 105 no_show_all: Option<bool>, 106 opacity: Option<f64>, 107 parent: Option<Container>, 108 receives_default: Option<bool>, 109 sensitive: Option<bool>, 110 tooltip_markup: Option<String>, 111 tooltip_text: Option<String>, 112 valign: Option<Align>, 113 vexpand: Option<bool>, 114 vexpand_set: Option<bool>, 115 visible: Option<bool>, 116 width_request: Option<i32>, 117 orientation: Option<Orientation>, 118 } 119 120 impl InfoBarBuilder { 121 // rustdoc-stripper-ignore-next 122 /// Create a new [`InfoBarBuilder`]. new() -> Self123 pub fn new() -> Self { 124 Self::default() 125 } 126 127 // rustdoc-stripper-ignore-next 128 /// Build the [`InfoBar`]. build(self) -> InfoBar129 pub fn build(self) -> InfoBar { 130 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 131 if let Some(ref message_type) = self.message_type { 132 properties.push(("message-type", message_type)); 133 } 134 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 135 if let Some(ref revealed) = self.revealed { 136 properties.push(("revealed", revealed)); 137 } 138 if let Some(ref show_close_button) = self.show_close_button { 139 properties.push(("show-close-button", show_close_button)); 140 } 141 if let Some(ref baseline_position) = self.baseline_position { 142 properties.push(("baseline-position", baseline_position)); 143 } 144 if let Some(ref homogeneous) = self.homogeneous { 145 properties.push(("homogeneous", homogeneous)); 146 } 147 if let Some(ref spacing) = self.spacing { 148 properties.push(("spacing", spacing)); 149 } 150 if let Some(ref border_width) = self.border_width { 151 properties.push(("border-width", border_width)); 152 } 153 if let Some(ref child) = self.child { 154 properties.push(("child", child)); 155 } 156 if let Some(ref resize_mode) = self.resize_mode { 157 properties.push(("resize-mode", resize_mode)); 158 } 159 if let Some(ref app_paintable) = self.app_paintable { 160 properties.push(("app-paintable", app_paintable)); 161 } 162 if let Some(ref can_default) = self.can_default { 163 properties.push(("can-default", can_default)); 164 } 165 if let Some(ref can_focus) = self.can_focus { 166 properties.push(("can-focus", can_focus)); 167 } 168 if let Some(ref events) = self.events { 169 properties.push(("events", events)); 170 } 171 if let Some(ref expand) = self.expand { 172 properties.push(("expand", expand)); 173 } 174 #[cfg(any(feature = "v3_20", feature = "dox"))] 175 if let Some(ref focus_on_click) = self.focus_on_click { 176 properties.push(("focus-on-click", focus_on_click)); 177 } 178 if let Some(ref halign) = self.halign { 179 properties.push(("halign", halign)); 180 } 181 if let Some(ref has_default) = self.has_default { 182 properties.push(("has-default", has_default)); 183 } 184 if let Some(ref has_focus) = self.has_focus { 185 properties.push(("has-focus", has_focus)); 186 } 187 if let Some(ref has_tooltip) = self.has_tooltip { 188 properties.push(("has-tooltip", has_tooltip)); 189 } 190 if let Some(ref height_request) = self.height_request { 191 properties.push(("height-request", height_request)); 192 } 193 if let Some(ref hexpand) = self.hexpand { 194 properties.push(("hexpand", hexpand)); 195 } 196 if let Some(ref hexpand_set) = self.hexpand_set { 197 properties.push(("hexpand-set", hexpand_set)); 198 } 199 if let Some(ref is_focus) = self.is_focus { 200 properties.push(("is-focus", is_focus)); 201 } 202 if let Some(ref margin) = self.margin { 203 properties.push(("margin", margin)); 204 } 205 if let Some(ref margin_bottom) = self.margin_bottom { 206 properties.push(("margin-bottom", margin_bottom)); 207 } 208 if let Some(ref margin_end) = self.margin_end { 209 properties.push(("margin-end", margin_end)); 210 } 211 if let Some(ref margin_start) = self.margin_start { 212 properties.push(("margin-start", margin_start)); 213 } 214 if let Some(ref margin_top) = self.margin_top { 215 properties.push(("margin-top", margin_top)); 216 } 217 if let Some(ref name) = self.name { 218 properties.push(("name", name)); 219 } 220 if let Some(ref no_show_all) = self.no_show_all { 221 properties.push(("no-show-all", no_show_all)); 222 } 223 if let Some(ref opacity) = self.opacity { 224 properties.push(("opacity", opacity)); 225 } 226 if let Some(ref parent) = self.parent { 227 properties.push(("parent", parent)); 228 } 229 if let Some(ref receives_default) = self.receives_default { 230 properties.push(("receives-default", receives_default)); 231 } 232 if let Some(ref sensitive) = self.sensitive { 233 properties.push(("sensitive", sensitive)); 234 } 235 if let Some(ref tooltip_markup) = self.tooltip_markup { 236 properties.push(("tooltip-markup", tooltip_markup)); 237 } 238 if let Some(ref tooltip_text) = self.tooltip_text { 239 properties.push(("tooltip-text", tooltip_text)); 240 } 241 if let Some(ref valign) = self.valign { 242 properties.push(("valign", valign)); 243 } 244 if let Some(ref vexpand) = self.vexpand { 245 properties.push(("vexpand", vexpand)); 246 } 247 if let Some(ref vexpand_set) = self.vexpand_set { 248 properties.push(("vexpand-set", vexpand_set)); 249 } 250 if let Some(ref visible) = self.visible { 251 properties.push(("visible", visible)); 252 } 253 if let Some(ref width_request) = self.width_request { 254 properties.push(("width-request", width_request)); 255 } 256 if let Some(ref orientation) = self.orientation { 257 properties.push(("orientation", orientation)); 258 } 259 glib::Object::new::<InfoBar>(&properties).expect("Failed to create an instance of InfoBar") 260 } 261 message_type(mut self, message_type: MessageType) -> Self262 pub fn message_type(mut self, message_type: MessageType) -> Self { 263 self.message_type = Some(message_type); 264 self 265 } 266 267 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 268 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] revealed(mut self, revealed: bool) -> Self269 pub fn revealed(mut self, revealed: bool) -> Self { 270 self.revealed = Some(revealed); 271 self 272 } 273 show_close_button(mut self, show_close_button: bool) -> Self274 pub fn show_close_button(mut self, show_close_button: bool) -> Self { 275 self.show_close_button = Some(show_close_button); 276 self 277 } 278 baseline_position(mut self, baseline_position: BaselinePosition) -> Self279 pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self { 280 self.baseline_position = Some(baseline_position); 281 self 282 } 283 homogeneous(mut self, homogeneous: bool) -> Self284 pub fn homogeneous(mut self, homogeneous: bool) -> Self { 285 self.homogeneous = Some(homogeneous); 286 self 287 } 288 spacing(mut self, spacing: i32) -> Self289 pub fn spacing(mut self, spacing: i32) -> Self { 290 self.spacing = Some(spacing); 291 self 292 } 293 border_width(mut self, border_width: u32) -> Self294 pub fn border_width(mut self, border_width: u32) -> Self { 295 self.border_width = Some(border_width); 296 self 297 } 298 child<P: IsA<Widget>>(mut self, child: &P) -> Self299 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 300 self.child = Some(child.clone().upcast()); 301 self 302 } 303 resize_mode(mut self, resize_mode: ResizeMode) -> Self304 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 305 self.resize_mode = Some(resize_mode); 306 self 307 } 308 app_paintable(mut self, app_paintable: bool) -> Self309 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 310 self.app_paintable = Some(app_paintable); 311 self 312 } 313 can_default(mut self, can_default: bool) -> Self314 pub fn can_default(mut self, can_default: bool) -> Self { 315 self.can_default = Some(can_default); 316 self 317 } 318 can_focus(mut self, can_focus: bool) -> Self319 pub fn can_focus(mut self, can_focus: bool) -> Self { 320 self.can_focus = Some(can_focus); 321 self 322 } 323 events(mut self, events: gdk::EventMask) -> Self324 pub fn events(mut self, events: gdk::EventMask) -> Self { 325 self.events = Some(events); 326 self 327 } 328 expand(mut self, expand: bool) -> Self329 pub fn expand(mut self, expand: bool) -> Self { 330 self.expand = Some(expand); 331 self 332 } 333 334 #[cfg(any(feature = "v3_20", feature = "dox"))] 335 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self336 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 337 self.focus_on_click = Some(focus_on_click); 338 self 339 } 340 halign(mut self, halign: Align) -> Self341 pub fn halign(mut self, halign: Align) -> Self { 342 self.halign = Some(halign); 343 self 344 } 345 has_default(mut self, has_default: bool) -> Self346 pub fn has_default(mut self, has_default: bool) -> Self { 347 self.has_default = Some(has_default); 348 self 349 } 350 has_focus(mut self, has_focus: bool) -> Self351 pub fn has_focus(mut self, has_focus: bool) -> Self { 352 self.has_focus = Some(has_focus); 353 self 354 } 355 has_tooltip(mut self, has_tooltip: bool) -> Self356 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 357 self.has_tooltip = Some(has_tooltip); 358 self 359 } 360 height_request(mut self, height_request: i32) -> Self361 pub fn height_request(mut self, height_request: i32) -> Self { 362 self.height_request = Some(height_request); 363 self 364 } 365 hexpand(mut self, hexpand: bool) -> Self366 pub fn hexpand(mut self, hexpand: bool) -> Self { 367 self.hexpand = Some(hexpand); 368 self 369 } 370 hexpand_set(mut self, hexpand_set: bool) -> Self371 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 372 self.hexpand_set = Some(hexpand_set); 373 self 374 } 375 is_focus(mut self, is_focus: bool) -> Self376 pub fn is_focus(mut self, is_focus: bool) -> Self { 377 self.is_focus = Some(is_focus); 378 self 379 } 380 margin(mut self, margin: i32) -> Self381 pub fn margin(mut self, margin: i32) -> Self { 382 self.margin = Some(margin); 383 self 384 } 385 margin_bottom(mut self, margin_bottom: i32) -> Self386 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 387 self.margin_bottom = Some(margin_bottom); 388 self 389 } 390 margin_end(mut self, margin_end: i32) -> Self391 pub fn margin_end(mut self, margin_end: i32) -> Self { 392 self.margin_end = Some(margin_end); 393 self 394 } 395 margin_start(mut self, margin_start: i32) -> Self396 pub fn margin_start(mut self, margin_start: i32) -> Self { 397 self.margin_start = Some(margin_start); 398 self 399 } 400 margin_top(mut self, margin_top: i32) -> Self401 pub fn margin_top(mut self, margin_top: i32) -> Self { 402 self.margin_top = Some(margin_top); 403 self 404 } 405 name(mut self, name: &str) -> Self406 pub fn name(mut self, name: &str) -> Self { 407 self.name = Some(name.to_string()); 408 self 409 } 410 no_show_all(mut self, no_show_all: bool) -> Self411 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 412 self.no_show_all = Some(no_show_all); 413 self 414 } 415 opacity(mut self, opacity: f64) -> Self416 pub fn opacity(mut self, opacity: f64) -> Self { 417 self.opacity = Some(opacity); 418 self 419 } 420 parent<P: IsA<Container>>(mut self, parent: &P) -> Self421 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 422 self.parent = Some(parent.clone().upcast()); 423 self 424 } 425 receives_default(mut self, receives_default: bool) -> Self426 pub fn receives_default(mut self, receives_default: bool) -> Self { 427 self.receives_default = Some(receives_default); 428 self 429 } 430 sensitive(mut self, sensitive: bool) -> Self431 pub fn sensitive(mut self, sensitive: bool) -> Self { 432 self.sensitive = Some(sensitive); 433 self 434 } 435 tooltip_markup(mut self, tooltip_markup: &str) -> Self436 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 437 self.tooltip_markup = Some(tooltip_markup.to_string()); 438 self 439 } 440 tooltip_text(mut self, tooltip_text: &str) -> Self441 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 442 self.tooltip_text = Some(tooltip_text.to_string()); 443 self 444 } 445 valign(mut self, valign: Align) -> Self446 pub fn valign(mut self, valign: Align) -> Self { 447 self.valign = Some(valign); 448 self 449 } 450 vexpand(mut self, vexpand: bool) -> Self451 pub fn vexpand(mut self, vexpand: bool) -> Self { 452 self.vexpand = Some(vexpand); 453 self 454 } 455 vexpand_set(mut self, vexpand_set: bool) -> Self456 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 457 self.vexpand_set = Some(vexpand_set); 458 self 459 } 460 visible(mut self, visible: bool) -> Self461 pub fn visible(mut self, visible: bool) -> Self { 462 self.visible = Some(visible); 463 self 464 } 465 width_request(mut self, width_request: i32) -> Self466 pub fn width_request(mut self, width_request: i32) -> Self { 467 self.width_request = Some(width_request); 468 self 469 } 470 orientation(mut self, orientation: Orientation) -> Self471 pub fn orientation(mut self, orientation: Orientation) -> Self { 472 self.orientation = Some(orientation); 473 self 474 } 475 } 476 477 pub const NONE_INFO_BAR: Option<&InfoBar> = None; 478 479 pub trait InfoBarExt: 'static { 480 #[doc(alias = "gtk_info_bar_add_action_widget")] add_action_widget<P: IsA<Widget>>(&self, child: &P, response_id: ResponseType)481 fn add_action_widget<P: IsA<Widget>>(&self, child: &P, response_id: ResponseType); 482 483 #[doc(alias = "gtk_info_bar_add_button")] add_button(&self, button_text: &str, response_id: ResponseType) -> Option<Button>484 fn add_button(&self, button_text: &str, response_id: ResponseType) -> Option<Button>; 485 486 //#[doc(alias = "gtk_info_bar_add_buttons")] 487 //fn add_buttons(&self, first_button_text: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); 488 489 #[doc(alias = "gtk_info_bar_get_action_area")] 490 #[doc(alias = "get_action_area")] action_area(&self) -> Option<Box>491 fn action_area(&self) -> Option<Box>; 492 493 #[doc(alias = "gtk_info_bar_get_content_area")] 494 #[doc(alias = "get_content_area")] content_area(&self) -> Box495 fn content_area(&self) -> Box; 496 497 #[doc(alias = "gtk_info_bar_get_message_type")] 498 #[doc(alias = "get_message_type")] message_type(&self) -> MessageType499 fn message_type(&self) -> MessageType; 500 501 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 502 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] 503 #[doc(alias = "gtk_info_bar_get_revealed")] 504 #[doc(alias = "get_revealed")] is_revealed(&self) -> bool505 fn is_revealed(&self) -> bool; 506 507 #[doc(alias = "gtk_info_bar_get_show_close_button")] 508 #[doc(alias = "get_show_close_button")] shows_close_button(&self) -> bool509 fn shows_close_button(&self) -> bool; 510 511 #[doc(alias = "gtk_info_bar_response")] response(&self, response_id: ResponseType)512 fn response(&self, response_id: ResponseType); 513 514 #[doc(alias = "gtk_info_bar_set_default_response")] set_default_response(&self, response_id: ResponseType)515 fn set_default_response(&self, response_id: ResponseType); 516 517 #[doc(alias = "gtk_info_bar_set_message_type")] set_message_type(&self, message_type: MessageType)518 fn set_message_type(&self, message_type: MessageType); 519 520 #[doc(alias = "gtk_info_bar_set_response_sensitive")] set_response_sensitive(&self, response_id: ResponseType, setting: bool)521 fn set_response_sensitive(&self, response_id: ResponseType, setting: bool); 522 523 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 524 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] 525 #[doc(alias = "gtk_info_bar_set_revealed")] set_revealed(&self, revealed: bool)526 fn set_revealed(&self, revealed: bool); 527 528 #[doc(alias = "gtk_info_bar_set_show_close_button")] set_show_close_button(&self, setting: bool)529 fn set_show_close_button(&self, setting: bool); 530 531 #[doc(alias = "close")] connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId532 fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 533 emit_close(&self)534 fn emit_close(&self); 535 536 #[doc(alias = "response")] connect_response<F: Fn(&Self, ResponseType) + 'static>(&self, f: F) -> SignalHandlerId537 fn connect_response<F: Fn(&Self, ResponseType) + 'static>(&self, f: F) -> SignalHandlerId; 538 539 #[doc(alias = "message-type")] connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId540 fn connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 541 542 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 543 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] 544 #[doc(alias = "revealed")] connect_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId545 fn connect_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 546 547 #[doc(alias = "show-close-button")] connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId548 fn connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 549 } 550 551 impl<O: IsA<InfoBar>> InfoBarExt for O { add_action_widget<P: IsA<Widget>>(&self, child: &P, response_id: ResponseType)552 fn add_action_widget<P: IsA<Widget>>(&self, child: &P, response_id: ResponseType) { 553 unsafe { 554 ffi::gtk_info_bar_add_action_widget( 555 self.as_ref().to_glib_none().0, 556 child.as_ref().to_glib_none().0, 557 response_id.into_glib(), 558 ); 559 } 560 } 561 add_button(&self, button_text: &str, response_id: ResponseType) -> Option<Button>562 fn add_button(&self, button_text: &str, response_id: ResponseType) -> Option<Button> { 563 unsafe { 564 from_glib_none(ffi::gtk_info_bar_add_button( 565 self.as_ref().to_glib_none().0, 566 button_text.to_glib_none().0, 567 response_id.into_glib(), 568 )) 569 } 570 } 571 572 //fn add_buttons(&self, first_button_text: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { 573 // unsafe { TODO: call ffi:gtk_info_bar_add_buttons() } 574 //} 575 action_area(&self) -> Option<Box>576 fn action_area(&self) -> Option<Box> { 577 unsafe { 578 from_glib_none(ffi::gtk_info_bar_get_action_area( 579 self.as_ref().to_glib_none().0, 580 )) 581 } 582 } 583 content_area(&self) -> Box584 fn content_area(&self) -> Box { 585 unsafe { 586 from_glib_none(ffi::gtk_info_bar_get_content_area( 587 self.as_ref().to_glib_none().0, 588 )) 589 } 590 } 591 message_type(&self) -> MessageType592 fn message_type(&self) -> MessageType { 593 unsafe { 594 from_glib(ffi::gtk_info_bar_get_message_type( 595 self.as_ref().to_glib_none().0, 596 )) 597 } 598 } 599 600 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 601 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] is_revealed(&self) -> bool602 fn is_revealed(&self) -> bool { 603 unsafe { 604 from_glib(ffi::gtk_info_bar_get_revealed( 605 self.as_ref().to_glib_none().0, 606 )) 607 } 608 } 609 shows_close_button(&self) -> bool610 fn shows_close_button(&self) -> bool { 611 unsafe { 612 from_glib(ffi::gtk_info_bar_get_show_close_button( 613 self.as_ref().to_glib_none().0, 614 )) 615 } 616 } 617 response(&self, response_id: ResponseType)618 fn response(&self, response_id: ResponseType) { 619 unsafe { 620 ffi::gtk_info_bar_response(self.as_ref().to_glib_none().0, response_id.into_glib()); 621 } 622 } 623 set_default_response(&self, response_id: ResponseType)624 fn set_default_response(&self, response_id: ResponseType) { 625 unsafe { 626 ffi::gtk_info_bar_set_default_response( 627 self.as_ref().to_glib_none().0, 628 response_id.into_glib(), 629 ); 630 } 631 } 632 set_message_type(&self, message_type: MessageType)633 fn set_message_type(&self, message_type: MessageType) { 634 unsafe { 635 ffi::gtk_info_bar_set_message_type( 636 self.as_ref().to_glib_none().0, 637 message_type.into_glib(), 638 ); 639 } 640 } 641 set_response_sensitive(&self, response_id: ResponseType, setting: bool)642 fn set_response_sensitive(&self, response_id: ResponseType, setting: bool) { 643 unsafe { 644 ffi::gtk_info_bar_set_response_sensitive( 645 self.as_ref().to_glib_none().0, 646 response_id.into_glib(), 647 setting.into_glib(), 648 ); 649 } 650 } 651 652 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 653 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] set_revealed(&self, revealed: bool)654 fn set_revealed(&self, revealed: bool) { 655 unsafe { 656 ffi::gtk_info_bar_set_revealed(self.as_ref().to_glib_none().0, revealed.into_glib()); 657 } 658 } 659 set_show_close_button(&self, setting: bool)660 fn set_show_close_button(&self, setting: bool) { 661 unsafe { 662 ffi::gtk_info_bar_set_show_close_button( 663 self.as_ref().to_glib_none().0, 664 setting.into_glib(), 665 ); 666 } 667 } 668 connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId669 fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 670 unsafe extern "C" fn close_trampoline<P: IsA<InfoBar>, F: Fn(&P) + 'static>( 671 this: *mut ffi::GtkInfoBar, 672 f: glib::ffi::gpointer, 673 ) { 674 let f: &F = &*(f as *const F); 675 f(InfoBar::from_glib_borrow(this).unsafe_cast_ref()) 676 } 677 unsafe { 678 let f: Box_<F> = Box_::new(f); 679 connect_raw( 680 self.as_ptr() as *mut _, 681 b"close\0".as_ptr() as *const _, 682 Some(transmute::<_, unsafe extern "C" fn()>( 683 close_trampoline::<Self, F> as *const (), 684 )), 685 Box_::into_raw(f), 686 ) 687 } 688 } 689 emit_close(&self)690 fn emit_close(&self) { 691 let _ = unsafe { 692 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 693 .emit_by_name("close", &[]) 694 .unwrap() 695 }; 696 } 697 connect_response<F: Fn(&Self, ResponseType) + 'static>(&self, f: F) -> SignalHandlerId698 fn connect_response<F: Fn(&Self, ResponseType) + 'static>(&self, f: F) -> SignalHandlerId { 699 unsafe extern "C" fn response_trampoline< 700 P: IsA<InfoBar>, 701 F: Fn(&P, ResponseType) + 'static, 702 >( 703 this: *mut ffi::GtkInfoBar, 704 response_id: ffi::GtkResponseType, 705 f: glib::ffi::gpointer, 706 ) { 707 let f: &F = &*(f as *const F); 708 f( 709 InfoBar::from_glib_borrow(this).unsafe_cast_ref(), 710 from_glib(response_id), 711 ) 712 } 713 unsafe { 714 let f: Box_<F> = Box_::new(f); 715 connect_raw( 716 self.as_ptr() as *mut _, 717 b"response\0".as_ptr() as *const _, 718 Some(transmute::<_, unsafe extern "C" fn()>( 719 response_trampoline::<Self, F> as *const (), 720 )), 721 Box_::into_raw(f), 722 ) 723 } 724 } 725 connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId726 fn connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 727 unsafe extern "C" fn notify_message_type_trampoline< 728 P: IsA<InfoBar>, 729 F: Fn(&P) + 'static, 730 >( 731 this: *mut ffi::GtkInfoBar, 732 _param_spec: glib::ffi::gpointer, 733 f: glib::ffi::gpointer, 734 ) { 735 let f: &F = &*(f as *const F); 736 f(InfoBar::from_glib_borrow(this).unsafe_cast_ref()) 737 } 738 unsafe { 739 let f: Box_<F> = Box_::new(f); 740 connect_raw( 741 self.as_ptr() as *mut _, 742 b"notify::message-type\0".as_ptr() as *const _, 743 Some(transmute::<_, unsafe extern "C" fn()>( 744 notify_message_type_trampoline::<Self, F> as *const (), 745 )), 746 Box_::into_raw(f), 747 ) 748 } 749 } 750 751 #[cfg(any(feature = "v3_22_29", feature = "dox"))] 752 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_29")))] connect_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId753 fn connect_revealed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 754 unsafe extern "C" fn notify_revealed_trampoline<P: IsA<InfoBar>, F: Fn(&P) + 'static>( 755 this: *mut ffi::GtkInfoBar, 756 _param_spec: glib::ffi::gpointer, 757 f: glib::ffi::gpointer, 758 ) { 759 let f: &F = &*(f as *const F); 760 f(InfoBar::from_glib_borrow(this).unsafe_cast_ref()) 761 } 762 unsafe { 763 let f: Box_<F> = Box_::new(f); 764 connect_raw( 765 self.as_ptr() as *mut _, 766 b"notify::revealed\0".as_ptr() as *const _, 767 Some(transmute::<_, unsafe extern "C" fn()>( 768 notify_revealed_trampoline::<Self, F> as *const (), 769 )), 770 Box_::into_raw(f), 771 ) 772 } 773 } 774 connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId775 fn connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 776 unsafe extern "C" fn notify_show_close_button_trampoline< 777 P: IsA<InfoBar>, 778 F: Fn(&P) + 'static, 779 >( 780 this: *mut ffi::GtkInfoBar, 781 _param_spec: glib::ffi::gpointer, 782 f: glib::ffi::gpointer, 783 ) { 784 let f: &F = &*(f as *const F); 785 f(InfoBar::from_glib_borrow(this).unsafe_cast_ref()) 786 } 787 unsafe { 788 let f: Box_<F> = Box_::new(f); 789 connect_raw( 790 self.as_ptr() as *mut _, 791 b"notify::show-close-button\0".as_ptr() as *const _, 792 Some(transmute::<_, unsafe extern "C" fn()>( 793 notify_show_close_button_trampoline::<Self, F> as *const (), 794 )), 795 Box_::into_raw(f), 796 ) 797 } 798 } 799 } 800 801 impl fmt::Display for InfoBar { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result802 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 803 f.write_str("InfoBar") 804 } 805 } 806