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 gdk; 6 use glib::object::Cast; 7 use glib::object::IsA; 8 use glib::signal::connect_raw; 9 use glib::signal::SignalHandlerId; 10 use glib::translate::*; 11 use glib::StaticType; 12 use glib::ToValue; 13 use glib_sys; 14 use gtk_sys; 15 use pango; 16 use std::boxed::Box as Box_; 17 use std::fmt; 18 use std::mem::transmute; 19 use Align; 20 use Bin; 21 use Buildable; 22 use Container; 23 use IconSize; 24 use Orientation; 25 use ReliefStyle; 26 use ResizeMode; 27 use SizeGroup; 28 use ToolbarStyle; 29 use Widget; 30 31 glib_wrapper! { 32 pub struct ToolItem(Object<gtk_sys::GtkToolItem, gtk_sys::GtkToolItemClass, ToolItemClass>) @extends Bin, Container, Widget, @implements Buildable; 33 34 match fn { 35 get_type => || gtk_sys::gtk_tool_item_get_type(), 36 } 37 } 38 39 impl ToolItem { new() -> ToolItem40 pub fn new() -> ToolItem { 41 assert_initialized_main_thread!(); 42 unsafe { from_glib_none(gtk_sys::gtk_tool_item_new()) } 43 } 44 } 45 46 impl Default for ToolItem { default() -> Self47 fn default() -> Self { 48 Self::new() 49 } 50 } 51 52 #[derive(Clone, Default)] 53 pub struct ToolItemBuilder { 54 is_important: Option<bool>, 55 visible_horizontal: Option<bool>, 56 visible_vertical: Option<bool>, 57 border_width: Option<u32>, 58 child: Option<Widget>, 59 resize_mode: Option<ResizeMode>, 60 app_paintable: Option<bool>, 61 can_default: Option<bool>, 62 can_focus: Option<bool>, 63 events: Option<gdk::EventMask>, 64 expand: Option<bool>, 65 #[cfg(any(feature = "v3_20", feature = "dox"))] 66 focus_on_click: Option<bool>, 67 halign: Option<Align>, 68 has_default: Option<bool>, 69 has_focus: Option<bool>, 70 has_tooltip: Option<bool>, 71 height_request: Option<i32>, 72 hexpand: Option<bool>, 73 hexpand_set: Option<bool>, 74 is_focus: Option<bool>, 75 margin: Option<i32>, 76 margin_bottom: Option<i32>, 77 margin_end: Option<i32>, 78 margin_start: Option<i32>, 79 margin_top: Option<i32>, 80 name: Option<String>, 81 no_show_all: Option<bool>, 82 opacity: Option<f64>, 83 parent: Option<Container>, 84 receives_default: Option<bool>, 85 sensitive: Option<bool>, 86 tooltip_markup: Option<String>, 87 tooltip_text: Option<String>, 88 valign: Option<Align>, 89 vexpand: Option<bool>, 90 vexpand_set: Option<bool>, 91 visible: Option<bool>, 92 width_request: Option<i32>, 93 } 94 95 impl ToolItemBuilder { new() -> Self96 pub fn new() -> Self { 97 Self::default() 98 } 99 build(self) -> ToolItem100 pub fn build(self) -> ToolItem { 101 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 102 if let Some(ref is_important) = self.is_important { 103 properties.push(("is-important", is_important)); 104 } 105 if let Some(ref visible_horizontal) = self.visible_horizontal { 106 properties.push(("visible-horizontal", visible_horizontal)); 107 } 108 if let Some(ref visible_vertical) = self.visible_vertical { 109 properties.push(("visible-vertical", visible_vertical)); 110 } 111 if let Some(ref border_width) = self.border_width { 112 properties.push(("border-width", border_width)); 113 } 114 if let Some(ref child) = self.child { 115 properties.push(("child", child)); 116 } 117 if let Some(ref resize_mode) = self.resize_mode { 118 properties.push(("resize-mode", resize_mode)); 119 } 120 if let Some(ref app_paintable) = self.app_paintable { 121 properties.push(("app-paintable", app_paintable)); 122 } 123 if let Some(ref can_default) = self.can_default { 124 properties.push(("can-default", can_default)); 125 } 126 if let Some(ref can_focus) = self.can_focus { 127 properties.push(("can-focus", can_focus)); 128 } 129 if let Some(ref events) = self.events { 130 properties.push(("events", events)); 131 } 132 if let Some(ref expand) = self.expand { 133 properties.push(("expand", expand)); 134 } 135 #[cfg(any(feature = "v3_20", feature = "dox"))] 136 { 137 if let Some(ref focus_on_click) = self.focus_on_click { 138 properties.push(("focus-on-click", focus_on_click)); 139 } 140 } 141 if let Some(ref halign) = self.halign { 142 properties.push(("halign", halign)); 143 } 144 if let Some(ref has_default) = self.has_default { 145 properties.push(("has-default", has_default)); 146 } 147 if let Some(ref has_focus) = self.has_focus { 148 properties.push(("has-focus", has_focus)); 149 } 150 if let Some(ref has_tooltip) = self.has_tooltip { 151 properties.push(("has-tooltip", has_tooltip)); 152 } 153 if let Some(ref height_request) = self.height_request { 154 properties.push(("height-request", height_request)); 155 } 156 if let Some(ref hexpand) = self.hexpand { 157 properties.push(("hexpand", hexpand)); 158 } 159 if let Some(ref hexpand_set) = self.hexpand_set { 160 properties.push(("hexpand-set", hexpand_set)); 161 } 162 if let Some(ref is_focus) = self.is_focus { 163 properties.push(("is-focus", is_focus)); 164 } 165 if let Some(ref margin) = self.margin { 166 properties.push(("margin", margin)); 167 } 168 if let Some(ref margin_bottom) = self.margin_bottom { 169 properties.push(("margin-bottom", margin_bottom)); 170 } 171 if let Some(ref margin_end) = self.margin_end { 172 properties.push(("margin-end", margin_end)); 173 } 174 if let Some(ref margin_start) = self.margin_start { 175 properties.push(("margin-start", margin_start)); 176 } 177 if let Some(ref margin_top) = self.margin_top { 178 properties.push(("margin-top", margin_top)); 179 } 180 if let Some(ref name) = self.name { 181 properties.push(("name", name)); 182 } 183 if let Some(ref no_show_all) = self.no_show_all { 184 properties.push(("no-show-all", no_show_all)); 185 } 186 if let Some(ref opacity) = self.opacity { 187 properties.push(("opacity", opacity)); 188 } 189 if let Some(ref parent) = self.parent { 190 properties.push(("parent", parent)); 191 } 192 if let Some(ref receives_default) = self.receives_default { 193 properties.push(("receives-default", receives_default)); 194 } 195 if let Some(ref sensitive) = self.sensitive { 196 properties.push(("sensitive", sensitive)); 197 } 198 if let Some(ref tooltip_markup) = self.tooltip_markup { 199 properties.push(("tooltip-markup", tooltip_markup)); 200 } 201 if let Some(ref tooltip_text) = self.tooltip_text { 202 properties.push(("tooltip-text", tooltip_text)); 203 } 204 if let Some(ref valign) = self.valign { 205 properties.push(("valign", valign)); 206 } 207 if let Some(ref vexpand) = self.vexpand { 208 properties.push(("vexpand", vexpand)); 209 } 210 if let Some(ref vexpand_set) = self.vexpand_set { 211 properties.push(("vexpand-set", vexpand_set)); 212 } 213 if let Some(ref visible) = self.visible { 214 properties.push(("visible", visible)); 215 } 216 if let Some(ref width_request) = self.width_request { 217 properties.push(("width-request", width_request)); 218 } 219 glib::Object::new(ToolItem::static_type(), &properties) 220 .expect("object new") 221 .downcast() 222 .expect("downcast") 223 } 224 is_important(mut self, is_important: bool) -> Self225 pub fn is_important(mut self, is_important: bool) -> Self { 226 self.is_important = Some(is_important); 227 self 228 } 229 visible_horizontal(mut self, visible_horizontal: bool) -> Self230 pub fn visible_horizontal(mut self, visible_horizontal: bool) -> Self { 231 self.visible_horizontal = Some(visible_horizontal); 232 self 233 } 234 visible_vertical(mut self, visible_vertical: bool) -> Self235 pub fn visible_vertical(mut self, visible_vertical: bool) -> Self { 236 self.visible_vertical = Some(visible_vertical); 237 self 238 } 239 border_width(mut self, border_width: u32) -> Self240 pub fn border_width(mut self, border_width: u32) -> Self { 241 self.border_width = Some(border_width); 242 self 243 } 244 child<P: IsA<Widget>>(mut self, child: &P) -> Self245 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 246 self.child = Some(child.clone().upcast()); 247 self 248 } 249 resize_mode(mut self, resize_mode: ResizeMode) -> Self250 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 251 self.resize_mode = Some(resize_mode); 252 self 253 } 254 app_paintable(mut self, app_paintable: bool) -> Self255 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 256 self.app_paintable = Some(app_paintable); 257 self 258 } 259 can_default(mut self, can_default: bool) -> Self260 pub fn can_default(mut self, can_default: bool) -> Self { 261 self.can_default = Some(can_default); 262 self 263 } 264 can_focus(mut self, can_focus: bool) -> Self265 pub fn can_focus(mut self, can_focus: bool) -> Self { 266 self.can_focus = Some(can_focus); 267 self 268 } 269 events(mut self, events: gdk::EventMask) -> Self270 pub fn events(mut self, events: gdk::EventMask) -> Self { 271 self.events = Some(events); 272 self 273 } 274 expand(mut self, expand: bool) -> Self275 pub fn expand(mut self, expand: bool) -> Self { 276 self.expand = Some(expand); 277 self 278 } 279 280 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self281 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 282 self.focus_on_click = Some(focus_on_click); 283 self 284 } 285 halign(mut self, halign: Align) -> Self286 pub fn halign(mut self, halign: Align) -> Self { 287 self.halign = Some(halign); 288 self 289 } 290 has_default(mut self, has_default: bool) -> Self291 pub fn has_default(mut self, has_default: bool) -> Self { 292 self.has_default = Some(has_default); 293 self 294 } 295 has_focus(mut self, has_focus: bool) -> Self296 pub fn has_focus(mut self, has_focus: bool) -> Self { 297 self.has_focus = Some(has_focus); 298 self 299 } 300 has_tooltip(mut self, has_tooltip: bool) -> Self301 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 302 self.has_tooltip = Some(has_tooltip); 303 self 304 } 305 height_request(mut self, height_request: i32) -> Self306 pub fn height_request(mut self, height_request: i32) -> Self { 307 self.height_request = Some(height_request); 308 self 309 } 310 hexpand(mut self, hexpand: bool) -> Self311 pub fn hexpand(mut self, hexpand: bool) -> Self { 312 self.hexpand = Some(hexpand); 313 self 314 } 315 hexpand_set(mut self, hexpand_set: bool) -> Self316 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 317 self.hexpand_set = Some(hexpand_set); 318 self 319 } 320 is_focus(mut self, is_focus: bool) -> Self321 pub fn is_focus(mut self, is_focus: bool) -> Self { 322 self.is_focus = Some(is_focus); 323 self 324 } 325 margin(mut self, margin: i32) -> Self326 pub fn margin(mut self, margin: i32) -> Self { 327 self.margin = Some(margin); 328 self 329 } 330 margin_bottom(mut self, margin_bottom: i32) -> Self331 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 332 self.margin_bottom = Some(margin_bottom); 333 self 334 } 335 margin_end(mut self, margin_end: i32) -> Self336 pub fn margin_end(mut self, margin_end: i32) -> Self { 337 self.margin_end = Some(margin_end); 338 self 339 } 340 margin_start(mut self, margin_start: i32) -> Self341 pub fn margin_start(mut self, margin_start: i32) -> Self { 342 self.margin_start = Some(margin_start); 343 self 344 } 345 margin_top(mut self, margin_top: i32) -> Self346 pub fn margin_top(mut self, margin_top: i32) -> Self { 347 self.margin_top = Some(margin_top); 348 self 349 } 350 name(mut self, name: &str) -> Self351 pub fn name(mut self, name: &str) -> Self { 352 self.name = Some(name.to_string()); 353 self 354 } 355 no_show_all(mut self, no_show_all: bool) -> Self356 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 357 self.no_show_all = Some(no_show_all); 358 self 359 } 360 opacity(mut self, opacity: f64) -> Self361 pub fn opacity(mut self, opacity: f64) -> Self { 362 self.opacity = Some(opacity); 363 self 364 } 365 parent<P: IsA<Container>>(mut self, parent: &P) -> Self366 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 367 self.parent = Some(parent.clone().upcast()); 368 self 369 } 370 receives_default(mut self, receives_default: bool) -> Self371 pub fn receives_default(mut self, receives_default: bool) -> Self { 372 self.receives_default = Some(receives_default); 373 self 374 } 375 sensitive(mut self, sensitive: bool) -> Self376 pub fn sensitive(mut self, sensitive: bool) -> Self { 377 self.sensitive = Some(sensitive); 378 self 379 } 380 tooltip_markup(mut self, tooltip_markup: &str) -> Self381 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 382 self.tooltip_markup = Some(tooltip_markup.to_string()); 383 self 384 } 385 tooltip_text(mut self, tooltip_text: &str) -> Self386 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 387 self.tooltip_text = Some(tooltip_text.to_string()); 388 self 389 } 390 valign(mut self, valign: Align) -> Self391 pub fn valign(mut self, valign: Align) -> Self { 392 self.valign = Some(valign); 393 self 394 } 395 vexpand(mut self, vexpand: bool) -> Self396 pub fn vexpand(mut self, vexpand: bool) -> Self { 397 self.vexpand = Some(vexpand); 398 self 399 } 400 vexpand_set(mut self, vexpand_set: bool) -> Self401 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 402 self.vexpand_set = Some(vexpand_set); 403 self 404 } 405 visible(mut self, visible: bool) -> Self406 pub fn visible(mut self, visible: bool) -> Self { 407 self.visible = Some(visible); 408 self 409 } 410 width_request(mut self, width_request: i32) -> Self411 pub fn width_request(mut self, width_request: i32) -> Self { 412 self.width_request = Some(width_request); 413 self 414 } 415 } 416 417 pub const NONE_TOOL_ITEM: Option<&ToolItem> = None; 418 419 pub trait ToolItemExt: 'static { get_ellipsize_mode(&self) -> pango::EllipsizeMode420 fn get_ellipsize_mode(&self) -> pango::EllipsizeMode; 421 get_expand(&self) -> bool422 fn get_expand(&self) -> bool; 423 get_homogeneous(&self) -> bool424 fn get_homogeneous(&self) -> bool; 425 get_icon_size(&self) -> IconSize426 fn get_icon_size(&self) -> IconSize; 427 get_is_important(&self) -> bool428 fn get_is_important(&self) -> bool; 429 get_orientation(&self) -> Orientation430 fn get_orientation(&self) -> Orientation; 431 get_proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget>432 fn get_proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget>; 433 get_relief_style(&self) -> ReliefStyle434 fn get_relief_style(&self) -> ReliefStyle; 435 get_text_alignment(&self) -> f32436 fn get_text_alignment(&self) -> f32; 437 get_text_orientation(&self) -> Orientation438 fn get_text_orientation(&self) -> Orientation; 439 get_text_size_group(&self) -> Option<SizeGroup>440 fn get_text_size_group(&self) -> Option<SizeGroup>; 441 get_toolbar_style(&self) -> ToolbarStyle442 fn get_toolbar_style(&self) -> ToolbarStyle; 443 get_use_drag_window(&self) -> bool444 fn get_use_drag_window(&self) -> bool; 445 get_visible_horizontal(&self) -> bool446 fn get_visible_horizontal(&self) -> bool; 447 get_visible_vertical(&self) -> bool448 fn get_visible_vertical(&self) -> bool; 449 rebuild_menu(&self)450 fn rebuild_menu(&self); 451 retrieve_proxy_menu_item(&self) -> Option<Widget>452 fn retrieve_proxy_menu_item(&self) -> Option<Widget>; 453 set_expand(&self, expand: bool)454 fn set_expand(&self, expand: bool); 455 set_homogeneous(&self, homogeneous: bool)456 fn set_homogeneous(&self, homogeneous: bool); 457 set_is_important(&self, is_important: bool)458 fn set_is_important(&self, is_important: bool); 459 set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>)460 fn set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>); 461 set_use_drag_window(&self, use_drag_window: bool)462 fn set_use_drag_window(&self, use_drag_window: bool); 463 set_visible_horizontal(&self, visible_horizontal: bool)464 fn set_visible_horizontal(&self, visible_horizontal: bool); 465 set_visible_vertical(&self, visible_vertical: bool)466 fn set_visible_vertical(&self, visible_vertical: bool); 467 toolbar_reconfigured(&self)468 fn toolbar_reconfigured(&self); 469 connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId470 fn connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>( 471 &self, 472 f: F, 473 ) -> SignalHandlerId; 474 connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId475 fn connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 476 connect_property_is_important_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId477 fn connect_property_is_important_notify<F: Fn(&Self) + 'static>(&self, f: F) 478 -> SignalHandlerId; 479 connect_property_visible_horizontal_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId480 fn connect_property_visible_horizontal_notify<F: Fn(&Self) + 'static>( 481 &self, 482 f: F, 483 ) -> SignalHandlerId; 484 connect_property_visible_vertical_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId485 fn connect_property_visible_vertical_notify<F: Fn(&Self) + 'static>( 486 &self, 487 f: F, 488 ) -> SignalHandlerId; 489 } 490 491 impl<O: IsA<ToolItem>> ToolItemExt for O { get_ellipsize_mode(&self) -> pango::EllipsizeMode492 fn get_ellipsize_mode(&self) -> pango::EllipsizeMode { 493 unsafe { 494 from_glib(gtk_sys::gtk_tool_item_get_ellipsize_mode( 495 self.as_ref().to_glib_none().0, 496 )) 497 } 498 } 499 get_expand(&self) -> bool500 fn get_expand(&self) -> bool { 501 unsafe { 502 from_glib(gtk_sys::gtk_tool_item_get_expand( 503 self.as_ref().to_glib_none().0, 504 )) 505 } 506 } 507 get_homogeneous(&self) -> bool508 fn get_homogeneous(&self) -> bool { 509 unsafe { 510 from_glib(gtk_sys::gtk_tool_item_get_homogeneous( 511 self.as_ref().to_glib_none().0, 512 )) 513 } 514 } 515 get_icon_size(&self) -> IconSize516 fn get_icon_size(&self) -> IconSize { 517 unsafe { 518 from_glib(gtk_sys::gtk_tool_item_get_icon_size( 519 self.as_ref().to_glib_none().0, 520 )) 521 } 522 } 523 get_is_important(&self) -> bool524 fn get_is_important(&self) -> bool { 525 unsafe { 526 from_glib(gtk_sys::gtk_tool_item_get_is_important( 527 self.as_ref().to_glib_none().0, 528 )) 529 } 530 } 531 get_orientation(&self) -> Orientation532 fn get_orientation(&self) -> Orientation { 533 unsafe { 534 from_glib(gtk_sys::gtk_tool_item_get_orientation( 535 self.as_ref().to_glib_none().0, 536 )) 537 } 538 } 539 get_proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget>540 fn get_proxy_menu_item(&self, menu_item_id: &str) -> Option<Widget> { 541 unsafe { 542 from_glib_none(gtk_sys::gtk_tool_item_get_proxy_menu_item( 543 self.as_ref().to_glib_none().0, 544 menu_item_id.to_glib_none().0, 545 )) 546 } 547 } 548 get_relief_style(&self) -> ReliefStyle549 fn get_relief_style(&self) -> ReliefStyle { 550 unsafe { 551 from_glib(gtk_sys::gtk_tool_item_get_relief_style( 552 self.as_ref().to_glib_none().0, 553 )) 554 } 555 } 556 get_text_alignment(&self) -> f32557 fn get_text_alignment(&self) -> f32 { 558 unsafe { gtk_sys::gtk_tool_item_get_text_alignment(self.as_ref().to_glib_none().0) } 559 } 560 get_text_orientation(&self) -> Orientation561 fn get_text_orientation(&self) -> Orientation { 562 unsafe { 563 from_glib(gtk_sys::gtk_tool_item_get_text_orientation( 564 self.as_ref().to_glib_none().0, 565 )) 566 } 567 } 568 get_text_size_group(&self) -> Option<SizeGroup>569 fn get_text_size_group(&self) -> Option<SizeGroup> { 570 unsafe { 571 from_glib_none(gtk_sys::gtk_tool_item_get_text_size_group( 572 self.as_ref().to_glib_none().0, 573 )) 574 } 575 } 576 get_toolbar_style(&self) -> ToolbarStyle577 fn get_toolbar_style(&self) -> ToolbarStyle { 578 unsafe { 579 from_glib(gtk_sys::gtk_tool_item_get_toolbar_style( 580 self.as_ref().to_glib_none().0, 581 )) 582 } 583 } 584 get_use_drag_window(&self) -> bool585 fn get_use_drag_window(&self) -> bool { 586 unsafe { 587 from_glib(gtk_sys::gtk_tool_item_get_use_drag_window( 588 self.as_ref().to_glib_none().0, 589 )) 590 } 591 } 592 get_visible_horizontal(&self) -> bool593 fn get_visible_horizontal(&self) -> bool { 594 unsafe { 595 from_glib(gtk_sys::gtk_tool_item_get_visible_horizontal( 596 self.as_ref().to_glib_none().0, 597 )) 598 } 599 } 600 get_visible_vertical(&self) -> bool601 fn get_visible_vertical(&self) -> bool { 602 unsafe { 603 from_glib(gtk_sys::gtk_tool_item_get_visible_vertical( 604 self.as_ref().to_glib_none().0, 605 )) 606 } 607 } 608 rebuild_menu(&self)609 fn rebuild_menu(&self) { 610 unsafe { 611 gtk_sys::gtk_tool_item_rebuild_menu(self.as_ref().to_glib_none().0); 612 } 613 } 614 retrieve_proxy_menu_item(&self) -> Option<Widget>615 fn retrieve_proxy_menu_item(&self) -> Option<Widget> { 616 unsafe { 617 from_glib_none(gtk_sys::gtk_tool_item_retrieve_proxy_menu_item( 618 self.as_ref().to_glib_none().0, 619 )) 620 } 621 } 622 set_expand(&self, expand: bool)623 fn set_expand(&self, expand: bool) { 624 unsafe { 625 gtk_sys::gtk_tool_item_set_expand(self.as_ref().to_glib_none().0, expand.to_glib()); 626 } 627 } 628 set_homogeneous(&self, homogeneous: bool)629 fn set_homogeneous(&self, homogeneous: bool) { 630 unsafe { 631 gtk_sys::gtk_tool_item_set_homogeneous( 632 self.as_ref().to_glib_none().0, 633 homogeneous.to_glib(), 634 ); 635 } 636 } 637 set_is_important(&self, is_important: bool)638 fn set_is_important(&self, is_important: bool) { 639 unsafe { 640 gtk_sys::gtk_tool_item_set_is_important( 641 self.as_ref().to_glib_none().0, 642 is_important.to_glib(), 643 ); 644 } 645 } 646 set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>)647 fn set_proxy_menu_item<P: IsA<Widget>>(&self, menu_item_id: &str, menu_item: Option<&P>) { 648 unsafe { 649 gtk_sys::gtk_tool_item_set_proxy_menu_item( 650 self.as_ref().to_glib_none().0, 651 menu_item_id.to_glib_none().0, 652 menu_item.map(|p| p.as_ref()).to_glib_none().0, 653 ); 654 } 655 } 656 set_use_drag_window(&self, use_drag_window: bool)657 fn set_use_drag_window(&self, use_drag_window: bool) { 658 unsafe { 659 gtk_sys::gtk_tool_item_set_use_drag_window( 660 self.as_ref().to_glib_none().0, 661 use_drag_window.to_glib(), 662 ); 663 } 664 } 665 set_visible_horizontal(&self, visible_horizontal: bool)666 fn set_visible_horizontal(&self, visible_horizontal: bool) { 667 unsafe { 668 gtk_sys::gtk_tool_item_set_visible_horizontal( 669 self.as_ref().to_glib_none().0, 670 visible_horizontal.to_glib(), 671 ); 672 } 673 } 674 set_visible_vertical(&self, visible_vertical: bool)675 fn set_visible_vertical(&self, visible_vertical: bool) { 676 unsafe { 677 gtk_sys::gtk_tool_item_set_visible_vertical( 678 self.as_ref().to_glib_none().0, 679 visible_vertical.to_glib(), 680 ); 681 } 682 } 683 toolbar_reconfigured(&self)684 fn toolbar_reconfigured(&self) { 685 unsafe { 686 gtk_sys::gtk_tool_item_toolbar_reconfigured(self.as_ref().to_glib_none().0); 687 } 688 } 689 connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId690 fn connect_create_menu_proxy<F: Fn(&Self) -> glib::signal::Inhibit + 'static>( 691 &self, 692 f: F, 693 ) -> SignalHandlerId { 694 unsafe extern "C" fn create_menu_proxy_trampoline< 695 P, 696 F: Fn(&P) -> glib::signal::Inhibit + 'static, 697 >( 698 this: *mut gtk_sys::GtkToolItem, 699 f: glib_sys::gpointer, 700 ) -> glib_sys::gboolean 701 where 702 P: IsA<ToolItem>, 703 { 704 let f: &F = &*(f as *const F); 705 f(&ToolItem::from_glib_borrow(this).unsafe_cast()).to_glib() 706 } 707 unsafe { 708 let f: Box_<F> = Box_::new(f); 709 connect_raw( 710 self.as_ptr() as *mut _, 711 b"create-menu-proxy\0".as_ptr() as *const _, 712 Some(transmute(create_menu_proxy_trampoline::<Self, F> as usize)), 713 Box_::into_raw(f), 714 ) 715 } 716 } 717 connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId718 fn connect_toolbar_reconfigured<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 719 unsafe extern "C" fn toolbar_reconfigured_trampoline<P, F: Fn(&P) + 'static>( 720 this: *mut gtk_sys::GtkToolItem, 721 f: glib_sys::gpointer, 722 ) where 723 P: IsA<ToolItem>, 724 { 725 let f: &F = &*(f as *const F); 726 f(&ToolItem::from_glib_borrow(this).unsafe_cast()) 727 } 728 unsafe { 729 let f: Box_<F> = Box_::new(f); 730 connect_raw( 731 self.as_ptr() as *mut _, 732 b"toolbar-reconfigured\0".as_ptr() as *const _, 733 Some(transmute( 734 toolbar_reconfigured_trampoline::<Self, F> as usize, 735 )), 736 Box_::into_raw(f), 737 ) 738 } 739 } 740 connect_property_is_important_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId741 fn connect_property_is_important_notify<F: Fn(&Self) + 'static>( 742 &self, 743 f: F, 744 ) -> SignalHandlerId { 745 unsafe extern "C" fn notify_is_important_trampoline<P, F: Fn(&P) + 'static>( 746 this: *mut gtk_sys::GtkToolItem, 747 _param_spec: glib_sys::gpointer, 748 f: glib_sys::gpointer, 749 ) where 750 P: IsA<ToolItem>, 751 { 752 let f: &F = &*(f as *const F); 753 f(&ToolItem::from_glib_borrow(this).unsafe_cast()) 754 } 755 unsafe { 756 let f: Box_<F> = Box_::new(f); 757 connect_raw( 758 self.as_ptr() as *mut _, 759 b"notify::is-important\0".as_ptr() as *const _, 760 Some(transmute( 761 notify_is_important_trampoline::<Self, F> as usize, 762 )), 763 Box_::into_raw(f), 764 ) 765 } 766 } 767 connect_property_visible_horizontal_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId768 fn connect_property_visible_horizontal_notify<F: Fn(&Self) + 'static>( 769 &self, 770 f: F, 771 ) -> SignalHandlerId { 772 unsafe extern "C" fn notify_visible_horizontal_trampoline<P, F: Fn(&P) + 'static>( 773 this: *mut gtk_sys::GtkToolItem, 774 _param_spec: glib_sys::gpointer, 775 f: glib_sys::gpointer, 776 ) where 777 P: IsA<ToolItem>, 778 { 779 let f: &F = &*(f as *const F); 780 f(&ToolItem::from_glib_borrow(this).unsafe_cast()) 781 } 782 unsafe { 783 let f: Box_<F> = Box_::new(f); 784 connect_raw( 785 self.as_ptr() as *mut _, 786 b"notify::visible-horizontal\0".as_ptr() as *const _, 787 Some(transmute( 788 notify_visible_horizontal_trampoline::<Self, F> as usize, 789 )), 790 Box_::into_raw(f), 791 ) 792 } 793 } 794 connect_property_visible_vertical_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId795 fn connect_property_visible_vertical_notify<F: Fn(&Self) + 'static>( 796 &self, 797 f: F, 798 ) -> SignalHandlerId { 799 unsafe extern "C" fn notify_visible_vertical_trampoline<P, F: Fn(&P) + 'static>( 800 this: *mut gtk_sys::GtkToolItem, 801 _param_spec: glib_sys::gpointer, 802 f: glib_sys::gpointer, 803 ) where 804 P: IsA<ToolItem>, 805 { 806 let f: &F = &*(f as *const F); 807 f(&ToolItem::from_glib_borrow(this).unsafe_cast()) 808 } 809 unsafe { 810 let f: Box_<F> = Box_::new(f); 811 connect_raw( 812 self.as_ptr() as *mut _, 813 b"notify::visible-vertical\0".as_ptr() as *const _, 814 Some(transmute( 815 notify_visible_vertical_trampoline::<Self, F> as usize, 816 )), 817 Box_::into_raw(f), 818 ) 819 } 820 } 821 } 822 823 impl fmt::Display for ToolItem { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result824 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 825 write!(f, "ToolItem") 826 } 827 } 828