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 gtk_sys; 16 use std::boxed::Box as Box_; 17 use std::fmt; 18 use std::mem::transmute; 19 use Align; 20 use BaselinePosition; 21 use Buildable; 22 use Container; 23 use Orientable; 24 use Orientation; 25 use PositionType; 26 use ResizeMode; 27 use Widget; 28 29 glib_wrapper! { 30 pub struct Grid(Object<gtk_sys::GtkGrid, gtk_sys::GtkGridClass, GridClass>) @extends Container, Widget, @implements Buildable, Orientable; 31 32 match fn { 33 get_type => || gtk_sys::gtk_grid_get_type(), 34 } 35 } 36 37 impl Grid { new() -> Grid38 pub fn new() -> Grid { 39 assert_initialized_main_thread!(); 40 unsafe { Widget::from_glib_none(gtk_sys::gtk_grid_new()).unsafe_cast() } 41 } 42 } 43 44 impl Default for Grid { default() -> Self45 fn default() -> Self { 46 Self::new() 47 } 48 } 49 50 #[derive(Clone, Default)] 51 pub struct GridBuilder { 52 baseline_row: Option<i32>, 53 column_homogeneous: Option<bool>, 54 column_spacing: Option<i32>, 55 row_homogeneous: Option<bool>, 56 row_spacing: Option<i32>, 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 orientation: Option<Orientation>, 94 } 95 96 impl GridBuilder { new() -> Self97 pub fn new() -> Self { 98 Self::default() 99 } 100 build(self) -> Grid101 pub fn build(self) -> Grid { 102 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 103 if let Some(ref baseline_row) = self.baseline_row { 104 properties.push(("baseline-row", baseline_row)); 105 } 106 if let Some(ref column_homogeneous) = self.column_homogeneous { 107 properties.push(("column-homogeneous", column_homogeneous)); 108 } 109 if let Some(ref column_spacing) = self.column_spacing { 110 properties.push(("column-spacing", column_spacing)); 111 } 112 if let Some(ref row_homogeneous) = self.row_homogeneous { 113 properties.push(("row-homogeneous", row_homogeneous)); 114 } 115 if let Some(ref row_spacing) = self.row_spacing { 116 properties.push(("row-spacing", row_spacing)); 117 } 118 if let Some(ref border_width) = self.border_width { 119 properties.push(("border-width", border_width)); 120 } 121 if let Some(ref child) = self.child { 122 properties.push(("child", child)); 123 } 124 if let Some(ref resize_mode) = self.resize_mode { 125 properties.push(("resize-mode", resize_mode)); 126 } 127 if let Some(ref app_paintable) = self.app_paintable { 128 properties.push(("app-paintable", app_paintable)); 129 } 130 if let Some(ref can_default) = self.can_default { 131 properties.push(("can-default", can_default)); 132 } 133 if let Some(ref can_focus) = self.can_focus { 134 properties.push(("can-focus", can_focus)); 135 } 136 if let Some(ref events) = self.events { 137 properties.push(("events", events)); 138 } 139 if let Some(ref expand) = self.expand { 140 properties.push(("expand", expand)); 141 } 142 #[cfg(any(feature = "v3_20", feature = "dox"))] 143 { 144 if let Some(ref focus_on_click) = self.focus_on_click { 145 properties.push(("focus-on-click", focus_on_click)); 146 } 147 } 148 if let Some(ref halign) = self.halign { 149 properties.push(("halign", halign)); 150 } 151 if let Some(ref has_default) = self.has_default { 152 properties.push(("has-default", has_default)); 153 } 154 if let Some(ref has_focus) = self.has_focus { 155 properties.push(("has-focus", has_focus)); 156 } 157 if let Some(ref has_tooltip) = self.has_tooltip { 158 properties.push(("has-tooltip", has_tooltip)); 159 } 160 if let Some(ref height_request) = self.height_request { 161 properties.push(("height-request", height_request)); 162 } 163 if let Some(ref hexpand) = self.hexpand { 164 properties.push(("hexpand", hexpand)); 165 } 166 if let Some(ref hexpand_set) = self.hexpand_set { 167 properties.push(("hexpand-set", hexpand_set)); 168 } 169 if let Some(ref is_focus) = self.is_focus { 170 properties.push(("is-focus", is_focus)); 171 } 172 if let Some(ref margin) = self.margin { 173 properties.push(("margin", margin)); 174 } 175 if let Some(ref margin_bottom) = self.margin_bottom { 176 properties.push(("margin-bottom", margin_bottom)); 177 } 178 if let Some(ref margin_end) = self.margin_end { 179 properties.push(("margin-end", margin_end)); 180 } 181 if let Some(ref margin_start) = self.margin_start { 182 properties.push(("margin-start", margin_start)); 183 } 184 if let Some(ref margin_top) = self.margin_top { 185 properties.push(("margin-top", margin_top)); 186 } 187 if let Some(ref name) = self.name { 188 properties.push(("name", name)); 189 } 190 if let Some(ref no_show_all) = self.no_show_all { 191 properties.push(("no-show-all", no_show_all)); 192 } 193 if let Some(ref opacity) = self.opacity { 194 properties.push(("opacity", opacity)); 195 } 196 if let Some(ref parent) = self.parent { 197 properties.push(("parent", parent)); 198 } 199 if let Some(ref receives_default) = self.receives_default { 200 properties.push(("receives-default", receives_default)); 201 } 202 if let Some(ref sensitive) = self.sensitive { 203 properties.push(("sensitive", sensitive)); 204 } 205 if let Some(ref tooltip_markup) = self.tooltip_markup { 206 properties.push(("tooltip-markup", tooltip_markup)); 207 } 208 if let Some(ref tooltip_text) = self.tooltip_text { 209 properties.push(("tooltip-text", tooltip_text)); 210 } 211 if let Some(ref valign) = self.valign { 212 properties.push(("valign", valign)); 213 } 214 if let Some(ref vexpand) = self.vexpand { 215 properties.push(("vexpand", vexpand)); 216 } 217 if let Some(ref vexpand_set) = self.vexpand_set { 218 properties.push(("vexpand-set", vexpand_set)); 219 } 220 if let Some(ref visible) = self.visible { 221 properties.push(("visible", visible)); 222 } 223 if let Some(ref width_request) = self.width_request { 224 properties.push(("width-request", width_request)); 225 } 226 if let Some(ref orientation) = self.orientation { 227 properties.push(("orientation", orientation)); 228 } 229 glib::Object::new(Grid::static_type(), &properties) 230 .expect("object new") 231 .downcast() 232 .expect("downcast") 233 } 234 baseline_row(mut self, baseline_row: i32) -> Self235 pub fn baseline_row(mut self, baseline_row: i32) -> Self { 236 self.baseline_row = Some(baseline_row); 237 self 238 } 239 column_homogeneous(mut self, column_homogeneous: bool) -> Self240 pub fn column_homogeneous(mut self, column_homogeneous: bool) -> Self { 241 self.column_homogeneous = Some(column_homogeneous); 242 self 243 } 244 column_spacing(mut self, column_spacing: i32) -> Self245 pub fn column_spacing(mut self, column_spacing: i32) -> Self { 246 self.column_spacing = Some(column_spacing); 247 self 248 } 249 row_homogeneous(mut self, row_homogeneous: bool) -> Self250 pub fn row_homogeneous(mut self, row_homogeneous: bool) -> Self { 251 self.row_homogeneous = Some(row_homogeneous); 252 self 253 } 254 row_spacing(mut self, row_spacing: i32) -> Self255 pub fn row_spacing(mut self, row_spacing: i32) -> Self { 256 self.row_spacing = Some(row_spacing); 257 self 258 } 259 border_width(mut self, border_width: u32) -> Self260 pub fn border_width(mut self, border_width: u32) -> Self { 261 self.border_width = Some(border_width); 262 self 263 } 264 child<P: IsA<Widget>>(mut self, child: &P) -> Self265 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 266 self.child = Some(child.clone().upcast()); 267 self 268 } 269 resize_mode(mut self, resize_mode: ResizeMode) -> Self270 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 271 self.resize_mode = Some(resize_mode); 272 self 273 } 274 app_paintable(mut self, app_paintable: bool) -> Self275 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 276 self.app_paintable = Some(app_paintable); 277 self 278 } 279 can_default(mut self, can_default: bool) -> Self280 pub fn can_default(mut self, can_default: bool) -> Self { 281 self.can_default = Some(can_default); 282 self 283 } 284 can_focus(mut self, can_focus: bool) -> Self285 pub fn can_focus(mut self, can_focus: bool) -> Self { 286 self.can_focus = Some(can_focus); 287 self 288 } 289 events(mut self, events: gdk::EventMask) -> Self290 pub fn events(mut self, events: gdk::EventMask) -> Self { 291 self.events = Some(events); 292 self 293 } 294 expand(mut self, expand: bool) -> Self295 pub fn expand(mut self, expand: bool) -> Self { 296 self.expand = Some(expand); 297 self 298 } 299 300 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self301 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 302 self.focus_on_click = Some(focus_on_click); 303 self 304 } 305 halign(mut self, halign: Align) -> Self306 pub fn halign(mut self, halign: Align) -> Self { 307 self.halign = Some(halign); 308 self 309 } 310 has_default(mut self, has_default: bool) -> Self311 pub fn has_default(mut self, has_default: bool) -> Self { 312 self.has_default = Some(has_default); 313 self 314 } 315 has_focus(mut self, has_focus: bool) -> Self316 pub fn has_focus(mut self, has_focus: bool) -> Self { 317 self.has_focus = Some(has_focus); 318 self 319 } 320 has_tooltip(mut self, has_tooltip: bool) -> Self321 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 322 self.has_tooltip = Some(has_tooltip); 323 self 324 } 325 height_request(mut self, height_request: i32) -> Self326 pub fn height_request(mut self, height_request: i32) -> Self { 327 self.height_request = Some(height_request); 328 self 329 } 330 hexpand(mut self, hexpand: bool) -> Self331 pub fn hexpand(mut self, hexpand: bool) -> Self { 332 self.hexpand = Some(hexpand); 333 self 334 } 335 hexpand_set(mut self, hexpand_set: bool) -> Self336 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 337 self.hexpand_set = Some(hexpand_set); 338 self 339 } 340 is_focus(mut self, is_focus: bool) -> Self341 pub fn is_focus(mut self, is_focus: bool) -> Self { 342 self.is_focus = Some(is_focus); 343 self 344 } 345 margin(mut self, margin: i32) -> Self346 pub fn margin(mut self, margin: i32) -> Self { 347 self.margin = Some(margin); 348 self 349 } 350 margin_bottom(mut self, margin_bottom: i32) -> Self351 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 352 self.margin_bottom = Some(margin_bottom); 353 self 354 } 355 margin_end(mut self, margin_end: i32) -> Self356 pub fn margin_end(mut self, margin_end: i32) -> Self { 357 self.margin_end = Some(margin_end); 358 self 359 } 360 margin_start(mut self, margin_start: i32) -> Self361 pub fn margin_start(mut self, margin_start: i32) -> Self { 362 self.margin_start = Some(margin_start); 363 self 364 } 365 margin_top(mut self, margin_top: i32) -> Self366 pub fn margin_top(mut self, margin_top: i32) -> Self { 367 self.margin_top = Some(margin_top); 368 self 369 } 370 name(mut self, name: &str) -> Self371 pub fn name(mut self, name: &str) -> Self { 372 self.name = Some(name.to_string()); 373 self 374 } 375 no_show_all(mut self, no_show_all: bool) -> Self376 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 377 self.no_show_all = Some(no_show_all); 378 self 379 } 380 opacity(mut self, opacity: f64) -> Self381 pub fn opacity(mut self, opacity: f64) -> Self { 382 self.opacity = Some(opacity); 383 self 384 } 385 parent<P: IsA<Container>>(mut self, parent: &P) -> Self386 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 387 self.parent = Some(parent.clone().upcast()); 388 self 389 } 390 receives_default(mut self, receives_default: bool) -> Self391 pub fn receives_default(mut self, receives_default: bool) -> Self { 392 self.receives_default = Some(receives_default); 393 self 394 } 395 sensitive(mut self, sensitive: bool) -> Self396 pub fn sensitive(mut self, sensitive: bool) -> Self { 397 self.sensitive = Some(sensitive); 398 self 399 } 400 tooltip_markup(mut self, tooltip_markup: &str) -> Self401 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 402 self.tooltip_markup = Some(tooltip_markup.to_string()); 403 self 404 } 405 tooltip_text(mut self, tooltip_text: &str) -> Self406 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 407 self.tooltip_text = Some(tooltip_text.to_string()); 408 self 409 } 410 valign(mut self, valign: Align) -> Self411 pub fn valign(mut self, valign: Align) -> Self { 412 self.valign = Some(valign); 413 self 414 } 415 vexpand(mut self, vexpand: bool) -> Self416 pub fn vexpand(mut self, vexpand: bool) -> Self { 417 self.vexpand = Some(vexpand); 418 self 419 } 420 vexpand_set(mut self, vexpand_set: bool) -> Self421 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 422 self.vexpand_set = Some(vexpand_set); 423 self 424 } 425 visible(mut self, visible: bool) -> Self426 pub fn visible(mut self, visible: bool) -> Self { 427 self.visible = Some(visible); 428 self 429 } 430 width_request(mut self, width_request: i32) -> Self431 pub fn width_request(mut self, width_request: i32) -> Self { 432 self.width_request = Some(width_request); 433 self 434 } 435 orientation(mut self, orientation: Orientation) -> Self436 pub fn orientation(mut self, orientation: Orientation) -> Self { 437 self.orientation = Some(orientation); 438 self 439 } 440 } 441 442 pub const NONE_GRID: Option<&Grid> = None; 443 444 pub trait GridExt: 'static { attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32)445 fn attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32); 446 attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>( &self, child: &P, sibling: Option<&Q>, side: PositionType, width: i32, height: i32, )447 fn attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>( 448 &self, 449 child: &P, 450 sibling: Option<&Q>, 451 side: PositionType, 452 width: i32, 453 height: i32, 454 ); 455 get_baseline_row(&self) -> i32456 fn get_baseline_row(&self) -> i32; 457 get_child_at(&self, left: i32, top: i32) -> Option<Widget>458 fn get_child_at(&self, left: i32, top: i32) -> Option<Widget>; 459 get_column_homogeneous(&self) -> bool460 fn get_column_homogeneous(&self) -> bool; 461 get_column_spacing(&self) -> u32462 fn get_column_spacing(&self) -> u32; 463 get_row_baseline_position(&self, row: i32) -> BaselinePosition464 fn get_row_baseline_position(&self, row: i32) -> BaselinePosition; 465 get_row_homogeneous(&self) -> bool466 fn get_row_homogeneous(&self) -> bool; 467 get_row_spacing(&self) -> u32468 fn get_row_spacing(&self) -> u32; 469 insert_column(&self, position: i32)470 fn insert_column(&self, position: i32); 471 insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType)472 fn insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType); 473 insert_row(&self, position: i32)474 fn insert_row(&self, position: i32); 475 remove_column(&self, position: i32)476 fn remove_column(&self, position: i32); 477 remove_row(&self, position: i32)478 fn remove_row(&self, position: i32); 479 set_baseline_row(&self, row: i32)480 fn set_baseline_row(&self, row: i32); 481 set_column_homogeneous(&self, homogeneous: bool)482 fn set_column_homogeneous(&self, homogeneous: bool); 483 set_column_spacing(&self, spacing: u32)484 fn set_column_spacing(&self, spacing: u32); 485 set_row_baseline_position(&self, row: i32, pos: BaselinePosition)486 fn set_row_baseline_position(&self, row: i32, pos: BaselinePosition); 487 set_row_homogeneous(&self, homogeneous: bool)488 fn set_row_homogeneous(&self, homogeneous: bool); 489 set_row_spacing(&self, spacing: u32)490 fn set_row_spacing(&self, spacing: u32); 491 get_cell_height<T: IsA<Widget>>(&self, item: &T) -> i32492 fn get_cell_height<T: IsA<Widget>>(&self, item: &T) -> i32; 493 set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32)494 fn set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32); 495 get_cell_width<T: IsA<Widget>>(&self, item: &T) -> i32496 fn get_cell_width<T: IsA<Widget>>(&self, item: &T) -> i32; 497 set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32)498 fn set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32); 499 get_cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32500 fn get_cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32; 501 set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32)502 fn set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32); 503 get_cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32504 fn get_cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32; 505 set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32)506 fn set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32); 507 connect_property_baseline_row_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId508 fn connect_property_baseline_row_notify<F: Fn(&Self) + 'static>(&self, f: F) 509 -> SignalHandlerId; 510 connect_property_column_homogeneous_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId511 fn connect_property_column_homogeneous_notify<F: Fn(&Self) + 'static>( 512 &self, 513 f: F, 514 ) -> SignalHandlerId; 515 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId516 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 517 &self, 518 f: F, 519 ) -> SignalHandlerId; 520 connect_property_row_homogeneous_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId521 fn connect_property_row_homogeneous_notify<F: Fn(&Self) + 'static>( 522 &self, 523 f: F, 524 ) -> SignalHandlerId; 525 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId526 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 527 } 528 529 impl<O: IsA<Grid>> GridExt for O { attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32)530 fn attach<P: IsA<Widget>>(&self, child: &P, left: i32, top: i32, width: i32, height: i32) { 531 unsafe { 532 gtk_sys::gtk_grid_attach( 533 self.as_ref().to_glib_none().0, 534 child.as_ref().to_glib_none().0, 535 left, 536 top, 537 width, 538 height, 539 ); 540 } 541 } 542 attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>( &self, child: &P, sibling: Option<&Q>, side: PositionType, width: i32, height: i32, )543 fn attach_next_to<P: IsA<Widget>, Q: IsA<Widget>>( 544 &self, 545 child: &P, 546 sibling: Option<&Q>, 547 side: PositionType, 548 width: i32, 549 height: i32, 550 ) { 551 unsafe { 552 gtk_sys::gtk_grid_attach_next_to( 553 self.as_ref().to_glib_none().0, 554 child.as_ref().to_glib_none().0, 555 sibling.map(|p| p.as_ref()).to_glib_none().0, 556 side.to_glib(), 557 width, 558 height, 559 ); 560 } 561 } 562 get_baseline_row(&self) -> i32563 fn get_baseline_row(&self) -> i32 { 564 unsafe { gtk_sys::gtk_grid_get_baseline_row(self.as_ref().to_glib_none().0) } 565 } 566 get_child_at(&self, left: i32, top: i32) -> Option<Widget>567 fn get_child_at(&self, left: i32, top: i32) -> Option<Widget> { 568 unsafe { 569 from_glib_none(gtk_sys::gtk_grid_get_child_at( 570 self.as_ref().to_glib_none().0, 571 left, 572 top, 573 )) 574 } 575 } 576 get_column_homogeneous(&self) -> bool577 fn get_column_homogeneous(&self) -> bool { 578 unsafe { 579 from_glib(gtk_sys::gtk_grid_get_column_homogeneous( 580 self.as_ref().to_glib_none().0, 581 )) 582 } 583 } 584 get_column_spacing(&self) -> u32585 fn get_column_spacing(&self) -> u32 { 586 unsafe { gtk_sys::gtk_grid_get_column_spacing(self.as_ref().to_glib_none().0) } 587 } 588 get_row_baseline_position(&self, row: i32) -> BaselinePosition589 fn get_row_baseline_position(&self, row: i32) -> BaselinePosition { 590 unsafe { 591 from_glib(gtk_sys::gtk_grid_get_row_baseline_position( 592 self.as_ref().to_glib_none().0, 593 row, 594 )) 595 } 596 } 597 get_row_homogeneous(&self) -> bool598 fn get_row_homogeneous(&self) -> bool { 599 unsafe { 600 from_glib(gtk_sys::gtk_grid_get_row_homogeneous( 601 self.as_ref().to_glib_none().0, 602 )) 603 } 604 } 605 get_row_spacing(&self) -> u32606 fn get_row_spacing(&self) -> u32 { 607 unsafe { gtk_sys::gtk_grid_get_row_spacing(self.as_ref().to_glib_none().0) } 608 } 609 insert_column(&self, position: i32)610 fn insert_column(&self, position: i32) { 611 unsafe { 612 gtk_sys::gtk_grid_insert_column(self.as_ref().to_glib_none().0, position); 613 } 614 } 615 insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType)616 fn insert_next_to<P: IsA<Widget>>(&self, sibling: &P, side: PositionType) { 617 unsafe { 618 gtk_sys::gtk_grid_insert_next_to( 619 self.as_ref().to_glib_none().0, 620 sibling.as_ref().to_glib_none().0, 621 side.to_glib(), 622 ); 623 } 624 } 625 insert_row(&self, position: i32)626 fn insert_row(&self, position: i32) { 627 unsafe { 628 gtk_sys::gtk_grid_insert_row(self.as_ref().to_glib_none().0, position); 629 } 630 } 631 remove_column(&self, position: i32)632 fn remove_column(&self, position: i32) { 633 unsafe { 634 gtk_sys::gtk_grid_remove_column(self.as_ref().to_glib_none().0, position); 635 } 636 } 637 remove_row(&self, position: i32)638 fn remove_row(&self, position: i32) { 639 unsafe { 640 gtk_sys::gtk_grid_remove_row(self.as_ref().to_glib_none().0, position); 641 } 642 } 643 set_baseline_row(&self, row: i32)644 fn set_baseline_row(&self, row: i32) { 645 unsafe { 646 gtk_sys::gtk_grid_set_baseline_row(self.as_ref().to_glib_none().0, row); 647 } 648 } 649 set_column_homogeneous(&self, homogeneous: bool)650 fn set_column_homogeneous(&self, homogeneous: bool) { 651 unsafe { 652 gtk_sys::gtk_grid_set_column_homogeneous( 653 self.as_ref().to_glib_none().0, 654 homogeneous.to_glib(), 655 ); 656 } 657 } 658 set_column_spacing(&self, spacing: u32)659 fn set_column_spacing(&self, spacing: u32) { 660 unsafe { 661 gtk_sys::gtk_grid_set_column_spacing(self.as_ref().to_glib_none().0, spacing); 662 } 663 } 664 set_row_baseline_position(&self, row: i32, pos: BaselinePosition)665 fn set_row_baseline_position(&self, row: i32, pos: BaselinePosition) { 666 unsafe { 667 gtk_sys::gtk_grid_set_row_baseline_position( 668 self.as_ref().to_glib_none().0, 669 row, 670 pos.to_glib(), 671 ); 672 } 673 } 674 set_row_homogeneous(&self, homogeneous: bool)675 fn set_row_homogeneous(&self, homogeneous: bool) { 676 unsafe { 677 gtk_sys::gtk_grid_set_row_homogeneous( 678 self.as_ref().to_glib_none().0, 679 homogeneous.to_glib(), 680 ); 681 } 682 } 683 set_row_spacing(&self, spacing: u32)684 fn set_row_spacing(&self, spacing: u32) { 685 unsafe { 686 gtk_sys::gtk_grid_set_row_spacing(self.as_ref().to_glib_none().0, spacing); 687 } 688 } 689 get_cell_height<T: IsA<Widget>>(&self, item: &T) -> i32690 fn get_cell_height<T: IsA<Widget>>(&self, item: &T) -> i32 { 691 unsafe { 692 let mut value = Value::from_type(<i32 as StaticType>::static_type()); 693 gtk_sys::gtk_container_child_get_property( 694 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 695 item.to_glib_none().0 as *mut _, 696 b"height\0".as_ptr() as *const _, 697 value.to_glib_none_mut().0, 698 ); 699 value 700 .get() 701 .expect("Return Value for property `height` getter") 702 .unwrap() 703 } 704 } 705 set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32)706 fn set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32) { 707 unsafe { 708 gtk_sys::gtk_container_child_set_property( 709 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 710 item.to_glib_none().0 as *mut _, 711 b"height\0".as_ptr() as *const _, 712 Value::from(&height).to_glib_none().0, 713 ); 714 } 715 } 716 get_cell_width<T: IsA<Widget>>(&self, item: &T) -> i32717 fn get_cell_width<T: IsA<Widget>>(&self, item: &T) -> i32 { 718 unsafe { 719 let mut value = Value::from_type(<i32 as StaticType>::static_type()); 720 gtk_sys::gtk_container_child_get_property( 721 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 722 item.to_glib_none().0 as *mut _, 723 b"width\0".as_ptr() as *const _, 724 value.to_glib_none_mut().0, 725 ); 726 value 727 .get() 728 .expect("Return Value for property `width` getter") 729 .unwrap() 730 } 731 } 732 set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32)733 fn set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32) { 734 unsafe { 735 gtk_sys::gtk_container_child_set_property( 736 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 737 item.to_glib_none().0 as *mut _, 738 b"width\0".as_ptr() as *const _, 739 Value::from(&width).to_glib_none().0, 740 ); 741 } 742 } 743 get_cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32744 fn get_cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32 { 745 unsafe { 746 let mut value = Value::from_type(<i32 as StaticType>::static_type()); 747 gtk_sys::gtk_container_child_get_property( 748 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 749 item.to_glib_none().0 as *mut _, 750 b"left-attach\0".as_ptr() as *const _, 751 value.to_glib_none_mut().0, 752 ); 753 value 754 .get() 755 .expect("Return Value for property `left-attach` getter") 756 .unwrap() 757 } 758 } 759 set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32)760 fn set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32) { 761 unsafe { 762 gtk_sys::gtk_container_child_set_property( 763 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 764 item.to_glib_none().0 as *mut _, 765 b"left-attach\0".as_ptr() as *const _, 766 Value::from(&left_attach).to_glib_none().0, 767 ); 768 } 769 } 770 get_cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32771 fn get_cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32 { 772 unsafe { 773 let mut value = Value::from_type(<i32 as StaticType>::static_type()); 774 gtk_sys::gtk_container_child_get_property( 775 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 776 item.to_glib_none().0 as *mut _, 777 b"top-attach\0".as_ptr() as *const _, 778 value.to_glib_none_mut().0, 779 ); 780 value 781 .get() 782 .expect("Return Value for property `top-attach` getter") 783 .unwrap() 784 } 785 } 786 set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32)787 fn set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32) { 788 unsafe { 789 gtk_sys::gtk_container_child_set_property( 790 self.to_glib_none().0 as *mut gtk_sys::GtkContainer, 791 item.to_glib_none().0 as *mut _, 792 b"top-attach\0".as_ptr() as *const _, 793 Value::from(&top_attach).to_glib_none().0, 794 ); 795 } 796 } 797 connect_property_baseline_row_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId798 fn connect_property_baseline_row_notify<F: Fn(&Self) + 'static>( 799 &self, 800 f: F, 801 ) -> SignalHandlerId { 802 unsafe extern "C" fn notify_baseline_row_trampoline<P, F: Fn(&P) + 'static>( 803 this: *mut gtk_sys::GtkGrid, 804 _param_spec: glib_sys::gpointer, 805 f: glib_sys::gpointer, 806 ) where 807 P: IsA<Grid>, 808 { 809 let f: &F = &*(f as *const F); 810 f(&Grid::from_glib_borrow(this).unsafe_cast()) 811 } 812 unsafe { 813 let f: Box_<F> = Box_::new(f); 814 connect_raw( 815 self.as_ptr() as *mut _, 816 b"notify::baseline-row\0".as_ptr() as *const _, 817 Some(transmute( 818 notify_baseline_row_trampoline::<Self, F> as usize, 819 )), 820 Box_::into_raw(f), 821 ) 822 } 823 } 824 connect_property_column_homogeneous_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId825 fn connect_property_column_homogeneous_notify<F: Fn(&Self) + 'static>( 826 &self, 827 f: F, 828 ) -> SignalHandlerId { 829 unsafe extern "C" fn notify_column_homogeneous_trampoline<P, F: Fn(&P) + 'static>( 830 this: *mut gtk_sys::GtkGrid, 831 _param_spec: glib_sys::gpointer, 832 f: glib_sys::gpointer, 833 ) where 834 P: IsA<Grid>, 835 { 836 let f: &F = &*(f as *const F); 837 f(&Grid::from_glib_borrow(this).unsafe_cast()) 838 } 839 unsafe { 840 let f: Box_<F> = Box_::new(f); 841 connect_raw( 842 self.as_ptr() as *mut _, 843 b"notify::column-homogeneous\0".as_ptr() as *const _, 844 Some(transmute( 845 notify_column_homogeneous_trampoline::<Self, F> as usize, 846 )), 847 Box_::into_raw(f), 848 ) 849 } 850 } 851 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId852 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 853 &self, 854 f: F, 855 ) -> SignalHandlerId { 856 unsafe extern "C" fn notify_column_spacing_trampoline<P, F: Fn(&P) + 'static>( 857 this: *mut gtk_sys::GtkGrid, 858 _param_spec: glib_sys::gpointer, 859 f: glib_sys::gpointer, 860 ) where 861 P: IsA<Grid>, 862 { 863 let f: &F = &*(f as *const F); 864 f(&Grid::from_glib_borrow(this).unsafe_cast()) 865 } 866 unsafe { 867 let f: Box_<F> = Box_::new(f); 868 connect_raw( 869 self.as_ptr() as *mut _, 870 b"notify::column-spacing\0".as_ptr() as *const _, 871 Some(transmute( 872 notify_column_spacing_trampoline::<Self, F> as usize, 873 )), 874 Box_::into_raw(f), 875 ) 876 } 877 } 878 connect_property_row_homogeneous_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId879 fn connect_property_row_homogeneous_notify<F: Fn(&Self) + 'static>( 880 &self, 881 f: F, 882 ) -> SignalHandlerId { 883 unsafe extern "C" fn notify_row_homogeneous_trampoline<P, F: Fn(&P) + 'static>( 884 this: *mut gtk_sys::GtkGrid, 885 _param_spec: glib_sys::gpointer, 886 f: glib_sys::gpointer, 887 ) where 888 P: IsA<Grid>, 889 { 890 let f: &F = &*(f as *const F); 891 f(&Grid::from_glib_borrow(this).unsafe_cast()) 892 } 893 unsafe { 894 let f: Box_<F> = Box_::new(f); 895 connect_raw( 896 self.as_ptr() as *mut _, 897 b"notify::row-homogeneous\0".as_ptr() as *const _, 898 Some(transmute( 899 notify_row_homogeneous_trampoline::<Self, F> as usize, 900 )), 901 Box_::into_raw(f), 902 ) 903 } 904 } 905 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId906 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 907 unsafe extern "C" fn notify_row_spacing_trampoline<P, F: Fn(&P) + 'static>( 908 this: *mut gtk_sys::GtkGrid, 909 _param_spec: glib_sys::gpointer, 910 f: glib_sys::gpointer, 911 ) where 912 P: IsA<Grid>, 913 { 914 let f: &F = &*(f as *const F); 915 f(&Grid::from_glib_borrow(this).unsafe_cast()) 916 } 917 unsafe { 918 let f: Box_<F> = Box_::new(f); 919 connect_raw( 920 self.as_ptr() as *mut _, 921 b"notify::row-spacing\0".as_ptr() as *const _, 922 Some(transmute(notify_row_spacing_trampoline::<Self, F> as usize)), 923 Box_::into_raw(f), 924 ) 925 } 926 } 927 } 928 929 impl fmt::Display for Grid { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result930 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 931 write!(f, "Grid") 932 } 933 } 934