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::IconSize; 9 use crate::Orientable; 10 use crate::Orientation; 11 use crate::ResizeMode; 12 use crate::ToolItem; 13 use crate::ToolShell; 14 use crate::ToolbarStyle; 15 use crate::Widget; 16 use glib::object::Cast; 17 use glib::object::IsA; 18 use glib::object::ObjectExt; 19 use glib::signal::connect_raw; 20 use glib::signal::SignalHandlerId; 21 use glib::translate::*; 22 use glib::StaticType; 23 use glib::ToValue; 24 use std::boxed::Box as Box_; 25 use std::fmt; 26 use std::mem::transmute; 27 28 glib::wrapper! { 29 #[doc(alias = "GtkToolbar")] 30 pub struct Toolbar(Object<ffi::GtkToolbar, ffi::GtkToolbarClass>) @extends Container, Widget, @implements Buildable, Orientable, ToolShell; 31 32 match fn { 33 type_ => || ffi::gtk_toolbar_get_type(), 34 } 35 } 36 37 impl Toolbar { 38 #[doc(alias = "gtk_toolbar_new")] new() -> Toolbar39 pub fn new() -> Toolbar { 40 assert_initialized_main_thread!(); 41 unsafe { Widget::from_glib_none(ffi::gtk_toolbar_new()).unsafe_cast() } 42 } 43 44 // rustdoc-stripper-ignore-next 45 /// Creates a new builder-pattern struct instance to construct [`Toolbar`] objects. 46 /// 47 /// This method returns an instance of [`ToolbarBuilder`] which can be used to create [`Toolbar`] objects. builder() -> ToolbarBuilder48 pub fn builder() -> ToolbarBuilder { 49 ToolbarBuilder::default() 50 } 51 } 52 53 impl Default for Toolbar { default() -> Self54 fn default() -> Self { 55 Self::new() 56 } 57 } 58 59 #[derive(Clone, Default)] 60 // rustdoc-stripper-ignore-next 61 /// A [builder-pattern] type to construct [`Toolbar`] objects. 62 /// 63 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 64 pub struct ToolbarBuilder { 65 icon_size: Option<IconSize>, 66 icon_size_set: Option<bool>, 67 show_arrow: Option<bool>, 68 toolbar_style: Option<ToolbarStyle>, 69 border_width: Option<u32>, 70 child: Option<Widget>, 71 resize_mode: Option<ResizeMode>, 72 app_paintable: Option<bool>, 73 can_default: Option<bool>, 74 can_focus: Option<bool>, 75 events: Option<gdk::EventMask>, 76 expand: Option<bool>, 77 #[cfg(any(feature = "v3_20", feature = "dox"))] 78 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 79 focus_on_click: Option<bool>, 80 halign: Option<Align>, 81 has_default: Option<bool>, 82 has_focus: Option<bool>, 83 has_tooltip: Option<bool>, 84 height_request: Option<i32>, 85 hexpand: Option<bool>, 86 hexpand_set: Option<bool>, 87 is_focus: Option<bool>, 88 margin: Option<i32>, 89 margin_bottom: Option<i32>, 90 margin_end: Option<i32>, 91 margin_start: Option<i32>, 92 margin_top: Option<i32>, 93 name: Option<String>, 94 no_show_all: Option<bool>, 95 opacity: Option<f64>, 96 parent: Option<Container>, 97 receives_default: Option<bool>, 98 sensitive: Option<bool>, 99 tooltip_markup: Option<String>, 100 tooltip_text: Option<String>, 101 valign: Option<Align>, 102 vexpand: Option<bool>, 103 vexpand_set: Option<bool>, 104 visible: Option<bool>, 105 width_request: Option<i32>, 106 orientation: Option<Orientation>, 107 } 108 109 impl ToolbarBuilder { 110 // rustdoc-stripper-ignore-next 111 /// Create a new [`ToolbarBuilder`]. new() -> Self112 pub fn new() -> Self { 113 Self::default() 114 } 115 116 // rustdoc-stripper-ignore-next 117 /// Build the [`Toolbar`]. build(self) -> Toolbar118 pub fn build(self) -> Toolbar { 119 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 120 if let Some(ref icon_size) = self.icon_size { 121 properties.push(("icon-size", icon_size)); 122 } 123 if let Some(ref icon_size_set) = self.icon_size_set { 124 properties.push(("icon-size-set", icon_size_set)); 125 } 126 if let Some(ref show_arrow) = self.show_arrow { 127 properties.push(("show-arrow", show_arrow)); 128 } 129 if let Some(ref toolbar_style) = self.toolbar_style { 130 properties.push(("toolbar-style", toolbar_style)); 131 } 132 if let Some(ref border_width) = self.border_width { 133 properties.push(("border-width", border_width)); 134 } 135 if let Some(ref child) = self.child { 136 properties.push(("child", child)); 137 } 138 if let Some(ref resize_mode) = self.resize_mode { 139 properties.push(("resize-mode", resize_mode)); 140 } 141 if let Some(ref app_paintable) = self.app_paintable { 142 properties.push(("app-paintable", app_paintable)); 143 } 144 if let Some(ref can_default) = self.can_default { 145 properties.push(("can-default", can_default)); 146 } 147 if let Some(ref can_focus) = self.can_focus { 148 properties.push(("can-focus", can_focus)); 149 } 150 if let Some(ref events) = self.events { 151 properties.push(("events", events)); 152 } 153 if let Some(ref expand) = self.expand { 154 properties.push(("expand", expand)); 155 } 156 #[cfg(any(feature = "v3_20", feature = "dox"))] 157 if let Some(ref focus_on_click) = self.focus_on_click { 158 properties.push(("focus-on-click", focus_on_click)); 159 } 160 if let Some(ref halign) = self.halign { 161 properties.push(("halign", halign)); 162 } 163 if let Some(ref has_default) = self.has_default { 164 properties.push(("has-default", has_default)); 165 } 166 if let Some(ref has_focus) = self.has_focus { 167 properties.push(("has-focus", has_focus)); 168 } 169 if let Some(ref has_tooltip) = self.has_tooltip { 170 properties.push(("has-tooltip", has_tooltip)); 171 } 172 if let Some(ref height_request) = self.height_request { 173 properties.push(("height-request", height_request)); 174 } 175 if let Some(ref hexpand) = self.hexpand { 176 properties.push(("hexpand", hexpand)); 177 } 178 if let Some(ref hexpand_set) = self.hexpand_set { 179 properties.push(("hexpand-set", hexpand_set)); 180 } 181 if let Some(ref is_focus) = self.is_focus { 182 properties.push(("is-focus", is_focus)); 183 } 184 if let Some(ref margin) = self.margin { 185 properties.push(("margin", margin)); 186 } 187 if let Some(ref margin_bottom) = self.margin_bottom { 188 properties.push(("margin-bottom", margin_bottom)); 189 } 190 if let Some(ref margin_end) = self.margin_end { 191 properties.push(("margin-end", margin_end)); 192 } 193 if let Some(ref margin_start) = self.margin_start { 194 properties.push(("margin-start", margin_start)); 195 } 196 if let Some(ref margin_top) = self.margin_top { 197 properties.push(("margin-top", margin_top)); 198 } 199 if let Some(ref name) = self.name { 200 properties.push(("name", name)); 201 } 202 if let Some(ref no_show_all) = self.no_show_all { 203 properties.push(("no-show-all", no_show_all)); 204 } 205 if let Some(ref opacity) = self.opacity { 206 properties.push(("opacity", opacity)); 207 } 208 if let Some(ref parent) = self.parent { 209 properties.push(("parent", parent)); 210 } 211 if let Some(ref receives_default) = self.receives_default { 212 properties.push(("receives-default", receives_default)); 213 } 214 if let Some(ref sensitive) = self.sensitive { 215 properties.push(("sensitive", sensitive)); 216 } 217 if let Some(ref tooltip_markup) = self.tooltip_markup { 218 properties.push(("tooltip-markup", tooltip_markup)); 219 } 220 if let Some(ref tooltip_text) = self.tooltip_text { 221 properties.push(("tooltip-text", tooltip_text)); 222 } 223 if let Some(ref valign) = self.valign { 224 properties.push(("valign", valign)); 225 } 226 if let Some(ref vexpand) = self.vexpand { 227 properties.push(("vexpand", vexpand)); 228 } 229 if let Some(ref vexpand_set) = self.vexpand_set { 230 properties.push(("vexpand-set", vexpand_set)); 231 } 232 if let Some(ref visible) = self.visible { 233 properties.push(("visible", visible)); 234 } 235 if let Some(ref width_request) = self.width_request { 236 properties.push(("width-request", width_request)); 237 } 238 if let Some(ref orientation) = self.orientation { 239 properties.push(("orientation", orientation)); 240 } 241 glib::Object::new::<Toolbar>(&properties).expect("Failed to create an instance of Toolbar") 242 } 243 icon_size(mut self, icon_size: IconSize) -> Self244 pub fn icon_size(mut self, icon_size: IconSize) -> Self { 245 self.icon_size = Some(icon_size); 246 self 247 } 248 icon_size_set(mut self, icon_size_set: bool) -> Self249 pub fn icon_size_set(mut self, icon_size_set: bool) -> Self { 250 self.icon_size_set = Some(icon_size_set); 251 self 252 } 253 show_arrow(mut self, show_arrow: bool) -> Self254 pub fn show_arrow(mut self, show_arrow: bool) -> Self { 255 self.show_arrow = Some(show_arrow); 256 self 257 } 258 toolbar_style(mut self, toolbar_style: ToolbarStyle) -> Self259 pub fn toolbar_style(mut self, toolbar_style: ToolbarStyle) -> Self { 260 self.toolbar_style = Some(toolbar_style); 261 self 262 } 263 border_width(mut self, border_width: u32) -> Self264 pub fn border_width(mut self, border_width: u32) -> Self { 265 self.border_width = Some(border_width); 266 self 267 } 268 child<P: IsA<Widget>>(mut self, child: &P) -> Self269 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 270 self.child = Some(child.clone().upcast()); 271 self 272 } 273 resize_mode(mut self, resize_mode: ResizeMode) -> Self274 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 275 self.resize_mode = Some(resize_mode); 276 self 277 } 278 app_paintable(mut self, app_paintable: bool) -> Self279 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 280 self.app_paintable = Some(app_paintable); 281 self 282 } 283 can_default(mut self, can_default: bool) -> Self284 pub fn can_default(mut self, can_default: bool) -> Self { 285 self.can_default = Some(can_default); 286 self 287 } 288 can_focus(mut self, can_focus: bool) -> Self289 pub fn can_focus(mut self, can_focus: bool) -> Self { 290 self.can_focus = Some(can_focus); 291 self 292 } 293 events(mut self, events: gdk::EventMask) -> Self294 pub fn events(mut self, events: gdk::EventMask) -> Self { 295 self.events = Some(events); 296 self 297 } 298 expand(mut self, expand: bool) -> Self299 pub fn expand(mut self, expand: bool) -> Self { 300 self.expand = Some(expand); 301 self 302 } 303 304 #[cfg(any(feature = "v3_20", feature = "dox"))] 305 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self306 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 307 self.focus_on_click = Some(focus_on_click); 308 self 309 } 310 halign(mut self, halign: Align) -> Self311 pub fn halign(mut self, halign: Align) -> Self { 312 self.halign = Some(halign); 313 self 314 } 315 has_default(mut self, has_default: bool) -> Self316 pub fn has_default(mut self, has_default: bool) -> Self { 317 self.has_default = Some(has_default); 318 self 319 } 320 has_focus(mut self, has_focus: bool) -> Self321 pub fn has_focus(mut self, has_focus: bool) -> Self { 322 self.has_focus = Some(has_focus); 323 self 324 } 325 has_tooltip(mut self, has_tooltip: bool) -> Self326 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 327 self.has_tooltip = Some(has_tooltip); 328 self 329 } 330 height_request(mut self, height_request: i32) -> Self331 pub fn height_request(mut self, height_request: i32) -> Self { 332 self.height_request = Some(height_request); 333 self 334 } 335 hexpand(mut self, hexpand: bool) -> Self336 pub fn hexpand(mut self, hexpand: bool) -> Self { 337 self.hexpand = Some(hexpand); 338 self 339 } 340 hexpand_set(mut self, hexpand_set: bool) -> Self341 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 342 self.hexpand_set = Some(hexpand_set); 343 self 344 } 345 is_focus(mut self, is_focus: bool) -> Self346 pub fn is_focus(mut self, is_focus: bool) -> Self { 347 self.is_focus = Some(is_focus); 348 self 349 } 350 margin(mut self, margin: i32) -> Self351 pub fn margin(mut self, margin: i32) -> Self { 352 self.margin = Some(margin); 353 self 354 } 355 margin_bottom(mut self, margin_bottom: i32) -> Self356 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 357 self.margin_bottom = Some(margin_bottom); 358 self 359 } 360 margin_end(mut self, margin_end: i32) -> Self361 pub fn margin_end(mut self, margin_end: i32) -> Self { 362 self.margin_end = Some(margin_end); 363 self 364 } 365 margin_start(mut self, margin_start: i32) -> Self366 pub fn margin_start(mut self, margin_start: i32) -> Self { 367 self.margin_start = Some(margin_start); 368 self 369 } 370 margin_top(mut self, margin_top: i32) -> Self371 pub fn margin_top(mut self, margin_top: i32) -> Self { 372 self.margin_top = Some(margin_top); 373 self 374 } 375 name(mut self, name: &str) -> Self376 pub fn name(mut self, name: &str) -> Self { 377 self.name = Some(name.to_string()); 378 self 379 } 380 no_show_all(mut self, no_show_all: bool) -> Self381 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 382 self.no_show_all = Some(no_show_all); 383 self 384 } 385 opacity(mut self, opacity: f64) -> Self386 pub fn opacity(mut self, opacity: f64) -> Self { 387 self.opacity = Some(opacity); 388 self 389 } 390 parent<P: IsA<Container>>(mut self, parent: &P) -> Self391 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 392 self.parent = Some(parent.clone().upcast()); 393 self 394 } 395 receives_default(mut self, receives_default: bool) -> Self396 pub fn receives_default(mut self, receives_default: bool) -> Self { 397 self.receives_default = Some(receives_default); 398 self 399 } 400 sensitive(mut self, sensitive: bool) -> Self401 pub fn sensitive(mut self, sensitive: bool) -> Self { 402 self.sensitive = Some(sensitive); 403 self 404 } 405 tooltip_markup(mut self, tooltip_markup: &str) -> Self406 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 407 self.tooltip_markup = Some(tooltip_markup.to_string()); 408 self 409 } 410 tooltip_text(mut self, tooltip_text: &str) -> Self411 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 412 self.tooltip_text = Some(tooltip_text.to_string()); 413 self 414 } 415 valign(mut self, valign: Align) -> Self416 pub fn valign(mut self, valign: Align) -> Self { 417 self.valign = Some(valign); 418 self 419 } 420 vexpand(mut self, vexpand: bool) -> Self421 pub fn vexpand(mut self, vexpand: bool) -> Self { 422 self.vexpand = Some(vexpand); 423 self 424 } 425 vexpand_set(mut self, vexpand_set: bool) -> Self426 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 427 self.vexpand_set = Some(vexpand_set); 428 self 429 } 430 visible(mut self, visible: bool) -> Self431 pub fn visible(mut self, visible: bool) -> Self { 432 self.visible = Some(visible); 433 self 434 } 435 width_request(mut self, width_request: i32) -> Self436 pub fn width_request(mut self, width_request: i32) -> Self { 437 self.width_request = Some(width_request); 438 self 439 } 440 orientation(mut self, orientation: Orientation) -> Self441 pub fn orientation(mut self, orientation: Orientation) -> Self { 442 self.orientation = Some(orientation); 443 self 444 } 445 } 446 447 pub const NONE_TOOLBAR: Option<&Toolbar> = None; 448 449 pub trait ToolbarExt: 'static { 450 #[doc(alias = "gtk_toolbar_get_drop_index")] 451 #[doc(alias = "get_drop_index")] drop_index(&self, x: i32, y: i32) -> i32452 fn drop_index(&self, x: i32, y: i32) -> i32; 453 454 #[doc(alias = "gtk_toolbar_get_item_index")] 455 #[doc(alias = "get_item_index")] item_index<P: IsA<ToolItem>>(&self, item: &P) -> i32456 fn item_index<P: IsA<ToolItem>>(&self, item: &P) -> i32; 457 458 #[doc(alias = "gtk_toolbar_get_n_items")] 459 #[doc(alias = "get_n_items")] n_items(&self) -> i32460 fn n_items(&self) -> i32; 461 462 #[doc(alias = "gtk_toolbar_get_nth_item")] 463 #[doc(alias = "get_nth_item")] nth_item(&self, n: i32) -> Option<ToolItem>464 fn nth_item(&self, n: i32) -> Option<ToolItem>; 465 466 #[doc(alias = "gtk_toolbar_get_show_arrow")] 467 #[doc(alias = "get_show_arrow")] shows_arrow(&self) -> bool468 fn shows_arrow(&self) -> bool; 469 470 #[doc(alias = "gtk_toolbar_insert")] insert<P: IsA<ToolItem>>(&self, item: &P, pos: i32)471 fn insert<P: IsA<ToolItem>>(&self, item: &P, pos: i32); 472 473 #[doc(alias = "gtk_toolbar_set_drop_highlight_item")] set_drop_highlight_item<P: IsA<ToolItem>>(&self, tool_item: Option<&P>, index_: i32)474 fn set_drop_highlight_item<P: IsA<ToolItem>>(&self, tool_item: Option<&P>, index_: i32); 475 476 #[doc(alias = "gtk_toolbar_set_icon_size")] set_icon_size(&self, icon_size: IconSize)477 fn set_icon_size(&self, icon_size: IconSize); 478 479 #[doc(alias = "gtk_toolbar_set_show_arrow")] set_show_arrow(&self, show_arrow: bool)480 fn set_show_arrow(&self, show_arrow: bool); 481 482 #[doc(alias = "gtk_toolbar_set_style")] set_style(&self, style: ToolbarStyle)483 fn set_style(&self, style: ToolbarStyle); 484 485 #[doc(alias = "gtk_toolbar_unset_icon_size")] unset_icon_size(&self)486 fn unset_icon_size(&self); 487 488 #[doc(alias = "gtk_toolbar_unset_style")] unset_style(&self)489 fn unset_style(&self); 490 491 #[doc(alias = "icon-size-set")] is_icon_size_set(&self) -> bool492 fn is_icon_size_set(&self) -> bool; 493 494 #[doc(alias = "icon-size-set")] set_icon_size_set(&self, icon_size_set: bool)495 fn set_icon_size_set(&self, icon_size_set: bool); 496 497 #[doc(alias = "toolbar-style")] toolbar_style(&self) -> ToolbarStyle498 fn toolbar_style(&self) -> ToolbarStyle; 499 500 #[doc(alias = "toolbar-style")] set_toolbar_style(&self, toolbar_style: ToolbarStyle)501 fn set_toolbar_style(&self, toolbar_style: ToolbarStyle); 502 item_expands<T: IsA<Widget>>(&self, item: &T) -> bool503 fn item_expands<T: IsA<Widget>>(&self, item: &T) -> bool; 504 set_item_expand<T: IsA<Widget>>(&self, item: &T, expand: bool)505 fn set_item_expand<T: IsA<Widget>>(&self, item: &T, expand: bool); 506 item_is_homogeneous<T: IsA<Widget>>(&self, item: &T) -> bool507 fn item_is_homogeneous<T: IsA<Widget>>(&self, item: &T) -> bool; 508 set_item_homogeneous<T: IsA<Widget>>(&self, item: &T, homogeneous: bool)509 fn set_item_homogeneous<T: IsA<Widget>>(&self, item: &T, homogeneous: bool); 510 511 #[doc(alias = "focus-home-or-end")] connect_focus_home_or_end<F: Fn(&Self, bool) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId512 fn connect_focus_home_or_end<F: Fn(&Self, bool) -> bool + 'static>( 513 &self, 514 f: F, 515 ) -> SignalHandlerId; 516 emit_focus_home_or_end(&self, focus_home: bool) -> bool517 fn emit_focus_home_or_end(&self, focus_home: bool) -> bool; 518 519 #[doc(alias = "orientation-changed")] connect_orientation_changed<F: Fn(&Self, Orientation) + 'static>( &self, f: F, ) -> SignalHandlerId520 fn connect_orientation_changed<F: Fn(&Self, Orientation) + 'static>( 521 &self, 522 f: F, 523 ) -> SignalHandlerId; 524 525 #[doc(alias = "popup-context-menu")] connect_popup_context_menu<F: Fn(&Self, i32, i32, i32) -> glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId526 fn connect_popup_context_menu<F: Fn(&Self, i32, i32, i32) -> glib::signal::Inhibit + 'static>( 527 &self, 528 f: F, 529 ) -> SignalHandlerId; 530 531 #[doc(alias = "style-changed")] connect_style_changed<F: Fn(&Self, ToolbarStyle) + 'static>(&self, f: F) -> SignalHandlerId532 fn connect_style_changed<F: Fn(&Self, ToolbarStyle) + 'static>(&self, f: F) -> SignalHandlerId; 533 534 #[doc(alias = "icon-size")] connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId535 fn connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 536 537 #[doc(alias = "icon-size-set")] connect_icon_size_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId538 fn connect_icon_size_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 539 540 #[doc(alias = "show-arrow")] connect_show_arrow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId541 fn connect_show_arrow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 542 543 #[doc(alias = "toolbar-style")] connect_toolbar_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId544 fn connect_toolbar_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 545 } 546 547 impl<O: IsA<Toolbar>> ToolbarExt for O { drop_index(&self, x: i32, y: i32) -> i32548 fn drop_index(&self, x: i32, y: i32) -> i32 { 549 unsafe { ffi::gtk_toolbar_get_drop_index(self.as_ref().to_glib_none().0, x, y) } 550 } 551 item_index<P: IsA<ToolItem>>(&self, item: &P) -> i32552 fn item_index<P: IsA<ToolItem>>(&self, item: &P) -> i32 { 553 unsafe { 554 ffi::gtk_toolbar_get_item_index( 555 self.as_ref().to_glib_none().0, 556 item.as_ref().to_glib_none().0, 557 ) 558 } 559 } 560 n_items(&self) -> i32561 fn n_items(&self) -> i32 { 562 unsafe { ffi::gtk_toolbar_get_n_items(self.as_ref().to_glib_none().0) } 563 } 564 nth_item(&self, n: i32) -> Option<ToolItem>565 fn nth_item(&self, n: i32) -> Option<ToolItem> { 566 unsafe { 567 from_glib_none(ffi::gtk_toolbar_get_nth_item( 568 self.as_ref().to_glib_none().0, 569 n, 570 )) 571 } 572 } 573 shows_arrow(&self) -> bool574 fn shows_arrow(&self) -> bool { 575 unsafe { 576 from_glib(ffi::gtk_toolbar_get_show_arrow( 577 self.as_ref().to_glib_none().0, 578 )) 579 } 580 } 581 insert<P: IsA<ToolItem>>(&self, item: &P, pos: i32)582 fn insert<P: IsA<ToolItem>>(&self, item: &P, pos: i32) { 583 unsafe { 584 ffi::gtk_toolbar_insert( 585 self.as_ref().to_glib_none().0, 586 item.as_ref().to_glib_none().0, 587 pos, 588 ); 589 } 590 } 591 set_drop_highlight_item<P: IsA<ToolItem>>(&self, tool_item: Option<&P>, index_: i32)592 fn set_drop_highlight_item<P: IsA<ToolItem>>(&self, tool_item: Option<&P>, index_: i32) { 593 unsafe { 594 ffi::gtk_toolbar_set_drop_highlight_item( 595 self.as_ref().to_glib_none().0, 596 tool_item.map(|p| p.as_ref()).to_glib_none().0, 597 index_, 598 ); 599 } 600 } 601 set_icon_size(&self, icon_size: IconSize)602 fn set_icon_size(&self, icon_size: IconSize) { 603 unsafe { 604 ffi::gtk_toolbar_set_icon_size(self.as_ref().to_glib_none().0, icon_size.into_glib()); 605 } 606 } 607 set_show_arrow(&self, show_arrow: bool)608 fn set_show_arrow(&self, show_arrow: bool) { 609 unsafe { 610 ffi::gtk_toolbar_set_show_arrow(self.as_ref().to_glib_none().0, show_arrow.into_glib()); 611 } 612 } 613 set_style(&self, style: ToolbarStyle)614 fn set_style(&self, style: ToolbarStyle) { 615 unsafe { 616 ffi::gtk_toolbar_set_style(self.as_ref().to_glib_none().0, style.into_glib()); 617 } 618 } 619 unset_icon_size(&self)620 fn unset_icon_size(&self) { 621 unsafe { 622 ffi::gtk_toolbar_unset_icon_size(self.as_ref().to_glib_none().0); 623 } 624 } 625 unset_style(&self)626 fn unset_style(&self) { 627 unsafe { 628 ffi::gtk_toolbar_unset_style(self.as_ref().to_glib_none().0); 629 } 630 } 631 is_icon_size_set(&self) -> bool632 fn is_icon_size_set(&self) -> bool { 633 unsafe { 634 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 635 glib::gobject_ffi::g_object_get_property( 636 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 637 b"icon-size-set\0".as_ptr() as *const _, 638 value.to_glib_none_mut().0, 639 ); 640 value 641 .get() 642 .expect("Return Value for property `icon-size-set` getter") 643 } 644 } 645 set_icon_size_set(&self, icon_size_set: bool)646 fn set_icon_size_set(&self, icon_size_set: bool) { 647 unsafe { 648 glib::gobject_ffi::g_object_set_property( 649 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 650 b"icon-size-set\0".as_ptr() as *const _, 651 icon_size_set.to_value().to_glib_none().0, 652 ); 653 } 654 } 655 toolbar_style(&self) -> ToolbarStyle656 fn toolbar_style(&self) -> ToolbarStyle { 657 unsafe { 658 let mut value = glib::Value::from_type(<ToolbarStyle as StaticType>::static_type()); 659 glib::gobject_ffi::g_object_get_property( 660 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 661 b"toolbar-style\0".as_ptr() as *const _, 662 value.to_glib_none_mut().0, 663 ); 664 value 665 .get() 666 .expect("Return Value for property `toolbar-style` getter") 667 } 668 } 669 set_toolbar_style(&self, toolbar_style: ToolbarStyle)670 fn set_toolbar_style(&self, toolbar_style: ToolbarStyle) { 671 unsafe { 672 glib::gobject_ffi::g_object_set_property( 673 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 674 b"toolbar-style\0".as_ptr() as *const _, 675 toolbar_style.to_value().to_glib_none().0, 676 ); 677 } 678 } 679 item_expands<T: IsA<Widget>>(&self, item: &T) -> bool680 fn item_expands<T: IsA<Widget>>(&self, item: &T) -> bool { 681 unsafe { 682 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 683 crate::ffi::gtk_container_child_get_property( 684 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 685 item.to_glib_none().0 as *mut _, 686 b"expand\0".as_ptr() as *const _, 687 value.to_glib_none_mut().0, 688 ); 689 value 690 .get() 691 .expect("Return Value for property `expand` getter") 692 } 693 } 694 set_item_expand<T: IsA<Widget>>(&self, item: &T, expand: bool)695 fn set_item_expand<T: IsA<Widget>>(&self, item: &T, expand: bool) { 696 unsafe { 697 crate::ffi::gtk_container_child_set_property( 698 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 699 item.to_glib_none().0 as *mut _, 700 b"expand\0".as_ptr() as *const _, 701 expand.to_value().to_glib_none().0, 702 ); 703 } 704 } 705 item_is_homogeneous<T: IsA<Widget>>(&self, item: &T) -> bool706 fn item_is_homogeneous<T: IsA<Widget>>(&self, item: &T) -> bool { 707 unsafe { 708 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 709 crate::ffi::gtk_container_child_get_property( 710 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 711 item.to_glib_none().0 as *mut _, 712 b"homogeneous\0".as_ptr() as *const _, 713 value.to_glib_none_mut().0, 714 ); 715 value 716 .get() 717 .expect("Return Value for property `homogeneous` getter") 718 } 719 } 720 set_item_homogeneous<T: IsA<Widget>>(&self, item: &T, homogeneous: bool)721 fn set_item_homogeneous<T: IsA<Widget>>(&self, item: &T, homogeneous: bool) { 722 unsafe { 723 crate::ffi::gtk_container_child_set_property( 724 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 725 item.to_glib_none().0 as *mut _, 726 b"homogeneous\0".as_ptr() as *const _, 727 homogeneous.to_value().to_glib_none().0, 728 ); 729 } 730 } 731 connect_focus_home_or_end<F: Fn(&Self, bool) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId732 fn connect_focus_home_or_end<F: Fn(&Self, bool) -> bool + 'static>( 733 &self, 734 f: F, 735 ) -> SignalHandlerId { 736 unsafe extern "C" fn focus_home_or_end_trampoline< 737 P: IsA<Toolbar>, 738 F: Fn(&P, bool) -> bool + 'static, 739 >( 740 this: *mut ffi::GtkToolbar, 741 focus_home: glib::ffi::gboolean, 742 f: glib::ffi::gpointer, 743 ) -> glib::ffi::gboolean { 744 let f: &F = &*(f as *const F); 745 f( 746 Toolbar::from_glib_borrow(this).unsafe_cast_ref(), 747 from_glib(focus_home), 748 ) 749 .into_glib() 750 } 751 unsafe { 752 let f: Box_<F> = Box_::new(f); 753 connect_raw( 754 self.as_ptr() as *mut _, 755 b"focus-home-or-end\0".as_ptr() as *const _, 756 Some(transmute::<_, unsafe extern "C" fn()>( 757 focus_home_or_end_trampoline::<Self, F> as *const (), 758 )), 759 Box_::into_raw(f), 760 ) 761 } 762 } 763 emit_focus_home_or_end(&self, focus_home: bool) -> bool764 fn emit_focus_home_or_end(&self, focus_home: bool) -> bool { 765 let res = unsafe { 766 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 767 .emit_by_name("focus-home-or-end", &[&focus_home]) 768 .unwrap() 769 }; 770 res.unwrap() 771 .get() 772 .expect("Return Value for `emit_focus_home_or_end`") 773 } 774 connect_orientation_changed<F: Fn(&Self, Orientation) + 'static>( &self, f: F, ) -> SignalHandlerId775 fn connect_orientation_changed<F: Fn(&Self, Orientation) + 'static>( 776 &self, 777 f: F, 778 ) -> SignalHandlerId { 779 unsafe extern "C" fn orientation_changed_trampoline< 780 P: IsA<Toolbar>, 781 F: Fn(&P, Orientation) + 'static, 782 >( 783 this: *mut ffi::GtkToolbar, 784 orientation: ffi::GtkOrientation, 785 f: glib::ffi::gpointer, 786 ) { 787 let f: &F = &*(f as *const F); 788 f( 789 Toolbar::from_glib_borrow(this).unsafe_cast_ref(), 790 from_glib(orientation), 791 ) 792 } 793 unsafe { 794 let f: Box_<F> = Box_::new(f); 795 connect_raw( 796 self.as_ptr() as *mut _, 797 b"orientation-changed\0".as_ptr() as *const _, 798 Some(transmute::<_, unsafe extern "C" fn()>( 799 orientation_changed_trampoline::<Self, F> as *const (), 800 )), 801 Box_::into_raw(f), 802 ) 803 } 804 } 805 connect_popup_context_menu< F: Fn(&Self, i32, i32, i32) -> glib::signal::Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId806 fn connect_popup_context_menu< 807 F: Fn(&Self, i32, i32, i32) -> glib::signal::Inhibit + 'static, 808 >( 809 &self, 810 f: F, 811 ) -> SignalHandlerId { 812 unsafe extern "C" fn popup_context_menu_trampoline< 813 P: IsA<Toolbar>, 814 F: Fn(&P, i32, i32, i32) -> glib::signal::Inhibit + 'static, 815 >( 816 this: *mut ffi::GtkToolbar, 817 x: libc::c_int, 818 y: libc::c_int, 819 button: libc::c_int, 820 f: glib::ffi::gpointer, 821 ) -> glib::ffi::gboolean { 822 let f: &F = &*(f as *const F); 823 f( 824 Toolbar::from_glib_borrow(this).unsafe_cast_ref(), 825 x, 826 y, 827 button, 828 ) 829 .into_glib() 830 } 831 unsafe { 832 let f: Box_<F> = Box_::new(f); 833 connect_raw( 834 self.as_ptr() as *mut _, 835 b"popup-context-menu\0".as_ptr() as *const _, 836 Some(transmute::<_, unsafe extern "C" fn()>( 837 popup_context_menu_trampoline::<Self, F> as *const (), 838 )), 839 Box_::into_raw(f), 840 ) 841 } 842 } 843 connect_style_changed<F: Fn(&Self, ToolbarStyle) + 'static>(&self, f: F) -> SignalHandlerId844 fn connect_style_changed<F: Fn(&Self, ToolbarStyle) + 'static>(&self, f: F) -> SignalHandlerId { 845 unsafe extern "C" fn style_changed_trampoline< 846 P: IsA<Toolbar>, 847 F: Fn(&P, ToolbarStyle) + 'static, 848 >( 849 this: *mut ffi::GtkToolbar, 850 style: ffi::GtkToolbarStyle, 851 f: glib::ffi::gpointer, 852 ) { 853 let f: &F = &*(f as *const F); 854 f( 855 Toolbar::from_glib_borrow(this).unsafe_cast_ref(), 856 from_glib(style), 857 ) 858 } 859 unsafe { 860 let f: Box_<F> = Box_::new(f); 861 connect_raw( 862 self.as_ptr() as *mut _, 863 b"style-changed\0".as_ptr() as *const _, 864 Some(transmute::<_, unsafe extern "C" fn()>( 865 style_changed_trampoline::<Self, F> as *const (), 866 )), 867 Box_::into_raw(f), 868 ) 869 } 870 } 871 connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId872 fn connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 873 unsafe extern "C" fn notify_icon_size_trampoline<P: IsA<Toolbar>, F: Fn(&P) + 'static>( 874 this: *mut ffi::GtkToolbar, 875 _param_spec: glib::ffi::gpointer, 876 f: glib::ffi::gpointer, 877 ) { 878 let f: &F = &*(f as *const F); 879 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref()) 880 } 881 unsafe { 882 let f: Box_<F> = Box_::new(f); 883 connect_raw( 884 self.as_ptr() as *mut _, 885 b"notify::icon-size\0".as_ptr() as *const _, 886 Some(transmute::<_, unsafe extern "C" fn()>( 887 notify_icon_size_trampoline::<Self, F> as *const (), 888 )), 889 Box_::into_raw(f), 890 ) 891 } 892 } 893 connect_icon_size_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId894 fn connect_icon_size_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 895 unsafe extern "C" fn notify_icon_size_set_trampoline< 896 P: IsA<Toolbar>, 897 F: Fn(&P) + 'static, 898 >( 899 this: *mut ffi::GtkToolbar, 900 _param_spec: glib::ffi::gpointer, 901 f: glib::ffi::gpointer, 902 ) { 903 let f: &F = &*(f as *const F); 904 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref()) 905 } 906 unsafe { 907 let f: Box_<F> = Box_::new(f); 908 connect_raw( 909 self.as_ptr() as *mut _, 910 b"notify::icon-size-set\0".as_ptr() as *const _, 911 Some(transmute::<_, unsafe extern "C" fn()>( 912 notify_icon_size_set_trampoline::<Self, F> as *const (), 913 )), 914 Box_::into_raw(f), 915 ) 916 } 917 } 918 connect_show_arrow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId919 fn connect_show_arrow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 920 unsafe extern "C" fn notify_show_arrow_trampoline<P: IsA<Toolbar>, F: Fn(&P) + 'static>( 921 this: *mut ffi::GtkToolbar, 922 _param_spec: glib::ffi::gpointer, 923 f: glib::ffi::gpointer, 924 ) { 925 let f: &F = &*(f as *const F); 926 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref()) 927 } 928 unsafe { 929 let f: Box_<F> = Box_::new(f); 930 connect_raw( 931 self.as_ptr() as *mut _, 932 b"notify::show-arrow\0".as_ptr() as *const _, 933 Some(transmute::<_, unsafe extern "C" fn()>( 934 notify_show_arrow_trampoline::<Self, F> as *const (), 935 )), 936 Box_::into_raw(f), 937 ) 938 } 939 } 940 connect_toolbar_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId941 fn connect_toolbar_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 942 unsafe extern "C" fn notify_toolbar_style_trampoline< 943 P: IsA<Toolbar>, 944 F: Fn(&P) + 'static, 945 >( 946 this: *mut ffi::GtkToolbar, 947 _param_spec: glib::ffi::gpointer, 948 f: glib::ffi::gpointer, 949 ) { 950 let f: &F = &*(f as *const F); 951 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref()) 952 } 953 unsafe { 954 let f: Box_<F> = Box_::new(f); 955 connect_raw( 956 self.as_ptr() as *mut _, 957 b"notify::toolbar-style\0".as_ptr() as *const _, 958 Some(transmute::<_, unsafe extern "C" fn()>( 959 notify_toolbar_style_trampoline::<Self, F> as *const (), 960 )), 961 Box_::into_raw(f), 962 ) 963 } 964 } 965 } 966 967 impl fmt::Display for Toolbar { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result968 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 969 f.write_str("Toolbar") 970 } 971 } 972