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::PackType; 9 use crate::ResizeMode; 10 use crate::Widget; 11 use glib::object::Cast; 12 use glib::object::IsA; 13 use glib::signal::connect_raw; 14 use glib::signal::SignalHandlerId; 15 use glib::translate::*; 16 use glib::StaticType; 17 use glib::ToValue; 18 use std::boxed::Box as Box_; 19 use std::fmt; 20 use std::mem::transmute; 21 22 glib::wrapper! { 23 #[doc(alias = "GtkHeaderBar")] 24 pub struct HeaderBar(Object<ffi::GtkHeaderBar, ffi::GtkHeaderBarClass>) @extends Container, Widget, @implements Buildable; 25 26 match fn { 27 type_ => || ffi::gtk_header_bar_get_type(), 28 } 29 } 30 31 impl HeaderBar { 32 #[doc(alias = "gtk_header_bar_new")] new() -> HeaderBar33 pub fn new() -> HeaderBar { 34 assert_initialized_main_thread!(); 35 unsafe { Widget::from_glib_none(ffi::gtk_header_bar_new()).unsafe_cast() } 36 } 37 38 // rustdoc-stripper-ignore-next 39 /// Creates a new builder-pattern struct instance to construct [`HeaderBar`] objects. 40 /// 41 /// This method returns an instance of [`HeaderBarBuilder`] which can be used to create [`HeaderBar`] objects. builder() -> HeaderBarBuilder42 pub fn builder() -> HeaderBarBuilder { 43 HeaderBarBuilder::default() 44 } 45 } 46 47 impl Default for HeaderBar { 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 [`HeaderBar`] objects. 56 /// 57 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 58 pub struct HeaderBarBuilder { 59 custom_title: Option<Widget>, 60 decoration_layout: Option<String>, 61 decoration_layout_set: Option<bool>, 62 has_subtitle: Option<bool>, 63 show_close_button: Option<bool>, 64 spacing: Option<i32>, 65 subtitle: Option<String>, 66 title: Option<String>, 67 border_width: Option<u32>, 68 child: Option<Widget>, 69 resize_mode: Option<ResizeMode>, 70 app_paintable: Option<bool>, 71 can_default: Option<bool>, 72 can_focus: Option<bool>, 73 events: Option<gdk::EventMask>, 74 expand: Option<bool>, 75 #[cfg(any(feature = "v3_20", feature = "dox"))] 76 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 77 focus_on_click: Option<bool>, 78 halign: Option<Align>, 79 has_default: Option<bool>, 80 has_focus: Option<bool>, 81 has_tooltip: Option<bool>, 82 height_request: Option<i32>, 83 hexpand: Option<bool>, 84 hexpand_set: Option<bool>, 85 is_focus: Option<bool>, 86 margin: Option<i32>, 87 margin_bottom: Option<i32>, 88 margin_end: Option<i32>, 89 margin_start: Option<i32>, 90 margin_top: Option<i32>, 91 name: Option<String>, 92 no_show_all: Option<bool>, 93 opacity: Option<f64>, 94 parent: Option<Container>, 95 receives_default: Option<bool>, 96 sensitive: Option<bool>, 97 tooltip_markup: Option<String>, 98 tooltip_text: Option<String>, 99 valign: Option<Align>, 100 vexpand: Option<bool>, 101 vexpand_set: Option<bool>, 102 visible: Option<bool>, 103 width_request: Option<i32>, 104 } 105 106 impl HeaderBarBuilder { 107 // rustdoc-stripper-ignore-next 108 /// Create a new [`HeaderBarBuilder`]. new() -> Self109 pub fn new() -> Self { 110 Self::default() 111 } 112 113 // rustdoc-stripper-ignore-next 114 /// Build the [`HeaderBar`]. build(self) -> HeaderBar115 pub fn build(self) -> HeaderBar { 116 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 117 if let Some(ref custom_title) = self.custom_title { 118 properties.push(("custom-title", custom_title)); 119 } 120 if let Some(ref decoration_layout) = self.decoration_layout { 121 properties.push(("decoration-layout", decoration_layout)); 122 } 123 if let Some(ref decoration_layout_set) = self.decoration_layout_set { 124 properties.push(("decoration-layout-set", decoration_layout_set)); 125 } 126 if let Some(ref has_subtitle) = self.has_subtitle { 127 properties.push(("has-subtitle", has_subtitle)); 128 } 129 if let Some(ref show_close_button) = self.show_close_button { 130 properties.push(("show-close-button", show_close_button)); 131 } 132 if let Some(ref spacing) = self.spacing { 133 properties.push(("spacing", spacing)); 134 } 135 if let Some(ref subtitle) = self.subtitle { 136 properties.push(("subtitle", subtitle)); 137 } 138 if let Some(ref title) = self.title { 139 properties.push(("title", title)); 140 } 141 if let Some(ref border_width) = self.border_width { 142 properties.push(("border-width", border_width)); 143 } 144 if let Some(ref child) = self.child { 145 properties.push(("child", child)); 146 } 147 if let Some(ref resize_mode) = self.resize_mode { 148 properties.push(("resize-mode", resize_mode)); 149 } 150 if let Some(ref app_paintable) = self.app_paintable { 151 properties.push(("app-paintable", app_paintable)); 152 } 153 if let Some(ref can_default) = self.can_default { 154 properties.push(("can-default", can_default)); 155 } 156 if let Some(ref can_focus) = self.can_focus { 157 properties.push(("can-focus", can_focus)); 158 } 159 if let Some(ref events) = self.events { 160 properties.push(("events", events)); 161 } 162 if let Some(ref expand) = self.expand { 163 properties.push(("expand", expand)); 164 } 165 #[cfg(any(feature = "v3_20", feature = "dox"))] 166 if let Some(ref focus_on_click) = self.focus_on_click { 167 properties.push(("focus-on-click", focus_on_click)); 168 } 169 if let Some(ref halign) = self.halign { 170 properties.push(("halign", halign)); 171 } 172 if let Some(ref has_default) = self.has_default { 173 properties.push(("has-default", has_default)); 174 } 175 if let Some(ref has_focus) = self.has_focus { 176 properties.push(("has-focus", has_focus)); 177 } 178 if let Some(ref has_tooltip) = self.has_tooltip { 179 properties.push(("has-tooltip", has_tooltip)); 180 } 181 if let Some(ref height_request) = self.height_request { 182 properties.push(("height-request", height_request)); 183 } 184 if let Some(ref hexpand) = self.hexpand { 185 properties.push(("hexpand", hexpand)); 186 } 187 if let Some(ref hexpand_set) = self.hexpand_set { 188 properties.push(("hexpand-set", hexpand_set)); 189 } 190 if let Some(ref is_focus) = self.is_focus { 191 properties.push(("is-focus", is_focus)); 192 } 193 if let Some(ref margin) = self.margin { 194 properties.push(("margin", margin)); 195 } 196 if let Some(ref margin_bottom) = self.margin_bottom { 197 properties.push(("margin-bottom", margin_bottom)); 198 } 199 if let Some(ref margin_end) = self.margin_end { 200 properties.push(("margin-end", margin_end)); 201 } 202 if let Some(ref margin_start) = self.margin_start { 203 properties.push(("margin-start", margin_start)); 204 } 205 if let Some(ref margin_top) = self.margin_top { 206 properties.push(("margin-top", margin_top)); 207 } 208 if let Some(ref name) = self.name { 209 properties.push(("name", name)); 210 } 211 if let Some(ref no_show_all) = self.no_show_all { 212 properties.push(("no-show-all", no_show_all)); 213 } 214 if let Some(ref opacity) = self.opacity { 215 properties.push(("opacity", opacity)); 216 } 217 if let Some(ref parent) = self.parent { 218 properties.push(("parent", parent)); 219 } 220 if let Some(ref receives_default) = self.receives_default { 221 properties.push(("receives-default", receives_default)); 222 } 223 if let Some(ref sensitive) = self.sensitive { 224 properties.push(("sensitive", sensitive)); 225 } 226 if let Some(ref tooltip_markup) = self.tooltip_markup { 227 properties.push(("tooltip-markup", tooltip_markup)); 228 } 229 if let Some(ref tooltip_text) = self.tooltip_text { 230 properties.push(("tooltip-text", tooltip_text)); 231 } 232 if let Some(ref valign) = self.valign { 233 properties.push(("valign", valign)); 234 } 235 if let Some(ref vexpand) = self.vexpand { 236 properties.push(("vexpand", vexpand)); 237 } 238 if let Some(ref vexpand_set) = self.vexpand_set { 239 properties.push(("vexpand-set", vexpand_set)); 240 } 241 if let Some(ref visible) = self.visible { 242 properties.push(("visible", visible)); 243 } 244 if let Some(ref width_request) = self.width_request { 245 properties.push(("width-request", width_request)); 246 } 247 glib::Object::new::<HeaderBar>(&properties) 248 .expect("Failed to create an instance of HeaderBar") 249 } 250 custom_title<P: IsA<Widget>>(mut self, custom_title: &P) -> Self251 pub fn custom_title<P: IsA<Widget>>(mut self, custom_title: &P) -> Self { 252 self.custom_title = Some(custom_title.clone().upcast()); 253 self 254 } 255 decoration_layout(mut self, decoration_layout: &str) -> Self256 pub fn decoration_layout(mut self, decoration_layout: &str) -> Self { 257 self.decoration_layout = Some(decoration_layout.to_string()); 258 self 259 } 260 decoration_layout_set(mut self, decoration_layout_set: bool) -> Self261 pub fn decoration_layout_set(mut self, decoration_layout_set: bool) -> Self { 262 self.decoration_layout_set = Some(decoration_layout_set); 263 self 264 } 265 has_subtitle(mut self, has_subtitle: bool) -> Self266 pub fn has_subtitle(mut self, has_subtitle: bool) -> Self { 267 self.has_subtitle = Some(has_subtitle); 268 self 269 } 270 show_close_button(mut self, show_close_button: bool) -> Self271 pub fn show_close_button(mut self, show_close_button: bool) -> Self { 272 self.show_close_button = Some(show_close_button); 273 self 274 } 275 spacing(mut self, spacing: i32) -> Self276 pub fn spacing(mut self, spacing: i32) -> Self { 277 self.spacing = Some(spacing); 278 self 279 } 280 subtitle(mut self, subtitle: &str) -> Self281 pub fn subtitle(mut self, subtitle: &str) -> Self { 282 self.subtitle = Some(subtitle.to_string()); 283 self 284 } 285 title(mut self, title: &str) -> Self286 pub fn title(mut self, title: &str) -> Self { 287 self.title = Some(title.to_string()); 288 self 289 } 290 border_width(mut self, border_width: u32) -> Self291 pub fn border_width(mut self, border_width: u32) -> Self { 292 self.border_width = Some(border_width); 293 self 294 } 295 child<P: IsA<Widget>>(mut self, child: &P) -> Self296 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 297 self.child = Some(child.clone().upcast()); 298 self 299 } 300 resize_mode(mut self, resize_mode: ResizeMode) -> Self301 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 302 self.resize_mode = Some(resize_mode); 303 self 304 } 305 app_paintable(mut self, app_paintable: bool) -> Self306 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 307 self.app_paintable = Some(app_paintable); 308 self 309 } 310 can_default(mut self, can_default: bool) -> Self311 pub fn can_default(mut self, can_default: bool) -> Self { 312 self.can_default = Some(can_default); 313 self 314 } 315 can_focus(mut self, can_focus: bool) -> Self316 pub fn can_focus(mut self, can_focus: bool) -> Self { 317 self.can_focus = Some(can_focus); 318 self 319 } 320 events(mut self, events: gdk::EventMask) -> Self321 pub fn events(mut self, events: gdk::EventMask) -> Self { 322 self.events = Some(events); 323 self 324 } 325 expand(mut self, expand: bool) -> Self326 pub fn expand(mut self, expand: bool) -> Self { 327 self.expand = Some(expand); 328 self 329 } 330 331 #[cfg(any(feature = "v3_20", feature = "dox"))] 332 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self333 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 334 self.focus_on_click = Some(focus_on_click); 335 self 336 } 337 halign(mut self, halign: Align) -> Self338 pub fn halign(mut self, halign: Align) -> Self { 339 self.halign = Some(halign); 340 self 341 } 342 has_default(mut self, has_default: bool) -> Self343 pub fn has_default(mut self, has_default: bool) -> Self { 344 self.has_default = Some(has_default); 345 self 346 } 347 has_focus(mut self, has_focus: bool) -> Self348 pub fn has_focus(mut self, has_focus: bool) -> Self { 349 self.has_focus = Some(has_focus); 350 self 351 } 352 has_tooltip(mut self, has_tooltip: bool) -> Self353 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 354 self.has_tooltip = Some(has_tooltip); 355 self 356 } 357 height_request(mut self, height_request: i32) -> Self358 pub fn height_request(mut self, height_request: i32) -> Self { 359 self.height_request = Some(height_request); 360 self 361 } 362 hexpand(mut self, hexpand: bool) -> Self363 pub fn hexpand(mut self, hexpand: bool) -> Self { 364 self.hexpand = Some(hexpand); 365 self 366 } 367 hexpand_set(mut self, hexpand_set: bool) -> Self368 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 369 self.hexpand_set = Some(hexpand_set); 370 self 371 } 372 is_focus(mut self, is_focus: bool) -> Self373 pub fn is_focus(mut self, is_focus: bool) -> Self { 374 self.is_focus = Some(is_focus); 375 self 376 } 377 margin(mut self, margin: i32) -> Self378 pub fn margin(mut self, margin: i32) -> Self { 379 self.margin = Some(margin); 380 self 381 } 382 margin_bottom(mut self, margin_bottom: i32) -> Self383 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 384 self.margin_bottom = Some(margin_bottom); 385 self 386 } 387 margin_end(mut self, margin_end: i32) -> Self388 pub fn margin_end(mut self, margin_end: i32) -> Self { 389 self.margin_end = Some(margin_end); 390 self 391 } 392 margin_start(mut self, margin_start: i32) -> Self393 pub fn margin_start(mut self, margin_start: i32) -> Self { 394 self.margin_start = Some(margin_start); 395 self 396 } 397 margin_top(mut self, margin_top: i32) -> Self398 pub fn margin_top(mut self, margin_top: i32) -> Self { 399 self.margin_top = Some(margin_top); 400 self 401 } 402 name(mut self, name: &str) -> Self403 pub fn name(mut self, name: &str) -> Self { 404 self.name = Some(name.to_string()); 405 self 406 } 407 no_show_all(mut self, no_show_all: bool) -> Self408 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 409 self.no_show_all = Some(no_show_all); 410 self 411 } 412 opacity(mut self, opacity: f64) -> Self413 pub fn opacity(mut self, opacity: f64) -> Self { 414 self.opacity = Some(opacity); 415 self 416 } 417 parent<P: IsA<Container>>(mut self, parent: &P) -> Self418 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 419 self.parent = Some(parent.clone().upcast()); 420 self 421 } 422 receives_default(mut self, receives_default: bool) -> Self423 pub fn receives_default(mut self, receives_default: bool) -> Self { 424 self.receives_default = Some(receives_default); 425 self 426 } 427 sensitive(mut self, sensitive: bool) -> Self428 pub fn sensitive(mut self, sensitive: bool) -> Self { 429 self.sensitive = Some(sensitive); 430 self 431 } 432 tooltip_markup(mut self, tooltip_markup: &str) -> Self433 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 434 self.tooltip_markup = Some(tooltip_markup.to_string()); 435 self 436 } 437 tooltip_text(mut self, tooltip_text: &str) -> Self438 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 439 self.tooltip_text = Some(tooltip_text.to_string()); 440 self 441 } 442 valign(mut self, valign: Align) -> Self443 pub fn valign(mut self, valign: Align) -> Self { 444 self.valign = Some(valign); 445 self 446 } 447 vexpand(mut self, vexpand: bool) -> Self448 pub fn vexpand(mut self, vexpand: bool) -> Self { 449 self.vexpand = Some(vexpand); 450 self 451 } 452 vexpand_set(mut self, vexpand_set: bool) -> Self453 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 454 self.vexpand_set = Some(vexpand_set); 455 self 456 } 457 visible(mut self, visible: bool) -> Self458 pub fn visible(mut self, visible: bool) -> Self { 459 self.visible = Some(visible); 460 self 461 } 462 width_request(mut self, width_request: i32) -> Self463 pub fn width_request(mut self, width_request: i32) -> Self { 464 self.width_request = Some(width_request); 465 self 466 } 467 } 468 469 pub const NONE_HEADER_BAR: Option<&HeaderBar> = None; 470 471 pub trait HeaderBarExt: 'static { 472 #[doc(alias = "gtk_header_bar_get_custom_title")] 473 #[doc(alias = "get_custom_title")] custom_title(&self) -> Option<Widget>474 fn custom_title(&self) -> Option<Widget>; 475 476 #[doc(alias = "gtk_header_bar_get_decoration_layout")] 477 #[doc(alias = "get_decoration_layout")] decoration_layout(&self) -> Option<glib::GString>478 fn decoration_layout(&self) -> Option<glib::GString>; 479 480 #[doc(alias = "gtk_header_bar_get_has_subtitle")] 481 #[doc(alias = "get_has_subtitle")] has_subtitle(&self) -> bool482 fn has_subtitle(&self) -> bool; 483 484 #[doc(alias = "gtk_header_bar_get_show_close_button")] 485 #[doc(alias = "get_show_close_button")] shows_close_button(&self) -> bool486 fn shows_close_button(&self) -> bool; 487 488 #[doc(alias = "gtk_header_bar_get_subtitle")] 489 #[doc(alias = "get_subtitle")] subtitle(&self) -> Option<glib::GString>490 fn subtitle(&self) -> Option<glib::GString>; 491 492 #[doc(alias = "gtk_header_bar_get_title")] 493 #[doc(alias = "get_title")] title(&self) -> Option<glib::GString>494 fn title(&self) -> Option<glib::GString>; 495 496 #[doc(alias = "gtk_header_bar_pack_end")] pack_end<P: IsA<Widget>>(&self, child: &P)497 fn pack_end<P: IsA<Widget>>(&self, child: &P); 498 499 #[doc(alias = "gtk_header_bar_pack_start")] pack_start<P: IsA<Widget>>(&self, child: &P)500 fn pack_start<P: IsA<Widget>>(&self, child: &P); 501 502 #[doc(alias = "gtk_header_bar_set_custom_title")] set_custom_title<P: IsA<Widget>>(&self, title_widget: Option<&P>)503 fn set_custom_title<P: IsA<Widget>>(&self, title_widget: Option<&P>); 504 505 #[doc(alias = "gtk_header_bar_set_decoration_layout")] set_decoration_layout(&self, layout: Option<&str>)506 fn set_decoration_layout(&self, layout: Option<&str>); 507 508 #[doc(alias = "gtk_header_bar_set_has_subtitle")] set_has_subtitle(&self, setting: bool)509 fn set_has_subtitle(&self, setting: bool); 510 511 #[doc(alias = "gtk_header_bar_set_show_close_button")] set_show_close_button(&self, setting: bool)512 fn set_show_close_button(&self, setting: bool); 513 514 #[doc(alias = "gtk_header_bar_set_subtitle")] set_subtitle(&self, subtitle: Option<&str>)515 fn set_subtitle(&self, subtitle: Option<&str>); 516 517 #[doc(alias = "gtk_header_bar_set_title")] set_title(&self, title: Option<&str>)518 fn set_title(&self, title: Option<&str>); 519 520 #[doc(alias = "decoration-layout-set")] is_decoration_layout_set(&self) -> bool521 fn is_decoration_layout_set(&self) -> bool; 522 523 #[doc(alias = "decoration-layout-set")] set_decoration_layout_set(&self, decoration_layout_set: bool)524 fn set_decoration_layout_set(&self, decoration_layout_set: bool); 525 spacing(&self) -> i32526 fn spacing(&self) -> i32; 527 set_spacing(&self, spacing: i32)528 fn set_spacing(&self, spacing: i32); 529 530 #[doc(alias = "child.pack-type")] child_pack_type<T: IsA<Widget>>(&self, item: &T) -> PackType531 fn child_pack_type<T: IsA<Widget>>(&self, item: &T) -> PackType; 532 533 #[doc(alias = "child.pack-type")] set_child_pack_type<T: IsA<Widget>>(&self, item: &T, pack_type: PackType)534 fn set_child_pack_type<T: IsA<Widget>>(&self, item: &T, pack_type: PackType); 535 child_position<T: IsA<Widget>>(&self, item: &T) -> i32536 fn child_position<T: IsA<Widget>>(&self, item: &T) -> i32; 537 set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32)538 fn set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32); 539 540 #[doc(alias = "custom-title")] connect_custom_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId541 fn connect_custom_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 542 543 #[doc(alias = "decoration-layout")] connect_decoration_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId544 fn connect_decoration_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 545 546 #[doc(alias = "decoration-layout-set")] connect_decoration_layout_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId547 fn connect_decoration_layout_set_notify<F: Fn(&Self) + 'static>(&self, f: F) 548 -> SignalHandlerId; 549 550 #[doc(alias = "has-subtitle")] connect_has_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId551 fn connect_has_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 552 553 #[doc(alias = "show-close-button")] connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId554 fn connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 555 556 #[doc(alias = "spacing")] connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId557 fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 558 559 #[doc(alias = "subtitle")] connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId560 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 561 562 #[doc(alias = "title")] connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId563 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 564 } 565 566 impl<O: IsA<HeaderBar>> HeaderBarExt for O { custom_title(&self) -> Option<Widget>567 fn custom_title(&self) -> Option<Widget> { 568 unsafe { 569 from_glib_none(ffi::gtk_header_bar_get_custom_title( 570 self.as_ref().to_glib_none().0, 571 )) 572 } 573 } 574 decoration_layout(&self) -> Option<glib::GString>575 fn decoration_layout(&self) -> Option<glib::GString> { 576 unsafe { 577 from_glib_none(ffi::gtk_header_bar_get_decoration_layout( 578 self.as_ref().to_glib_none().0, 579 )) 580 } 581 } 582 has_subtitle(&self) -> bool583 fn has_subtitle(&self) -> bool { 584 unsafe { 585 from_glib(ffi::gtk_header_bar_get_has_subtitle( 586 self.as_ref().to_glib_none().0, 587 )) 588 } 589 } 590 shows_close_button(&self) -> bool591 fn shows_close_button(&self) -> bool { 592 unsafe { 593 from_glib(ffi::gtk_header_bar_get_show_close_button( 594 self.as_ref().to_glib_none().0, 595 )) 596 } 597 } 598 subtitle(&self) -> Option<glib::GString>599 fn subtitle(&self) -> Option<glib::GString> { 600 unsafe { 601 from_glib_none(ffi::gtk_header_bar_get_subtitle( 602 self.as_ref().to_glib_none().0, 603 )) 604 } 605 } 606 title(&self) -> Option<glib::GString>607 fn title(&self) -> Option<glib::GString> { 608 unsafe { 609 from_glib_none(ffi::gtk_header_bar_get_title( 610 self.as_ref().to_glib_none().0, 611 )) 612 } 613 } 614 pack_end<P: IsA<Widget>>(&self, child: &P)615 fn pack_end<P: IsA<Widget>>(&self, child: &P) { 616 unsafe { 617 ffi::gtk_header_bar_pack_end( 618 self.as_ref().to_glib_none().0, 619 child.as_ref().to_glib_none().0, 620 ); 621 } 622 } 623 pack_start<P: IsA<Widget>>(&self, child: &P)624 fn pack_start<P: IsA<Widget>>(&self, child: &P) { 625 unsafe { 626 ffi::gtk_header_bar_pack_start( 627 self.as_ref().to_glib_none().0, 628 child.as_ref().to_glib_none().0, 629 ); 630 } 631 } 632 set_custom_title<P: IsA<Widget>>(&self, title_widget: Option<&P>)633 fn set_custom_title<P: IsA<Widget>>(&self, title_widget: Option<&P>) { 634 unsafe { 635 ffi::gtk_header_bar_set_custom_title( 636 self.as_ref().to_glib_none().0, 637 title_widget.map(|p| p.as_ref()).to_glib_none().0, 638 ); 639 } 640 } 641 set_decoration_layout(&self, layout: Option<&str>)642 fn set_decoration_layout(&self, layout: Option<&str>) { 643 unsafe { 644 ffi::gtk_header_bar_set_decoration_layout( 645 self.as_ref().to_glib_none().0, 646 layout.to_glib_none().0, 647 ); 648 } 649 } 650 set_has_subtitle(&self, setting: bool)651 fn set_has_subtitle(&self, setting: bool) { 652 unsafe { 653 ffi::gtk_header_bar_set_has_subtitle( 654 self.as_ref().to_glib_none().0, 655 setting.into_glib(), 656 ); 657 } 658 } 659 set_show_close_button(&self, setting: bool)660 fn set_show_close_button(&self, setting: bool) { 661 unsafe { 662 ffi::gtk_header_bar_set_show_close_button( 663 self.as_ref().to_glib_none().0, 664 setting.into_glib(), 665 ); 666 } 667 } 668 set_subtitle(&self, subtitle: Option<&str>)669 fn set_subtitle(&self, subtitle: Option<&str>) { 670 unsafe { 671 ffi::gtk_header_bar_set_subtitle( 672 self.as_ref().to_glib_none().0, 673 subtitle.to_glib_none().0, 674 ); 675 } 676 } 677 set_title(&self, title: Option<&str>)678 fn set_title(&self, title: Option<&str>) { 679 unsafe { 680 ffi::gtk_header_bar_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0); 681 } 682 } 683 is_decoration_layout_set(&self) -> bool684 fn is_decoration_layout_set(&self) -> bool { 685 unsafe { 686 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 687 glib::gobject_ffi::g_object_get_property( 688 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 689 b"decoration-layout-set\0".as_ptr() as *const _, 690 value.to_glib_none_mut().0, 691 ); 692 value 693 .get() 694 .expect("Return Value for property `decoration-layout-set` getter") 695 } 696 } 697 set_decoration_layout_set(&self, decoration_layout_set: bool)698 fn set_decoration_layout_set(&self, decoration_layout_set: bool) { 699 unsafe { 700 glib::gobject_ffi::g_object_set_property( 701 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 702 b"decoration-layout-set\0".as_ptr() as *const _, 703 decoration_layout_set.to_value().to_glib_none().0, 704 ); 705 } 706 } 707 spacing(&self) -> i32708 fn spacing(&self) -> i32 { 709 unsafe { 710 let mut value = glib::Value::from_type(<i32 as StaticType>::static_type()); 711 glib::gobject_ffi::g_object_get_property( 712 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 713 b"spacing\0".as_ptr() as *const _, 714 value.to_glib_none_mut().0, 715 ); 716 value 717 .get() 718 .expect("Return Value for property `spacing` getter") 719 } 720 } 721 set_spacing(&self, spacing: i32)722 fn set_spacing(&self, spacing: i32) { 723 unsafe { 724 glib::gobject_ffi::g_object_set_property( 725 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 726 b"spacing\0".as_ptr() as *const _, 727 spacing.to_value().to_glib_none().0, 728 ); 729 } 730 } 731 child_pack_type<T: IsA<Widget>>(&self, item: &T) -> PackType732 fn child_pack_type<T: IsA<Widget>>(&self, item: &T) -> PackType { 733 unsafe { 734 let mut value = glib::Value::from_type(<PackType as StaticType>::static_type()); 735 crate::ffi::gtk_container_child_get_property( 736 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 737 item.to_glib_none().0 as *mut _, 738 b"pack-type\0".as_ptr() as *const _, 739 value.to_glib_none_mut().0, 740 ); 741 value 742 .get() 743 .expect("Return Value for property `pack-type` getter") 744 } 745 } 746 set_child_pack_type<T: IsA<Widget>>(&self, item: &T, pack_type: PackType)747 fn set_child_pack_type<T: IsA<Widget>>(&self, item: &T, pack_type: PackType) { 748 unsafe { 749 crate::ffi::gtk_container_child_set_property( 750 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 751 item.to_glib_none().0 as *mut _, 752 b"pack-type\0".as_ptr() as *const _, 753 pack_type.to_value().to_glib_none().0, 754 ); 755 } 756 } 757 child_position<T: IsA<Widget>>(&self, item: &T) -> i32758 fn child_position<T: IsA<Widget>>(&self, item: &T) -> i32 { 759 unsafe { 760 let mut value = glib::Value::from_type(<i32 as StaticType>::static_type()); 761 crate::ffi::gtk_container_child_get_property( 762 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 763 item.to_glib_none().0 as *mut _, 764 b"position\0".as_ptr() as *const _, 765 value.to_glib_none_mut().0, 766 ); 767 value 768 .get() 769 .expect("Return Value for property `position` getter") 770 } 771 } 772 set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32)773 fn set_child_position<T: IsA<Widget>>(&self, item: &T, position: i32) { 774 unsafe { 775 crate::ffi::gtk_container_child_set_property( 776 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 777 item.to_glib_none().0 as *mut _, 778 b"position\0".as_ptr() as *const _, 779 position.to_value().to_glib_none().0, 780 ); 781 } 782 } 783 connect_custom_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId784 fn connect_custom_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 785 unsafe extern "C" fn notify_custom_title_trampoline< 786 P: IsA<HeaderBar>, 787 F: Fn(&P) + 'static, 788 >( 789 this: *mut ffi::GtkHeaderBar, 790 _param_spec: glib::ffi::gpointer, 791 f: glib::ffi::gpointer, 792 ) { 793 let f: &F = &*(f as *const F); 794 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 795 } 796 unsafe { 797 let f: Box_<F> = Box_::new(f); 798 connect_raw( 799 self.as_ptr() as *mut _, 800 b"notify::custom-title\0".as_ptr() as *const _, 801 Some(transmute::<_, unsafe extern "C" fn()>( 802 notify_custom_title_trampoline::<Self, F> as *const (), 803 )), 804 Box_::into_raw(f), 805 ) 806 } 807 } 808 connect_decoration_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId809 fn connect_decoration_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 810 unsafe extern "C" fn notify_decoration_layout_trampoline< 811 P: IsA<HeaderBar>, 812 F: Fn(&P) + 'static, 813 >( 814 this: *mut ffi::GtkHeaderBar, 815 _param_spec: glib::ffi::gpointer, 816 f: glib::ffi::gpointer, 817 ) { 818 let f: &F = &*(f as *const F); 819 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 820 } 821 unsafe { 822 let f: Box_<F> = Box_::new(f); 823 connect_raw( 824 self.as_ptr() as *mut _, 825 b"notify::decoration-layout\0".as_ptr() as *const _, 826 Some(transmute::<_, unsafe extern "C" fn()>( 827 notify_decoration_layout_trampoline::<Self, F> as *const (), 828 )), 829 Box_::into_raw(f), 830 ) 831 } 832 } 833 connect_decoration_layout_set_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId834 fn connect_decoration_layout_set_notify<F: Fn(&Self) + 'static>( 835 &self, 836 f: F, 837 ) -> SignalHandlerId { 838 unsafe extern "C" fn notify_decoration_layout_set_trampoline< 839 P: IsA<HeaderBar>, 840 F: Fn(&P) + 'static, 841 >( 842 this: *mut ffi::GtkHeaderBar, 843 _param_spec: glib::ffi::gpointer, 844 f: glib::ffi::gpointer, 845 ) { 846 let f: &F = &*(f as *const F); 847 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 848 } 849 unsafe { 850 let f: Box_<F> = Box_::new(f); 851 connect_raw( 852 self.as_ptr() as *mut _, 853 b"notify::decoration-layout-set\0".as_ptr() as *const _, 854 Some(transmute::<_, unsafe extern "C" fn()>( 855 notify_decoration_layout_set_trampoline::<Self, F> as *const (), 856 )), 857 Box_::into_raw(f), 858 ) 859 } 860 } 861 connect_has_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId862 fn connect_has_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 863 unsafe extern "C" fn notify_has_subtitle_trampoline< 864 P: IsA<HeaderBar>, 865 F: Fn(&P) + 'static, 866 >( 867 this: *mut ffi::GtkHeaderBar, 868 _param_spec: glib::ffi::gpointer, 869 f: glib::ffi::gpointer, 870 ) { 871 let f: &F = &*(f as *const F); 872 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 873 } 874 unsafe { 875 let f: Box_<F> = Box_::new(f); 876 connect_raw( 877 self.as_ptr() as *mut _, 878 b"notify::has-subtitle\0".as_ptr() as *const _, 879 Some(transmute::<_, unsafe extern "C" fn()>( 880 notify_has_subtitle_trampoline::<Self, F> as *const (), 881 )), 882 Box_::into_raw(f), 883 ) 884 } 885 } 886 connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId887 fn connect_show_close_button_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 888 unsafe extern "C" fn notify_show_close_button_trampoline< 889 P: IsA<HeaderBar>, 890 F: Fn(&P) + 'static, 891 >( 892 this: *mut ffi::GtkHeaderBar, 893 _param_spec: glib::ffi::gpointer, 894 f: glib::ffi::gpointer, 895 ) { 896 let f: &F = &*(f as *const F); 897 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 898 } 899 unsafe { 900 let f: Box_<F> = Box_::new(f); 901 connect_raw( 902 self.as_ptr() as *mut _, 903 b"notify::show-close-button\0".as_ptr() as *const _, 904 Some(transmute::<_, unsafe extern "C" fn()>( 905 notify_show_close_button_trampoline::<Self, F> as *const (), 906 )), 907 Box_::into_raw(f), 908 ) 909 } 910 } 911 connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId912 fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 913 unsafe extern "C" fn notify_spacing_trampoline<P: IsA<HeaderBar>, F: Fn(&P) + 'static>( 914 this: *mut ffi::GtkHeaderBar, 915 _param_spec: glib::ffi::gpointer, 916 f: glib::ffi::gpointer, 917 ) { 918 let f: &F = &*(f as *const F); 919 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 920 } 921 unsafe { 922 let f: Box_<F> = Box_::new(f); 923 connect_raw( 924 self.as_ptr() as *mut _, 925 b"notify::spacing\0".as_ptr() as *const _, 926 Some(transmute::<_, unsafe extern "C" fn()>( 927 notify_spacing_trampoline::<Self, F> as *const (), 928 )), 929 Box_::into_raw(f), 930 ) 931 } 932 } 933 connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId934 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 935 unsafe extern "C" fn notify_subtitle_trampoline<P: IsA<HeaderBar>, F: Fn(&P) + 'static>( 936 this: *mut ffi::GtkHeaderBar, 937 _param_spec: glib::ffi::gpointer, 938 f: glib::ffi::gpointer, 939 ) { 940 let f: &F = &*(f as *const F); 941 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 942 } 943 unsafe { 944 let f: Box_<F> = Box_::new(f); 945 connect_raw( 946 self.as_ptr() as *mut _, 947 b"notify::subtitle\0".as_ptr() as *const _, 948 Some(transmute::<_, unsafe extern "C" fn()>( 949 notify_subtitle_trampoline::<Self, F> as *const (), 950 )), 951 Box_::into_raw(f), 952 ) 953 } 954 } 955 connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId956 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 957 unsafe extern "C" fn notify_title_trampoline<P: IsA<HeaderBar>, F: Fn(&P) + 'static>( 958 this: *mut ffi::GtkHeaderBar, 959 _param_spec: glib::ffi::gpointer, 960 f: glib::ffi::gpointer, 961 ) { 962 let f: &F = &*(f as *const F); 963 f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) 964 } 965 unsafe { 966 let f: Box_<F> = Box_::new(f); 967 connect_raw( 968 self.as_ptr() as *mut _, 969 b"notify::title\0".as_ptr() as *const _, 970 Some(transmute::<_, unsafe extern "C" fn()>( 971 notify_title_trampoline::<Self, F> as *const (), 972 )), 973 Box_::into_raw(f), 974 ) 975 } 976 } 977 } 978 979 impl fmt::Display for HeaderBar { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result980 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 981 f.write_str("HeaderBar") 982 } 983 } 984