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::Orientable; 9 use crate::Orientation; 10 use crate::ResizeMode; 11 use crate::ScrollType; 12 use crate::Widget; 13 use glib::object::Cast; 14 use glib::object::IsA; 15 use glib::object::ObjectExt; 16 use glib::signal::connect_raw; 17 use glib::signal::SignalHandlerId; 18 use glib::translate::*; 19 use glib::StaticType; 20 use glib::ToValue; 21 use std::boxed::Box as Box_; 22 use std::fmt; 23 use std::mem::transmute; 24 25 glib::wrapper! { 26 #[doc(alias = "GtkPaned")] 27 pub struct Paned(Object<ffi::GtkPaned, ffi::GtkPanedClass>) @extends Container, Widget, @implements Buildable, Orientable; 28 29 match fn { 30 type_ => || ffi::gtk_paned_get_type(), 31 } 32 } 33 34 impl Paned { 35 #[doc(alias = "gtk_paned_new")] new(orientation: Orientation) -> Paned36 pub fn new(orientation: Orientation) -> Paned { 37 assert_initialized_main_thread!(); 38 unsafe { Widget::from_glib_none(ffi::gtk_paned_new(orientation.into_glib())).unsafe_cast() } 39 } 40 41 // rustdoc-stripper-ignore-next 42 /// Creates a new builder-pattern struct instance to construct [`Paned`] objects. 43 /// 44 /// This method returns an instance of [`PanedBuilder`] which can be used to create [`Paned`] objects. builder() -> PanedBuilder45 pub fn builder() -> PanedBuilder { 46 PanedBuilder::default() 47 } 48 } 49 50 #[derive(Clone, Default)] 51 // rustdoc-stripper-ignore-next 52 /// A [builder-pattern] type to construct [`Paned`] objects. 53 /// 54 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 55 pub struct PanedBuilder { 56 position: Option<i32>, 57 position_set: Option<bool>, 58 wide_handle: Option<bool>, 59 border_width: Option<u32>, 60 child: Option<Widget>, 61 resize_mode: Option<ResizeMode>, 62 app_paintable: Option<bool>, 63 can_default: Option<bool>, 64 can_focus: Option<bool>, 65 events: Option<gdk::EventMask>, 66 expand: Option<bool>, 67 #[cfg(any(feature = "v3_20", feature = "dox"))] 68 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 69 focus_on_click: Option<bool>, 70 halign: Option<Align>, 71 has_default: Option<bool>, 72 has_focus: Option<bool>, 73 has_tooltip: Option<bool>, 74 height_request: Option<i32>, 75 hexpand: Option<bool>, 76 hexpand_set: Option<bool>, 77 is_focus: Option<bool>, 78 margin: Option<i32>, 79 margin_bottom: Option<i32>, 80 margin_end: Option<i32>, 81 margin_start: Option<i32>, 82 margin_top: Option<i32>, 83 name: Option<String>, 84 no_show_all: Option<bool>, 85 opacity: Option<f64>, 86 parent: Option<Container>, 87 receives_default: Option<bool>, 88 sensitive: Option<bool>, 89 tooltip_markup: Option<String>, 90 tooltip_text: Option<String>, 91 valign: Option<Align>, 92 vexpand: Option<bool>, 93 vexpand_set: Option<bool>, 94 visible: Option<bool>, 95 width_request: Option<i32>, 96 orientation: Option<Orientation>, 97 } 98 99 impl PanedBuilder { 100 // rustdoc-stripper-ignore-next 101 /// Create a new [`PanedBuilder`]. new() -> Self102 pub fn new() -> Self { 103 Self::default() 104 } 105 106 // rustdoc-stripper-ignore-next 107 /// Build the [`Paned`]. build(self) -> Paned108 pub fn build(self) -> Paned { 109 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 110 if let Some(ref position) = self.position { 111 properties.push(("position", position)); 112 } 113 if let Some(ref position_set) = self.position_set { 114 properties.push(("position-set", position_set)); 115 } 116 if let Some(ref wide_handle) = self.wide_handle { 117 properties.push(("wide-handle", wide_handle)); 118 } 119 if let Some(ref border_width) = self.border_width { 120 properties.push(("border-width", border_width)); 121 } 122 if let Some(ref child) = self.child { 123 properties.push(("child", child)); 124 } 125 if let Some(ref resize_mode) = self.resize_mode { 126 properties.push(("resize-mode", resize_mode)); 127 } 128 if let Some(ref app_paintable) = self.app_paintable { 129 properties.push(("app-paintable", app_paintable)); 130 } 131 if let Some(ref can_default) = self.can_default { 132 properties.push(("can-default", can_default)); 133 } 134 if let Some(ref can_focus) = self.can_focus { 135 properties.push(("can-focus", can_focus)); 136 } 137 if let Some(ref events) = self.events { 138 properties.push(("events", events)); 139 } 140 if let Some(ref expand) = self.expand { 141 properties.push(("expand", expand)); 142 } 143 #[cfg(any(feature = "v3_20", feature = "dox"))] 144 if let Some(ref focus_on_click) = self.focus_on_click { 145 properties.push(("focus-on-click", focus_on_click)); 146 } 147 if let Some(ref halign) = self.halign { 148 properties.push(("halign", halign)); 149 } 150 if let Some(ref has_default) = self.has_default { 151 properties.push(("has-default", has_default)); 152 } 153 if let Some(ref has_focus) = self.has_focus { 154 properties.push(("has-focus", has_focus)); 155 } 156 if let Some(ref has_tooltip) = self.has_tooltip { 157 properties.push(("has-tooltip", has_tooltip)); 158 } 159 if let Some(ref height_request) = self.height_request { 160 properties.push(("height-request", height_request)); 161 } 162 if let Some(ref hexpand) = self.hexpand { 163 properties.push(("hexpand", hexpand)); 164 } 165 if let Some(ref hexpand_set) = self.hexpand_set { 166 properties.push(("hexpand-set", hexpand_set)); 167 } 168 if let Some(ref is_focus) = self.is_focus { 169 properties.push(("is-focus", is_focus)); 170 } 171 if let Some(ref margin) = self.margin { 172 properties.push(("margin", margin)); 173 } 174 if let Some(ref margin_bottom) = self.margin_bottom { 175 properties.push(("margin-bottom", margin_bottom)); 176 } 177 if let Some(ref margin_end) = self.margin_end { 178 properties.push(("margin-end", margin_end)); 179 } 180 if let Some(ref margin_start) = self.margin_start { 181 properties.push(("margin-start", margin_start)); 182 } 183 if let Some(ref margin_top) = self.margin_top { 184 properties.push(("margin-top", margin_top)); 185 } 186 if let Some(ref name) = self.name { 187 properties.push(("name", name)); 188 } 189 if let Some(ref no_show_all) = self.no_show_all { 190 properties.push(("no-show-all", no_show_all)); 191 } 192 if let Some(ref opacity) = self.opacity { 193 properties.push(("opacity", opacity)); 194 } 195 if let Some(ref parent) = self.parent { 196 properties.push(("parent", parent)); 197 } 198 if let Some(ref receives_default) = self.receives_default { 199 properties.push(("receives-default", receives_default)); 200 } 201 if let Some(ref sensitive) = self.sensitive { 202 properties.push(("sensitive", sensitive)); 203 } 204 if let Some(ref tooltip_markup) = self.tooltip_markup { 205 properties.push(("tooltip-markup", tooltip_markup)); 206 } 207 if let Some(ref tooltip_text) = self.tooltip_text { 208 properties.push(("tooltip-text", tooltip_text)); 209 } 210 if let Some(ref valign) = self.valign { 211 properties.push(("valign", valign)); 212 } 213 if let Some(ref vexpand) = self.vexpand { 214 properties.push(("vexpand", vexpand)); 215 } 216 if let Some(ref vexpand_set) = self.vexpand_set { 217 properties.push(("vexpand-set", vexpand_set)); 218 } 219 if let Some(ref visible) = self.visible { 220 properties.push(("visible", visible)); 221 } 222 if let Some(ref width_request) = self.width_request { 223 properties.push(("width-request", width_request)); 224 } 225 if let Some(ref orientation) = self.orientation { 226 properties.push(("orientation", orientation)); 227 } 228 glib::Object::new::<Paned>(&properties).expect("Failed to create an instance of Paned") 229 } 230 position(mut self, position: i32) -> Self231 pub fn position(mut self, position: i32) -> Self { 232 self.position = Some(position); 233 self 234 } 235 position_set(mut self, position_set: bool) -> Self236 pub fn position_set(mut self, position_set: bool) -> Self { 237 self.position_set = Some(position_set); 238 self 239 } 240 wide_handle(mut self, wide_handle: bool) -> Self241 pub fn wide_handle(mut self, wide_handle: bool) -> Self { 242 self.wide_handle = Some(wide_handle); 243 self 244 } 245 border_width(mut self, border_width: u32) -> Self246 pub fn border_width(mut self, border_width: u32) -> Self { 247 self.border_width = Some(border_width); 248 self 249 } 250 child<P: IsA<Widget>>(mut self, child: &P) -> Self251 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 252 self.child = Some(child.clone().upcast()); 253 self 254 } 255 resize_mode(mut self, resize_mode: ResizeMode) -> Self256 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 257 self.resize_mode = Some(resize_mode); 258 self 259 } 260 app_paintable(mut self, app_paintable: bool) -> Self261 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 262 self.app_paintable = Some(app_paintable); 263 self 264 } 265 can_default(mut self, can_default: bool) -> Self266 pub fn can_default(mut self, can_default: bool) -> Self { 267 self.can_default = Some(can_default); 268 self 269 } 270 can_focus(mut self, can_focus: bool) -> Self271 pub fn can_focus(mut self, can_focus: bool) -> Self { 272 self.can_focus = Some(can_focus); 273 self 274 } 275 events(mut self, events: gdk::EventMask) -> Self276 pub fn events(mut self, events: gdk::EventMask) -> Self { 277 self.events = Some(events); 278 self 279 } 280 expand(mut self, expand: bool) -> Self281 pub fn expand(mut self, expand: bool) -> Self { 282 self.expand = Some(expand); 283 self 284 } 285 286 #[cfg(any(feature = "v3_20", feature = "dox"))] 287 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self288 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 289 self.focus_on_click = Some(focus_on_click); 290 self 291 } 292 halign(mut self, halign: Align) -> Self293 pub fn halign(mut self, halign: Align) -> Self { 294 self.halign = Some(halign); 295 self 296 } 297 has_default(mut self, has_default: bool) -> Self298 pub fn has_default(mut self, has_default: bool) -> Self { 299 self.has_default = Some(has_default); 300 self 301 } 302 has_focus(mut self, has_focus: bool) -> Self303 pub fn has_focus(mut self, has_focus: bool) -> Self { 304 self.has_focus = Some(has_focus); 305 self 306 } 307 has_tooltip(mut self, has_tooltip: bool) -> Self308 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 309 self.has_tooltip = Some(has_tooltip); 310 self 311 } 312 height_request(mut self, height_request: i32) -> Self313 pub fn height_request(mut self, height_request: i32) -> Self { 314 self.height_request = Some(height_request); 315 self 316 } 317 hexpand(mut self, hexpand: bool) -> Self318 pub fn hexpand(mut self, hexpand: bool) -> Self { 319 self.hexpand = Some(hexpand); 320 self 321 } 322 hexpand_set(mut self, hexpand_set: bool) -> Self323 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 324 self.hexpand_set = Some(hexpand_set); 325 self 326 } 327 is_focus(mut self, is_focus: bool) -> Self328 pub fn is_focus(mut self, is_focus: bool) -> Self { 329 self.is_focus = Some(is_focus); 330 self 331 } 332 margin(mut self, margin: i32) -> Self333 pub fn margin(mut self, margin: i32) -> Self { 334 self.margin = Some(margin); 335 self 336 } 337 margin_bottom(mut self, margin_bottom: i32) -> Self338 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 339 self.margin_bottom = Some(margin_bottom); 340 self 341 } 342 margin_end(mut self, margin_end: i32) -> Self343 pub fn margin_end(mut self, margin_end: i32) -> Self { 344 self.margin_end = Some(margin_end); 345 self 346 } 347 margin_start(mut self, margin_start: i32) -> Self348 pub fn margin_start(mut self, margin_start: i32) -> Self { 349 self.margin_start = Some(margin_start); 350 self 351 } 352 margin_top(mut self, margin_top: i32) -> Self353 pub fn margin_top(mut self, margin_top: i32) -> Self { 354 self.margin_top = Some(margin_top); 355 self 356 } 357 name(mut self, name: &str) -> Self358 pub fn name(mut self, name: &str) -> Self { 359 self.name = Some(name.to_string()); 360 self 361 } 362 no_show_all(mut self, no_show_all: bool) -> Self363 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 364 self.no_show_all = Some(no_show_all); 365 self 366 } 367 opacity(mut self, opacity: f64) -> Self368 pub fn opacity(mut self, opacity: f64) -> Self { 369 self.opacity = Some(opacity); 370 self 371 } 372 parent<P: IsA<Container>>(mut self, parent: &P) -> Self373 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 374 self.parent = Some(parent.clone().upcast()); 375 self 376 } 377 receives_default(mut self, receives_default: bool) -> Self378 pub fn receives_default(mut self, receives_default: bool) -> Self { 379 self.receives_default = Some(receives_default); 380 self 381 } 382 sensitive(mut self, sensitive: bool) -> Self383 pub fn sensitive(mut self, sensitive: bool) -> Self { 384 self.sensitive = Some(sensitive); 385 self 386 } 387 tooltip_markup(mut self, tooltip_markup: &str) -> Self388 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 389 self.tooltip_markup = Some(tooltip_markup.to_string()); 390 self 391 } 392 tooltip_text(mut self, tooltip_text: &str) -> Self393 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 394 self.tooltip_text = Some(tooltip_text.to_string()); 395 self 396 } 397 valign(mut self, valign: Align) -> Self398 pub fn valign(mut self, valign: Align) -> Self { 399 self.valign = Some(valign); 400 self 401 } 402 vexpand(mut self, vexpand: bool) -> Self403 pub fn vexpand(mut self, vexpand: bool) -> Self { 404 self.vexpand = Some(vexpand); 405 self 406 } 407 vexpand_set(mut self, vexpand_set: bool) -> Self408 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 409 self.vexpand_set = Some(vexpand_set); 410 self 411 } 412 visible(mut self, visible: bool) -> Self413 pub fn visible(mut self, visible: bool) -> Self { 414 self.visible = Some(visible); 415 self 416 } 417 width_request(mut self, width_request: i32) -> Self418 pub fn width_request(mut self, width_request: i32) -> Self { 419 self.width_request = Some(width_request); 420 self 421 } 422 orientation(mut self, orientation: Orientation) -> Self423 pub fn orientation(mut self, orientation: Orientation) -> Self { 424 self.orientation = Some(orientation); 425 self 426 } 427 } 428 429 pub const NONE_PANED: Option<&Paned> = None; 430 431 pub trait PanedExt: 'static { 432 #[doc(alias = "gtk_paned_add1")] add1<P: IsA<Widget>>(&self, child: &P)433 fn add1<P: IsA<Widget>>(&self, child: &P); 434 435 #[doc(alias = "gtk_paned_add2")] add2<P: IsA<Widget>>(&self, child: &P)436 fn add2<P: IsA<Widget>>(&self, child: &P); 437 438 #[doc(alias = "gtk_paned_get_child1")] 439 #[doc(alias = "get_child1")] child1(&self) -> Option<Widget>440 fn child1(&self) -> Option<Widget>; 441 442 #[doc(alias = "gtk_paned_get_child2")] 443 #[doc(alias = "get_child2")] child2(&self) -> Option<Widget>444 fn child2(&self) -> Option<Widget>; 445 446 #[doc(alias = "gtk_paned_get_handle_window")] 447 #[doc(alias = "get_handle_window")] handle_window(&self) -> Option<gdk::Window>448 fn handle_window(&self) -> Option<gdk::Window>; 449 450 #[doc(alias = "gtk_paned_get_position")] 451 #[doc(alias = "get_position")] position(&self) -> i32452 fn position(&self) -> i32; 453 454 #[doc(alias = "gtk_paned_get_wide_handle")] 455 #[doc(alias = "get_wide_handle")] is_wide_handle(&self) -> bool456 fn is_wide_handle(&self) -> bool; 457 458 #[doc(alias = "gtk_paned_pack1")] pack1<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool)459 fn pack1<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool); 460 461 #[doc(alias = "gtk_paned_pack2")] pack2<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool)462 fn pack2<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool); 463 464 #[doc(alias = "gtk_paned_set_position")] set_position(&self, position: i32)465 fn set_position(&self, position: i32); 466 467 #[doc(alias = "gtk_paned_set_wide_handle")] set_wide_handle(&self, wide: bool)468 fn set_wide_handle(&self, wide: bool); 469 470 #[doc(alias = "max-position")] max_position(&self) -> i32471 fn max_position(&self) -> i32; 472 473 #[doc(alias = "min-position")] min_position(&self) -> i32474 fn min_position(&self) -> i32; 475 476 #[doc(alias = "position-set")] is_position_set(&self) -> bool477 fn is_position_set(&self) -> bool; 478 479 #[doc(alias = "position-set")] set_position_set(&self, position_set: bool)480 fn set_position_set(&self, position_set: bool); 481 child_resizes<T: IsA<Widget>>(&self, item: &T) -> bool482 fn child_resizes<T: IsA<Widget>>(&self, item: &T) -> bool; 483 set_child_resize<T: IsA<Widget>>(&self, item: &T, resize: bool)484 fn set_child_resize<T: IsA<Widget>>(&self, item: &T, resize: bool); 485 child_shrinks<T: IsA<Widget>>(&self, item: &T) -> bool486 fn child_shrinks<T: IsA<Widget>>(&self, item: &T) -> bool; 487 set_child_shrink<T: IsA<Widget>>(&self, item: &T, shrink: bool)488 fn set_child_shrink<T: IsA<Widget>>(&self, item: &T, shrink: bool); 489 490 #[doc(alias = "accept-position")] connect_accept_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId491 fn connect_accept_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId; 492 emit_accept_position(&self) -> bool493 fn emit_accept_position(&self) -> bool; 494 495 #[doc(alias = "cancel-position")] connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId496 fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId; 497 emit_cancel_position(&self) -> bool498 fn emit_cancel_position(&self) -> bool; 499 500 #[doc(alias = "cycle-child-focus")] connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId501 fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>( 502 &self, 503 f: F, 504 ) -> SignalHandlerId; 505 emit_cycle_child_focus(&self, reversed: bool) -> bool506 fn emit_cycle_child_focus(&self, reversed: bool) -> bool; 507 508 #[doc(alias = "cycle-handle-focus")] connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId509 fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>( 510 &self, 511 f: F, 512 ) -> SignalHandlerId; 513 emit_cycle_handle_focus(&self, reversed: bool) -> bool514 fn emit_cycle_handle_focus(&self, reversed: bool) -> bool; 515 516 #[doc(alias = "move-handle")] connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId517 fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>( 518 &self, 519 f: F, 520 ) -> SignalHandlerId; 521 emit_move_handle(&self, scroll_type: ScrollType) -> bool522 fn emit_move_handle(&self, scroll_type: ScrollType) -> bool; 523 524 #[doc(alias = "toggle-handle-focus")] connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId525 fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId; 526 emit_toggle_handle_focus(&self) -> bool527 fn emit_toggle_handle_focus(&self) -> bool; 528 529 #[doc(alias = "max-position")] connect_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId530 fn connect_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 531 532 #[doc(alias = "min-position")] connect_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId533 fn connect_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 534 535 #[doc(alias = "position")] connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId536 fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 537 538 #[doc(alias = "position-set")] connect_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId539 fn connect_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 540 541 #[doc(alias = "wide-handle")] connect_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId542 fn connect_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 543 } 544 545 impl<O: IsA<Paned>> PanedExt for O { add1<P: IsA<Widget>>(&self, child: &P)546 fn add1<P: IsA<Widget>>(&self, child: &P) { 547 unsafe { 548 ffi::gtk_paned_add1( 549 self.as_ref().to_glib_none().0, 550 child.as_ref().to_glib_none().0, 551 ); 552 } 553 } 554 add2<P: IsA<Widget>>(&self, child: &P)555 fn add2<P: IsA<Widget>>(&self, child: &P) { 556 unsafe { 557 ffi::gtk_paned_add2( 558 self.as_ref().to_glib_none().0, 559 child.as_ref().to_glib_none().0, 560 ); 561 } 562 } 563 child1(&self) -> Option<Widget>564 fn child1(&self) -> Option<Widget> { 565 unsafe { from_glib_none(ffi::gtk_paned_get_child1(self.as_ref().to_glib_none().0)) } 566 } 567 child2(&self) -> Option<Widget>568 fn child2(&self) -> Option<Widget> { 569 unsafe { from_glib_none(ffi::gtk_paned_get_child2(self.as_ref().to_glib_none().0)) } 570 } 571 handle_window(&self) -> Option<gdk::Window>572 fn handle_window(&self) -> Option<gdk::Window> { 573 unsafe { 574 from_glib_none(ffi::gtk_paned_get_handle_window( 575 self.as_ref().to_glib_none().0, 576 )) 577 } 578 } 579 position(&self) -> i32580 fn position(&self) -> i32 { 581 unsafe { ffi::gtk_paned_get_position(self.as_ref().to_glib_none().0) } 582 } 583 is_wide_handle(&self) -> bool584 fn is_wide_handle(&self) -> bool { 585 unsafe { 586 from_glib(ffi::gtk_paned_get_wide_handle( 587 self.as_ref().to_glib_none().0, 588 )) 589 } 590 } 591 pack1<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool)592 fn pack1<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool) { 593 unsafe { 594 ffi::gtk_paned_pack1( 595 self.as_ref().to_glib_none().0, 596 child.as_ref().to_glib_none().0, 597 resize.into_glib(), 598 shrink.into_glib(), 599 ); 600 } 601 } 602 pack2<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool)603 fn pack2<P: IsA<Widget>>(&self, child: &P, resize: bool, shrink: bool) { 604 unsafe { 605 ffi::gtk_paned_pack2( 606 self.as_ref().to_glib_none().0, 607 child.as_ref().to_glib_none().0, 608 resize.into_glib(), 609 shrink.into_glib(), 610 ); 611 } 612 } 613 set_position(&self, position: i32)614 fn set_position(&self, position: i32) { 615 unsafe { 616 ffi::gtk_paned_set_position(self.as_ref().to_glib_none().0, position); 617 } 618 } 619 set_wide_handle(&self, wide: bool)620 fn set_wide_handle(&self, wide: bool) { 621 unsafe { 622 ffi::gtk_paned_set_wide_handle(self.as_ref().to_glib_none().0, wide.into_glib()); 623 } 624 } 625 max_position(&self) -> i32626 fn max_position(&self) -> i32 { 627 unsafe { 628 let mut value = glib::Value::from_type(<i32 as StaticType>::static_type()); 629 glib::gobject_ffi::g_object_get_property( 630 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 631 b"max-position\0".as_ptr() as *const _, 632 value.to_glib_none_mut().0, 633 ); 634 value 635 .get() 636 .expect("Return Value for property `max-position` getter") 637 } 638 } 639 min_position(&self) -> i32640 fn min_position(&self) -> i32 { 641 unsafe { 642 let mut value = glib::Value::from_type(<i32 as StaticType>::static_type()); 643 glib::gobject_ffi::g_object_get_property( 644 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 645 b"min-position\0".as_ptr() as *const _, 646 value.to_glib_none_mut().0, 647 ); 648 value 649 .get() 650 .expect("Return Value for property `min-position` getter") 651 } 652 } 653 is_position_set(&self) -> bool654 fn is_position_set(&self) -> bool { 655 unsafe { 656 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 657 glib::gobject_ffi::g_object_get_property( 658 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 659 b"position-set\0".as_ptr() as *const _, 660 value.to_glib_none_mut().0, 661 ); 662 value 663 .get() 664 .expect("Return Value for property `position-set` getter") 665 } 666 } 667 set_position_set(&self, position_set: bool)668 fn set_position_set(&self, position_set: bool) { 669 unsafe { 670 glib::gobject_ffi::g_object_set_property( 671 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 672 b"position-set\0".as_ptr() as *const _, 673 position_set.to_value().to_glib_none().0, 674 ); 675 } 676 } 677 child_resizes<T: IsA<Widget>>(&self, item: &T) -> bool678 fn child_resizes<T: IsA<Widget>>(&self, item: &T) -> bool { 679 unsafe { 680 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 681 crate::ffi::gtk_container_child_get_property( 682 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 683 item.to_glib_none().0 as *mut _, 684 b"resize\0".as_ptr() as *const _, 685 value.to_glib_none_mut().0, 686 ); 687 value 688 .get() 689 .expect("Return Value for property `resize` getter") 690 } 691 } 692 set_child_resize<T: IsA<Widget>>(&self, item: &T, resize: bool)693 fn set_child_resize<T: IsA<Widget>>(&self, item: &T, resize: bool) { 694 unsafe { 695 crate::ffi::gtk_container_child_set_property( 696 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 697 item.to_glib_none().0 as *mut _, 698 b"resize\0".as_ptr() as *const _, 699 resize.to_value().to_glib_none().0, 700 ); 701 } 702 } 703 child_shrinks<T: IsA<Widget>>(&self, item: &T) -> bool704 fn child_shrinks<T: IsA<Widget>>(&self, item: &T) -> bool { 705 unsafe { 706 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 707 crate::ffi::gtk_container_child_get_property( 708 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 709 item.to_glib_none().0 as *mut _, 710 b"shrink\0".as_ptr() as *const _, 711 value.to_glib_none_mut().0, 712 ); 713 value 714 .get() 715 .expect("Return Value for property `shrink` getter") 716 } 717 } 718 set_child_shrink<T: IsA<Widget>>(&self, item: &T, shrink: bool)719 fn set_child_shrink<T: IsA<Widget>>(&self, item: &T, shrink: bool) { 720 unsafe { 721 crate::ffi::gtk_container_child_set_property( 722 self.to_glib_none().0 as *mut crate::ffi::GtkContainer, 723 item.to_glib_none().0 as *mut _, 724 b"shrink\0".as_ptr() as *const _, 725 shrink.to_value().to_glib_none().0, 726 ); 727 } 728 } 729 connect_accept_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId730 fn connect_accept_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId { 731 unsafe extern "C" fn accept_position_trampoline< 732 P: IsA<Paned>, 733 F: Fn(&P) -> bool + 'static, 734 >( 735 this: *mut ffi::GtkPaned, 736 f: glib::ffi::gpointer, 737 ) -> glib::ffi::gboolean { 738 let f: &F = &*(f as *const F); 739 f(Paned::from_glib_borrow(this).unsafe_cast_ref()).into_glib() 740 } 741 unsafe { 742 let f: Box_<F> = Box_::new(f); 743 connect_raw( 744 self.as_ptr() as *mut _, 745 b"accept-position\0".as_ptr() as *const _, 746 Some(transmute::<_, unsafe extern "C" fn()>( 747 accept_position_trampoline::<Self, F> as *const (), 748 )), 749 Box_::into_raw(f), 750 ) 751 } 752 } 753 emit_accept_position(&self) -> bool754 fn emit_accept_position(&self) -> bool { 755 let res = unsafe { 756 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 757 .emit_by_name("accept-position", &[]) 758 .unwrap() 759 }; 760 res.unwrap() 761 .get() 762 .expect("Return Value for `emit_accept_position`") 763 } 764 connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId765 fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId { 766 unsafe extern "C" fn cancel_position_trampoline< 767 P: IsA<Paned>, 768 F: Fn(&P) -> bool + 'static, 769 >( 770 this: *mut ffi::GtkPaned, 771 f: glib::ffi::gpointer, 772 ) -> glib::ffi::gboolean { 773 let f: &F = &*(f as *const F); 774 f(Paned::from_glib_borrow(this).unsafe_cast_ref()).into_glib() 775 } 776 unsafe { 777 let f: Box_<F> = Box_::new(f); 778 connect_raw( 779 self.as_ptr() as *mut _, 780 b"cancel-position\0".as_ptr() as *const _, 781 Some(transmute::<_, unsafe extern "C" fn()>( 782 cancel_position_trampoline::<Self, F> as *const (), 783 )), 784 Box_::into_raw(f), 785 ) 786 } 787 } 788 emit_cancel_position(&self) -> bool789 fn emit_cancel_position(&self) -> bool { 790 let res = unsafe { 791 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 792 .emit_by_name("cancel-position", &[]) 793 .unwrap() 794 }; 795 res.unwrap() 796 .get() 797 .expect("Return Value for `emit_cancel_position`") 798 } 799 connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId800 fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>( 801 &self, 802 f: F, 803 ) -> SignalHandlerId { 804 unsafe extern "C" fn cycle_child_focus_trampoline< 805 P: IsA<Paned>, 806 F: Fn(&P, bool) -> bool + 'static, 807 >( 808 this: *mut ffi::GtkPaned, 809 reversed: glib::ffi::gboolean, 810 f: glib::ffi::gpointer, 811 ) -> glib::ffi::gboolean { 812 let f: &F = &*(f as *const F); 813 f( 814 Paned::from_glib_borrow(this).unsafe_cast_ref(), 815 from_glib(reversed), 816 ) 817 .into_glib() 818 } 819 unsafe { 820 let f: Box_<F> = Box_::new(f); 821 connect_raw( 822 self.as_ptr() as *mut _, 823 b"cycle-child-focus\0".as_ptr() as *const _, 824 Some(transmute::<_, unsafe extern "C" fn()>( 825 cycle_child_focus_trampoline::<Self, F> as *const (), 826 )), 827 Box_::into_raw(f), 828 ) 829 } 830 } 831 emit_cycle_child_focus(&self, reversed: bool) -> bool832 fn emit_cycle_child_focus(&self, reversed: bool) -> bool { 833 let res = unsafe { 834 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 835 .emit_by_name("cycle-child-focus", &[&reversed]) 836 .unwrap() 837 }; 838 res.unwrap() 839 .get() 840 .expect("Return Value for `emit_cycle_child_focus`") 841 } 842 connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId843 fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>( 844 &self, 845 f: F, 846 ) -> SignalHandlerId { 847 unsafe extern "C" fn cycle_handle_focus_trampoline< 848 P: IsA<Paned>, 849 F: Fn(&P, bool) -> bool + 'static, 850 >( 851 this: *mut ffi::GtkPaned, 852 reversed: glib::ffi::gboolean, 853 f: glib::ffi::gpointer, 854 ) -> glib::ffi::gboolean { 855 let f: &F = &*(f as *const F); 856 f( 857 Paned::from_glib_borrow(this).unsafe_cast_ref(), 858 from_glib(reversed), 859 ) 860 .into_glib() 861 } 862 unsafe { 863 let f: Box_<F> = Box_::new(f); 864 connect_raw( 865 self.as_ptr() as *mut _, 866 b"cycle-handle-focus\0".as_ptr() as *const _, 867 Some(transmute::<_, unsafe extern "C" fn()>( 868 cycle_handle_focus_trampoline::<Self, F> as *const (), 869 )), 870 Box_::into_raw(f), 871 ) 872 } 873 } 874 emit_cycle_handle_focus(&self, reversed: bool) -> bool875 fn emit_cycle_handle_focus(&self, reversed: bool) -> bool { 876 let res = unsafe { 877 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 878 .emit_by_name("cycle-handle-focus", &[&reversed]) 879 .unwrap() 880 }; 881 res.unwrap() 882 .get() 883 .expect("Return Value for `emit_cycle_handle_focus`") 884 } 885 connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId886 fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>( 887 &self, 888 f: F, 889 ) -> SignalHandlerId { 890 unsafe extern "C" fn move_handle_trampoline< 891 P: IsA<Paned>, 892 F: Fn(&P, ScrollType) -> bool + 'static, 893 >( 894 this: *mut ffi::GtkPaned, 895 scroll_type: ffi::GtkScrollType, 896 f: glib::ffi::gpointer, 897 ) -> glib::ffi::gboolean { 898 let f: &F = &*(f as *const F); 899 f( 900 Paned::from_glib_borrow(this).unsafe_cast_ref(), 901 from_glib(scroll_type), 902 ) 903 .into_glib() 904 } 905 unsafe { 906 let f: Box_<F> = Box_::new(f); 907 connect_raw( 908 self.as_ptr() as *mut _, 909 b"move-handle\0".as_ptr() as *const _, 910 Some(transmute::<_, unsafe extern "C" fn()>( 911 move_handle_trampoline::<Self, F> as *const (), 912 )), 913 Box_::into_raw(f), 914 ) 915 } 916 } 917 emit_move_handle(&self, scroll_type: ScrollType) -> bool918 fn emit_move_handle(&self, scroll_type: ScrollType) -> bool { 919 let res = unsafe { 920 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 921 .emit_by_name("move-handle", &[&scroll_type]) 922 .unwrap() 923 }; 924 res.unwrap() 925 .get() 926 .expect("Return Value for `emit_move_handle`") 927 } 928 connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId929 fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId { 930 unsafe extern "C" fn toggle_handle_focus_trampoline< 931 P: IsA<Paned>, 932 F: Fn(&P) -> bool + 'static, 933 >( 934 this: *mut ffi::GtkPaned, 935 f: glib::ffi::gpointer, 936 ) -> glib::ffi::gboolean { 937 let f: &F = &*(f as *const F); 938 f(Paned::from_glib_borrow(this).unsafe_cast_ref()).into_glib() 939 } 940 unsafe { 941 let f: Box_<F> = Box_::new(f); 942 connect_raw( 943 self.as_ptr() as *mut _, 944 b"toggle-handle-focus\0".as_ptr() as *const _, 945 Some(transmute::<_, unsafe extern "C" fn()>( 946 toggle_handle_focus_trampoline::<Self, F> as *const (), 947 )), 948 Box_::into_raw(f), 949 ) 950 } 951 } 952 emit_toggle_handle_focus(&self) -> bool953 fn emit_toggle_handle_focus(&self) -> bool { 954 let res = unsafe { 955 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 956 .emit_by_name("toggle-handle-focus", &[]) 957 .unwrap() 958 }; 959 res.unwrap() 960 .get() 961 .expect("Return Value for `emit_toggle_handle_focus`") 962 } 963 connect_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId964 fn connect_max_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 965 unsafe extern "C" fn notify_max_position_trampoline<P: IsA<Paned>, F: Fn(&P) + 'static>( 966 this: *mut ffi::GtkPaned, 967 _param_spec: glib::ffi::gpointer, 968 f: glib::ffi::gpointer, 969 ) { 970 let f: &F = &*(f as *const F); 971 f(Paned::from_glib_borrow(this).unsafe_cast_ref()) 972 } 973 unsafe { 974 let f: Box_<F> = Box_::new(f); 975 connect_raw( 976 self.as_ptr() as *mut _, 977 b"notify::max-position\0".as_ptr() as *const _, 978 Some(transmute::<_, unsafe extern "C" fn()>( 979 notify_max_position_trampoline::<Self, F> as *const (), 980 )), 981 Box_::into_raw(f), 982 ) 983 } 984 } 985 connect_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId986 fn connect_min_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 987 unsafe extern "C" fn notify_min_position_trampoline<P: IsA<Paned>, F: Fn(&P) + 'static>( 988 this: *mut ffi::GtkPaned, 989 _param_spec: glib::ffi::gpointer, 990 f: glib::ffi::gpointer, 991 ) { 992 let f: &F = &*(f as *const F); 993 f(Paned::from_glib_borrow(this).unsafe_cast_ref()) 994 } 995 unsafe { 996 let f: Box_<F> = Box_::new(f); 997 connect_raw( 998 self.as_ptr() as *mut _, 999 b"notify::min-position\0".as_ptr() as *const _, 1000 Some(transmute::<_, unsafe extern "C" fn()>( 1001 notify_min_position_trampoline::<Self, F> as *const (), 1002 )), 1003 Box_::into_raw(f), 1004 ) 1005 } 1006 } 1007 connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1008 fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1009 unsafe extern "C" fn notify_position_trampoline<P: IsA<Paned>, F: Fn(&P) + 'static>( 1010 this: *mut ffi::GtkPaned, 1011 _param_spec: glib::ffi::gpointer, 1012 f: glib::ffi::gpointer, 1013 ) { 1014 let f: &F = &*(f as *const F); 1015 f(Paned::from_glib_borrow(this).unsafe_cast_ref()) 1016 } 1017 unsafe { 1018 let f: Box_<F> = Box_::new(f); 1019 connect_raw( 1020 self.as_ptr() as *mut _, 1021 b"notify::position\0".as_ptr() as *const _, 1022 Some(transmute::<_, unsafe extern "C" fn()>( 1023 notify_position_trampoline::<Self, F> as *const (), 1024 )), 1025 Box_::into_raw(f), 1026 ) 1027 } 1028 } 1029 connect_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1030 fn connect_position_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1031 unsafe extern "C" fn notify_position_set_trampoline<P: IsA<Paned>, F: Fn(&P) + 'static>( 1032 this: *mut ffi::GtkPaned, 1033 _param_spec: glib::ffi::gpointer, 1034 f: glib::ffi::gpointer, 1035 ) { 1036 let f: &F = &*(f as *const F); 1037 f(Paned::from_glib_borrow(this).unsafe_cast_ref()) 1038 } 1039 unsafe { 1040 let f: Box_<F> = Box_::new(f); 1041 connect_raw( 1042 self.as_ptr() as *mut _, 1043 b"notify::position-set\0".as_ptr() as *const _, 1044 Some(transmute::<_, unsafe extern "C" fn()>( 1045 notify_position_set_trampoline::<Self, F> as *const (), 1046 )), 1047 Box_::into_raw(f), 1048 ) 1049 } 1050 } 1051 connect_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1052 fn connect_wide_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1053 unsafe extern "C" fn notify_wide_handle_trampoline<P: IsA<Paned>, F: Fn(&P) + 'static>( 1054 this: *mut ffi::GtkPaned, 1055 _param_spec: glib::ffi::gpointer, 1056 f: glib::ffi::gpointer, 1057 ) { 1058 let f: &F = &*(f as *const F); 1059 f(Paned::from_glib_borrow(this).unsafe_cast_ref()) 1060 } 1061 unsafe { 1062 let f: Box_<F> = Box_::new(f); 1063 connect_raw( 1064 self.as_ptr() as *mut _, 1065 b"notify::wide-handle\0".as_ptr() as *const _, 1066 Some(transmute::<_, unsafe extern "C" fn()>( 1067 notify_wide_handle_trampoline::<Self, F> as *const (), 1068 )), 1069 Box_::into_raw(f), 1070 ) 1071 } 1072 } 1073 } 1074 1075 impl fmt::Display for Paned { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1076 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1077 f.write_str("Paned") 1078 } 1079 } 1080