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::Value; 14 use glib_sys; 15 use gobject_sys; 16 use gtk_sys; 17 use std::boxed::Box as Box_; 18 use std::fmt; 19 use std::mem::transmute; 20 use Align; 21 use Buildable; 22 use Container; 23 use DestDefaults; 24 use IconSize; 25 use Orientable; 26 use ResizeMode; 27 use Scrollable; 28 use SelectionData; 29 use TargetEntry; 30 use ToolItem; 31 use ToolItemGroup; 32 use ToolPaletteDragTargets; 33 use ToolbarStyle; 34 use Widget; 35 36 glib_wrapper! { 37 pub struct ToolPalette(Object<gtk_sys::GtkToolPalette, gtk_sys::GtkToolPaletteClass, ToolPaletteClass>) @extends Container, Widget, @implements Buildable, Orientable, Scrollable; 38 39 match fn { 40 get_type => || gtk_sys::gtk_tool_palette_get_type(), 41 } 42 } 43 44 impl ToolPalette { new() -> ToolPalette45 pub fn new() -> ToolPalette { 46 assert_initialized_main_thread!(); 47 unsafe { Widget::from_glib_none(gtk_sys::gtk_tool_palette_new()).unsafe_cast() } 48 } 49 get_drag_target_group() -> Option<TargetEntry>50 pub fn get_drag_target_group() -> Option<TargetEntry> { 51 assert_initialized_main_thread!(); 52 unsafe { from_glib_none(gtk_sys::gtk_tool_palette_get_drag_target_group()) } 53 } 54 get_drag_target_item() -> Option<TargetEntry>55 pub fn get_drag_target_item() -> Option<TargetEntry> { 56 assert_initialized_main_thread!(); 57 unsafe { from_glib_none(gtk_sys::gtk_tool_palette_get_drag_target_item()) } 58 } 59 } 60 61 impl Default for ToolPalette { default() -> Self62 fn default() -> Self { 63 Self::new() 64 } 65 } 66 67 pub struct ToolPaletteBuilder { 68 icon_size: Option<IconSize>, 69 icon_size_set: Option<bool>, 70 toolbar_style: Option<ToolbarStyle>, 71 border_width: Option<u32>, 72 child: Option<Widget>, 73 resize_mode: Option<ResizeMode>, 74 app_paintable: Option<bool>, 75 can_default: Option<bool>, 76 can_focus: Option<bool>, 77 events: Option<gdk::EventMask>, 78 expand: Option<bool>, 79 #[cfg(any(feature = "v3_20", feature = "dox"))] 80 focus_on_click: Option<bool>, 81 halign: Option<Align>, 82 has_default: Option<bool>, 83 has_focus: Option<bool>, 84 has_tooltip: Option<bool>, 85 height_request: Option<i32>, 86 hexpand: Option<bool>, 87 hexpand_set: Option<bool>, 88 is_focus: Option<bool>, 89 margin: Option<i32>, 90 margin_bottom: Option<i32>, 91 margin_end: Option<i32>, 92 margin_start: Option<i32>, 93 margin_top: Option<i32>, 94 name: Option<String>, 95 no_show_all: Option<bool>, 96 opacity: Option<f64>, 97 parent: Option<Container>, 98 receives_default: Option<bool>, 99 sensitive: Option<bool>, 100 //style: /*Unknown type*/, 101 tooltip_markup: Option<String>, 102 tooltip_text: Option<String>, 103 valign: Option<Align>, 104 vexpand: Option<bool>, 105 vexpand_set: Option<bool>, 106 visible: Option<bool>, 107 width_request: Option<i32>, 108 } 109 110 impl ToolPaletteBuilder { new() -> Self111 pub fn new() -> Self { 112 Self { 113 icon_size: None, 114 icon_size_set: None, 115 toolbar_style: None, 116 border_width: None, 117 child: None, 118 resize_mode: None, 119 app_paintable: None, 120 can_default: None, 121 can_focus: None, 122 events: None, 123 expand: None, 124 #[cfg(any(feature = "v3_20", feature = "dox"))] 125 focus_on_click: None, 126 halign: None, 127 has_default: None, 128 has_focus: None, 129 has_tooltip: None, 130 height_request: None, 131 hexpand: None, 132 hexpand_set: None, 133 is_focus: None, 134 margin: None, 135 margin_bottom: None, 136 margin_end: None, 137 margin_start: None, 138 margin_top: None, 139 name: None, 140 no_show_all: None, 141 opacity: None, 142 parent: None, 143 receives_default: None, 144 sensitive: None, 145 tooltip_markup: None, 146 tooltip_text: None, 147 valign: None, 148 vexpand: None, 149 vexpand_set: None, 150 visible: None, 151 width_request: None, 152 } 153 } 154 build(self) -> ToolPalette155 pub fn build(self) -> ToolPalette { 156 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 157 if let Some(ref icon_size) = self.icon_size { 158 properties.push(("icon-size", icon_size)); 159 } 160 if let Some(ref icon_size_set) = self.icon_size_set { 161 properties.push(("icon-size-set", icon_size_set)); 162 } 163 if let Some(ref toolbar_style) = self.toolbar_style { 164 properties.push(("toolbar-style", toolbar_style)); 165 } 166 if let Some(ref border_width) = self.border_width { 167 properties.push(("border-width", border_width)); 168 } 169 if let Some(ref child) = self.child { 170 properties.push(("child", child)); 171 } 172 if let Some(ref resize_mode) = self.resize_mode { 173 properties.push(("resize-mode", resize_mode)); 174 } 175 if let Some(ref app_paintable) = self.app_paintable { 176 properties.push(("app-paintable", app_paintable)); 177 } 178 if let Some(ref can_default) = self.can_default { 179 properties.push(("can-default", can_default)); 180 } 181 if let Some(ref can_focus) = self.can_focus { 182 properties.push(("can-focus", can_focus)); 183 } 184 if let Some(ref events) = self.events { 185 properties.push(("events", events)); 186 } 187 if let Some(ref expand) = self.expand { 188 properties.push(("expand", expand)); 189 } 190 #[cfg(any(feature = "v3_20", feature = "dox"))] 191 { 192 if let Some(ref focus_on_click) = self.focus_on_click { 193 properties.push(("focus-on-click", focus_on_click)); 194 } 195 } 196 if let Some(ref halign) = self.halign { 197 properties.push(("halign", halign)); 198 } 199 if let Some(ref has_default) = self.has_default { 200 properties.push(("has-default", has_default)); 201 } 202 if let Some(ref has_focus) = self.has_focus { 203 properties.push(("has-focus", has_focus)); 204 } 205 if let Some(ref has_tooltip) = self.has_tooltip { 206 properties.push(("has-tooltip", has_tooltip)); 207 } 208 if let Some(ref height_request) = self.height_request { 209 properties.push(("height-request", height_request)); 210 } 211 if let Some(ref hexpand) = self.hexpand { 212 properties.push(("hexpand", hexpand)); 213 } 214 if let Some(ref hexpand_set) = self.hexpand_set { 215 properties.push(("hexpand-set", hexpand_set)); 216 } 217 if let Some(ref is_focus) = self.is_focus { 218 properties.push(("is-focus", is_focus)); 219 } 220 if let Some(ref margin) = self.margin { 221 properties.push(("margin", margin)); 222 } 223 if let Some(ref margin_bottom) = self.margin_bottom { 224 properties.push(("margin-bottom", margin_bottom)); 225 } 226 if let Some(ref margin_end) = self.margin_end { 227 properties.push(("margin-end", margin_end)); 228 } 229 if let Some(ref margin_start) = self.margin_start { 230 properties.push(("margin-start", margin_start)); 231 } 232 if let Some(ref margin_top) = self.margin_top { 233 properties.push(("margin-top", margin_top)); 234 } 235 if let Some(ref name) = self.name { 236 properties.push(("name", name)); 237 } 238 if let Some(ref no_show_all) = self.no_show_all { 239 properties.push(("no-show-all", no_show_all)); 240 } 241 if let Some(ref opacity) = self.opacity { 242 properties.push(("opacity", opacity)); 243 } 244 if let Some(ref parent) = self.parent { 245 properties.push(("parent", parent)); 246 } 247 if let Some(ref receives_default) = self.receives_default { 248 properties.push(("receives-default", receives_default)); 249 } 250 if let Some(ref sensitive) = self.sensitive { 251 properties.push(("sensitive", sensitive)); 252 } 253 if let Some(ref tooltip_markup) = self.tooltip_markup { 254 properties.push(("tooltip-markup", tooltip_markup)); 255 } 256 if let Some(ref tooltip_text) = self.tooltip_text { 257 properties.push(("tooltip-text", tooltip_text)); 258 } 259 if let Some(ref valign) = self.valign { 260 properties.push(("valign", valign)); 261 } 262 if let Some(ref vexpand) = self.vexpand { 263 properties.push(("vexpand", vexpand)); 264 } 265 if let Some(ref vexpand_set) = self.vexpand_set { 266 properties.push(("vexpand-set", vexpand_set)); 267 } 268 if let Some(ref visible) = self.visible { 269 properties.push(("visible", visible)); 270 } 271 if let Some(ref width_request) = self.width_request { 272 properties.push(("width-request", width_request)); 273 } 274 glib::Object::new(ToolPalette::static_type(), &properties) 275 .expect("object new") 276 .downcast() 277 .expect("downcast") 278 } 279 icon_size(mut self, icon_size: IconSize) -> Self280 pub fn icon_size(mut self, icon_size: IconSize) -> Self { 281 self.icon_size = Some(icon_size); 282 self 283 } 284 icon_size_set(mut self, icon_size_set: bool) -> Self285 pub fn icon_size_set(mut self, icon_size_set: bool) -> Self { 286 self.icon_size_set = Some(icon_size_set); 287 self 288 } 289 toolbar_style(mut self, toolbar_style: ToolbarStyle) -> Self290 pub fn toolbar_style(mut self, toolbar_style: ToolbarStyle) -> Self { 291 self.toolbar_style = Some(toolbar_style); 292 self 293 } 294 border_width(mut self, border_width: u32) -> Self295 pub fn border_width(mut self, border_width: u32) -> Self { 296 self.border_width = Some(border_width); 297 self 298 } 299 child(mut self, child: &Widget) -> Self300 pub fn child(mut self, child: &Widget) -> Self { 301 self.child = Some(child.clone()); 302 self 303 } 304 resize_mode(mut self, resize_mode: ResizeMode) -> Self305 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 306 self.resize_mode = Some(resize_mode); 307 self 308 } 309 app_paintable(mut self, app_paintable: bool) -> Self310 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 311 self.app_paintable = Some(app_paintable); 312 self 313 } 314 can_default(mut self, can_default: bool) -> Self315 pub fn can_default(mut self, can_default: bool) -> Self { 316 self.can_default = Some(can_default); 317 self 318 } 319 can_focus(mut self, can_focus: bool) -> Self320 pub fn can_focus(mut self, can_focus: bool) -> Self { 321 self.can_focus = Some(can_focus); 322 self 323 } 324 events(mut self, events: gdk::EventMask) -> Self325 pub fn events(mut self, events: gdk::EventMask) -> Self { 326 self.events = Some(events); 327 self 328 } 329 expand(mut self, expand: bool) -> Self330 pub fn expand(mut self, expand: bool) -> Self { 331 self.expand = Some(expand); 332 self 333 } 334 335 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self336 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 337 self.focus_on_click = Some(focus_on_click); 338 self 339 } 340 halign(mut self, halign: Align) -> Self341 pub fn halign(mut self, halign: Align) -> Self { 342 self.halign = Some(halign); 343 self 344 } 345 has_default(mut self, has_default: bool) -> Self346 pub fn has_default(mut self, has_default: bool) -> Self { 347 self.has_default = Some(has_default); 348 self 349 } 350 has_focus(mut self, has_focus: bool) -> Self351 pub fn has_focus(mut self, has_focus: bool) -> Self { 352 self.has_focus = Some(has_focus); 353 self 354 } 355 has_tooltip(mut self, has_tooltip: bool) -> Self356 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 357 self.has_tooltip = Some(has_tooltip); 358 self 359 } 360 height_request(mut self, height_request: i32) -> Self361 pub fn height_request(mut self, height_request: i32) -> Self { 362 self.height_request = Some(height_request); 363 self 364 } 365 hexpand(mut self, hexpand: bool) -> Self366 pub fn hexpand(mut self, hexpand: bool) -> Self { 367 self.hexpand = Some(hexpand); 368 self 369 } 370 hexpand_set(mut self, hexpand_set: bool) -> Self371 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 372 self.hexpand_set = Some(hexpand_set); 373 self 374 } 375 is_focus(mut self, is_focus: bool) -> Self376 pub fn is_focus(mut self, is_focus: bool) -> Self { 377 self.is_focus = Some(is_focus); 378 self 379 } 380 margin(mut self, margin: i32) -> Self381 pub fn margin(mut self, margin: i32) -> Self { 382 self.margin = Some(margin); 383 self 384 } 385 margin_bottom(mut self, margin_bottom: i32) -> Self386 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 387 self.margin_bottom = Some(margin_bottom); 388 self 389 } 390 margin_end(mut self, margin_end: i32) -> Self391 pub fn margin_end(mut self, margin_end: i32) -> Self { 392 self.margin_end = Some(margin_end); 393 self 394 } 395 margin_start(mut self, margin_start: i32) -> Self396 pub fn margin_start(mut self, margin_start: i32) -> Self { 397 self.margin_start = Some(margin_start); 398 self 399 } 400 margin_top(mut self, margin_top: i32) -> Self401 pub fn margin_top(mut self, margin_top: i32) -> Self { 402 self.margin_top = Some(margin_top); 403 self 404 } 405 name(mut self, name: &str) -> Self406 pub fn name(mut self, name: &str) -> Self { 407 self.name = Some(name.to_string()); 408 self 409 } 410 no_show_all(mut self, no_show_all: bool) -> Self411 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 412 self.no_show_all = Some(no_show_all); 413 self 414 } 415 opacity(mut self, opacity: f64) -> Self416 pub fn opacity(mut self, opacity: f64) -> Self { 417 self.opacity = Some(opacity); 418 self 419 } 420 parent(mut self, parent: &Container) -> Self421 pub fn parent(mut self, parent: &Container) -> Self { 422 self.parent = Some(parent.clone()); 423 self 424 } 425 receives_default(mut self, receives_default: bool) -> Self426 pub fn receives_default(mut self, receives_default: bool) -> Self { 427 self.receives_default = Some(receives_default); 428 self 429 } 430 sensitive(mut self, sensitive: bool) -> Self431 pub fn sensitive(mut self, sensitive: bool) -> Self { 432 self.sensitive = Some(sensitive); 433 self 434 } 435 tooltip_markup(mut self, tooltip_markup: &str) -> Self436 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 437 self.tooltip_markup = Some(tooltip_markup.to_string()); 438 self 439 } 440 tooltip_text(mut self, tooltip_text: &str) -> Self441 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 442 self.tooltip_text = Some(tooltip_text.to_string()); 443 self 444 } 445 valign(mut self, valign: Align) -> Self446 pub fn valign(mut self, valign: Align) -> Self { 447 self.valign = Some(valign); 448 self 449 } 450 vexpand(mut self, vexpand: bool) -> Self451 pub fn vexpand(mut self, vexpand: bool) -> Self { 452 self.vexpand = Some(vexpand); 453 self 454 } 455 vexpand_set(mut self, vexpand_set: bool) -> Self456 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 457 self.vexpand_set = Some(vexpand_set); 458 self 459 } 460 visible(mut self, visible: bool) -> Self461 pub fn visible(mut self, visible: bool) -> Self { 462 self.visible = Some(visible); 463 self 464 } 465 width_request(mut self, width_request: i32) -> Self466 pub fn width_request(mut self, width_request: i32) -> Self { 467 self.width_request = Some(width_request); 468 self 469 } 470 } 471 472 pub const NONE_TOOL_PALETTE: Option<&ToolPalette> = None; 473 474 pub trait ToolPaletteExt: 'static { add_drag_dest<P: IsA<Widget>>( &self, widget: &P, flags: DestDefaults, targets: ToolPaletteDragTargets, actions: gdk::DragAction, )475 fn add_drag_dest<P: IsA<Widget>>( 476 &self, 477 widget: &P, 478 flags: DestDefaults, 479 targets: ToolPaletteDragTargets, 480 actions: gdk::DragAction, 481 ); 482 get_drag_item(&self, selection: &SelectionData) -> Option<Widget>483 fn get_drag_item(&self, selection: &SelectionData) -> Option<Widget>; 484 get_drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup>485 fn get_drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup>; 486 get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem>487 fn get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem>; 488 get_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool489 fn get_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool; 490 get_expand<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool491 fn get_expand<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool; 492 get_group_position<P: IsA<ToolItemGroup>>(&self, group: &P) -> i32493 fn get_group_position<P: IsA<ToolItemGroup>>(&self, group: &P) -> i32; 494 get_icon_size(&self) -> IconSize495 fn get_icon_size(&self) -> IconSize; 496 get_style(&self) -> ToolbarStyle497 fn get_style(&self) -> ToolbarStyle; 498 set_drag_source(&self, targets: ToolPaletteDragTargets)499 fn set_drag_source(&self, targets: ToolPaletteDragTargets); 500 set_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P, exclusive: bool)501 fn set_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P, exclusive: bool); 502 set_expand<P: IsA<ToolItemGroup>>(&self, group: &P, expand: bool)503 fn set_expand<P: IsA<ToolItemGroup>>(&self, group: &P, expand: bool); 504 set_group_position<P: IsA<ToolItemGroup>>(&self, group: &P, position: i32)505 fn set_group_position<P: IsA<ToolItemGroup>>(&self, group: &P, position: i32); 506 set_icon_size(&self, icon_size: IconSize)507 fn set_icon_size(&self, icon_size: IconSize); 508 set_style(&self, style: ToolbarStyle)509 fn set_style(&self, style: ToolbarStyle); 510 unset_icon_size(&self)511 fn unset_icon_size(&self); 512 unset_style(&self)513 fn unset_style(&self); 514 get_property_icon_size_set(&self) -> bool515 fn get_property_icon_size_set(&self) -> bool; 516 set_property_icon_size_set(&self, icon_size_set: bool)517 fn set_property_icon_size_set(&self, icon_size_set: bool); 518 get_property_toolbar_style(&self) -> ToolbarStyle519 fn get_property_toolbar_style(&self) -> ToolbarStyle; 520 set_property_toolbar_style(&self, toolbar_style: ToolbarStyle)521 fn set_property_toolbar_style(&self, toolbar_style: ToolbarStyle); 522 connect_property_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId523 fn connect_property_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 524 connect_property_icon_size_set_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId525 fn connect_property_icon_size_set_notify<F: Fn(&Self) + 'static>( 526 &self, 527 f: F, 528 ) -> SignalHandlerId; 529 connect_property_toolbar_style_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId530 fn connect_property_toolbar_style_notify<F: Fn(&Self) + 'static>( 531 &self, 532 f: F, 533 ) -> SignalHandlerId; 534 } 535 536 impl<O: IsA<ToolPalette>> ToolPaletteExt for O { add_drag_dest<P: IsA<Widget>>( &self, widget: &P, flags: DestDefaults, targets: ToolPaletteDragTargets, actions: gdk::DragAction, )537 fn add_drag_dest<P: IsA<Widget>>( 538 &self, 539 widget: &P, 540 flags: DestDefaults, 541 targets: ToolPaletteDragTargets, 542 actions: gdk::DragAction, 543 ) { 544 unsafe { 545 gtk_sys::gtk_tool_palette_add_drag_dest( 546 self.as_ref().to_glib_none().0, 547 widget.as_ref().to_glib_none().0, 548 flags.to_glib(), 549 targets.to_glib(), 550 actions.to_glib(), 551 ); 552 } 553 } 554 get_drag_item(&self, selection: &SelectionData) -> Option<Widget>555 fn get_drag_item(&self, selection: &SelectionData) -> Option<Widget> { 556 unsafe { 557 from_glib_none(gtk_sys::gtk_tool_palette_get_drag_item( 558 self.as_ref().to_glib_none().0, 559 selection.to_glib_none().0, 560 )) 561 } 562 } 563 get_drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup>564 fn get_drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup> { 565 unsafe { 566 from_glib_none(gtk_sys::gtk_tool_palette_get_drop_group( 567 self.as_ref().to_glib_none().0, 568 x, 569 y, 570 )) 571 } 572 } 573 get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem>574 fn get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem> { 575 unsafe { 576 from_glib_none(gtk_sys::gtk_tool_palette_get_drop_item( 577 self.as_ref().to_glib_none().0, 578 x, 579 y, 580 )) 581 } 582 } 583 get_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool584 fn get_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool { 585 unsafe { 586 from_glib(gtk_sys::gtk_tool_palette_get_exclusive( 587 self.as_ref().to_glib_none().0, 588 group.as_ref().to_glib_none().0, 589 )) 590 } 591 } 592 get_expand<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool593 fn get_expand<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool { 594 unsafe { 595 from_glib(gtk_sys::gtk_tool_palette_get_expand( 596 self.as_ref().to_glib_none().0, 597 group.as_ref().to_glib_none().0, 598 )) 599 } 600 } 601 get_group_position<P: IsA<ToolItemGroup>>(&self, group: &P) -> i32602 fn get_group_position<P: IsA<ToolItemGroup>>(&self, group: &P) -> i32 { 603 unsafe { 604 gtk_sys::gtk_tool_palette_get_group_position( 605 self.as_ref().to_glib_none().0, 606 group.as_ref().to_glib_none().0, 607 ) 608 } 609 } 610 get_icon_size(&self) -> IconSize611 fn get_icon_size(&self) -> IconSize { 612 unsafe { 613 from_glib(gtk_sys::gtk_tool_palette_get_icon_size( 614 self.as_ref().to_glib_none().0, 615 )) 616 } 617 } 618 get_style(&self) -> ToolbarStyle619 fn get_style(&self) -> ToolbarStyle { 620 unsafe { 621 from_glib(gtk_sys::gtk_tool_palette_get_style( 622 self.as_ref().to_glib_none().0, 623 )) 624 } 625 } 626 set_drag_source(&self, targets: ToolPaletteDragTargets)627 fn set_drag_source(&self, targets: ToolPaletteDragTargets) { 628 unsafe { 629 gtk_sys::gtk_tool_palette_set_drag_source( 630 self.as_ref().to_glib_none().0, 631 targets.to_glib(), 632 ); 633 } 634 } 635 set_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P, exclusive: bool)636 fn set_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P, exclusive: bool) { 637 unsafe { 638 gtk_sys::gtk_tool_palette_set_exclusive( 639 self.as_ref().to_glib_none().0, 640 group.as_ref().to_glib_none().0, 641 exclusive.to_glib(), 642 ); 643 } 644 } 645 set_expand<P: IsA<ToolItemGroup>>(&self, group: &P, expand: bool)646 fn set_expand<P: IsA<ToolItemGroup>>(&self, group: &P, expand: bool) { 647 unsafe { 648 gtk_sys::gtk_tool_palette_set_expand( 649 self.as_ref().to_glib_none().0, 650 group.as_ref().to_glib_none().0, 651 expand.to_glib(), 652 ); 653 } 654 } 655 set_group_position<P: IsA<ToolItemGroup>>(&self, group: &P, position: i32)656 fn set_group_position<P: IsA<ToolItemGroup>>(&self, group: &P, position: i32) { 657 unsafe { 658 gtk_sys::gtk_tool_palette_set_group_position( 659 self.as_ref().to_glib_none().0, 660 group.as_ref().to_glib_none().0, 661 position, 662 ); 663 } 664 } 665 set_icon_size(&self, icon_size: IconSize)666 fn set_icon_size(&self, icon_size: IconSize) { 667 unsafe { 668 gtk_sys::gtk_tool_palette_set_icon_size( 669 self.as_ref().to_glib_none().0, 670 icon_size.to_glib(), 671 ); 672 } 673 } 674 set_style(&self, style: ToolbarStyle)675 fn set_style(&self, style: ToolbarStyle) { 676 unsafe { 677 gtk_sys::gtk_tool_palette_set_style(self.as_ref().to_glib_none().0, style.to_glib()); 678 } 679 } 680 unset_icon_size(&self)681 fn unset_icon_size(&self) { 682 unsafe { 683 gtk_sys::gtk_tool_palette_unset_icon_size(self.as_ref().to_glib_none().0); 684 } 685 } 686 unset_style(&self)687 fn unset_style(&self) { 688 unsafe { 689 gtk_sys::gtk_tool_palette_unset_style(self.as_ref().to_glib_none().0); 690 } 691 } 692 get_property_icon_size_set(&self) -> bool693 fn get_property_icon_size_set(&self) -> bool { 694 unsafe { 695 let mut value = Value::from_type(<bool as StaticType>::static_type()); 696 gobject_sys::g_object_get_property( 697 self.to_glib_none().0 as *mut gobject_sys::GObject, 698 b"icon-size-set\0".as_ptr() as *const _, 699 value.to_glib_none_mut().0, 700 ); 701 value.get().unwrap() 702 } 703 } 704 set_property_icon_size_set(&self, icon_size_set: bool)705 fn set_property_icon_size_set(&self, icon_size_set: bool) { 706 unsafe { 707 gobject_sys::g_object_set_property( 708 self.to_glib_none().0 as *mut gobject_sys::GObject, 709 b"icon-size-set\0".as_ptr() as *const _, 710 Value::from(&icon_size_set).to_glib_none().0, 711 ); 712 } 713 } 714 get_property_toolbar_style(&self) -> ToolbarStyle715 fn get_property_toolbar_style(&self) -> ToolbarStyle { 716 unsafe { 717 let mut value = Value::from_type(<ToolbarStyle as StaticType>::static_type()); 718 gobject_sys::g_object_get_property( 719 self.to_glib_none().0 as *mut gobject_sys::GObject, 720 b"toolbar-style\0".as_ptr() as *const _, 721 value.to_glib_none_mut().0, 722 ); 723 value.get().unwrap() 724 } 725 } 726 set_property_toolbar_style(&self, toolbar_style: ToolbarStyle)727 fn set_property_toolbar_style(&self, toolbar_style: ToolbarStyle) { 728 unsafe { 729 gobject_sys::g_object_set_property( 730 self.to_glib_none().0 as *mut gobject_sys::GObject, 731 b"toolbar-style\0".as_ptr() as *const _, 732 Value::from(&toolbar_style).to_glib_none().0, 733 ); 734 } 735 } 736 connect_property_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId737 fn connect_property_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 738 unsafe extern "C" fn notify_icon_size_trampoline<P, F: Fn(&P) + 'static>( 739 this: *mut gtk_sys::GtkToolPalette, 740 _param_spec: glib_sys::gpointer, 741 f: glib_sys::gpointer, 742 ) where 743 P: IsA<ToolPalette>, 744 { 745 let f: &F = &*(f as *const F); 746 f(&ToolPalette::from_glib_borrow(this).unsafe_cast()) 747 } 748 unsafe { 749 let f: Box_<F> = Box_::new(f); 750 connect_raw( 751 self.as_ptr() as *mut _, 752 b"notify::icon-size\0".as_ptr() as *const _, 753 Some(transmute(notify_icon_size_trampoline::<Self, F> as usize)), 754 Box_::into_raw(f), 755 ) 756 } 757 } 758 connect_property_icon_size_set_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId759 fn connect_property_icon_size_set_notify<F: Fn(&Self) + 'static>( 760 &self, 761 f: F, 762 ) -> SignalHandlerId { 763 unsafe extern "C" fn notify_icon_size_set_trampoline<P, F: Fn(&P) + 'static>( 764 this: *mut gtk_sys::GtkToolPalette, 765 _param_spec: glib_sys::gpointer, 766 f: glib_sys::gpointer, 767 ) where 768 P: IsA<ToolPalette>, 769 { 770 let f: &F = &*(f as *const F); 771 f(&ToolPalette::from_glib_borrow(this).unsafe_cast()) 772 } 773 unsafe { 774 let f: Box_<F> = Box_::new(f); 775 connect_raw( 776 self.as_ptr() as *mut _, 777 b"notify::icon-size-set\0".as_ptr() as *const _, 778 Some(transmute( 779 notify_icon_size_set_trampoline::<Self, F> as usize, 780 )), 781 Box_::into_raw(f), 782 ) 783 } 784 } 785 connect_property_toolbar_style_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId786 fn connect_property_toolbar_style_notify<F: Fn(&Self) + 'static>( 787 &self, 788 f: F, 789 ) -> SignalHandlerId { 790 unsafe extern "C" fn notify_toolbar_style_trampoline<P, F: Fn(&P) + 'static>( 791 this: *mut gtk_sys::GtkToolPalette, 792 _param_spec: glib_sys::gpointer, 793 f: glib_sys::gpointer, 794 ) where 795 P: IsA<ToolPalette>, 796 { 797 let f: &F = &*(f as *const F); 798 f(&ToolPalette::from_glib_borrow(this).unsafe_cast()) 799 } 800 unsafe { 801 let f: Box_<F> = Box_::new(f); 802 connect_raw( 803 self.as_ptr() as *mut _, 804 b"notify::toolbar-style\0".as_ptr() as *const _, 805 Some(transmute( 806 notify_toolbar_style_trampoline::<Self, F> as usize, 807 )), 808 Box_::into_raw(f), 809 ) 810 } 811 } 812 } 813 814 impl fmt::Display for ToolPalette { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result815 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 816 write!(f, "ToolPalette") 817 } 818 } 819