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; 7 use glib::object::Cast; 8 use glib::object::IsA; 9 use glib::object::ObjectExt; 10 use glib::signal::connect_raw; 11 use glib::signal::SignalHandlerId; 12 use glib::translate::*; 13 use glib::GString; 14 use glib::StaticType; 15 use glib::ToValue; 16 use glib::Value; 17 use glib_sys; 18 use gobject_sys; 19 use gtk_sys; 20 use libc; 21 use std::boxed::Box as Box_; 22 use std::fmt; 23 use std::mem::transmute; 24 use Actionable; 25 use Adjustment; 26 use Align; 27 use Bin; 28 use Buildable; 29 use Button; 30 use Container; 31 use IconSize; 32 use Orientable; 33 use Orientation; 34 use PositionType; 35 use ReliefStyle; 36 use ResizeMode; 37 use Widget; 38 39 glib_wrapper! { 40 pub struct ScaleButton(Object<gtk_sys::GtkScaleButton, gtk_sys::GtkScaleButtonClass, ScaleButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable, Orientable; 41 42 match fn { 43 get_type => || gtk_sys::gtk_scale_button_get_type(), 44 } 45 } 46 47 impl ScaleButton { new(size: IconSize, min: f64, max: f64, step: f64, icons: &[&str]) -> ScaleButton48 pub fn new(size: IconSize, min: f64, max: f64, step: f64, icons: &[&str]) -> ScaleButton { 49 assert_initialized_main_thread!(); 50 unsafe { 51 Widget::from_glib_none(gtk_sys::gtk_scale_button_new( 52 size.to_glib(), 53 min, 54 max, 55 step, 56 icons.to_glib_none().0, 57 )) 58 .unsafe_cast() 59 } 60 } 61 } 62 63 #[derive(Clone, Default)] 64 pub struct ScaleButtonBuilder { 65 adjustment: Option<Adjustment>, 66 icons: Option<Vec<String>>, 67 size: Option<IconSize>, 68 value: Option<f64>, 69 always_show_image: Option<bool>, 70 image: Option<Widget>, 71 image_position: Option<PositionType>, 72 label: Option<String>, 73 relief: Option<ReliefStyle>, 74 use_underline: Option<bool>, 75 border_width: Option<u32>, 76 child: Option<Widget>, 77 resize_mode: Option<ResizeMode>, 78 app_paintable: Option<bool>, 79 can_default: Option<bool>, 80 can_focus: Option<bool>, 81 events: Option<gdk::EventMask>, 82 expand: Option<bool>, 83 #[cfg(any(feature = "v3_20", feature = "dox"))] 84 focus_on_click: Option<bool>, 85 halign: Option<Align>, 86 has_default: Option<bool>, 87 has_focus: Option<bool>, 88 has_tooltip: Option<bool>, 89 height_request: Option<i32>, 90 hexpand: Option<bool>, 91 hexpand_set: Option<bool>, 92 is_focus: Option<bool>, 93 margin: Option<i32>, 94 margin_bottom: Option<i32>, 95 margin_end: Option<i32>, 96 margin_start: Option<i32>, 97 margin_top: Option<i32>, 98 name: Option<String>, 99 no_show_all: Option<bool>, 100 opacity: Option<f64>, 101 parent: Option<Container>, 102 receives_default: Option<bool>, 103 sensitive: Option<bool>, 104 tooltip_markup: Option<String>, 105 tooltip_text: Option<String>, 106 valign: Option<Align>, 107 vexpand: Option<bool>, 108 vexpand_set: Option<bool>, 109 visible: Option<bool>, 110 width_request: Option<i32>, 111 action_name: Option<String>, 112 action_target: Option<glib::Variant>, 113 orientation: Option<Orientation>, 114 } 115 116 impl ScaleButtonBuilder { new() -> Self117 pub fn new() -> Self { 118 Self::default() 119 } 120 build(self) -> ScaleButton121 pub fn build(self) -> ScaleButton { 122 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 123 if let Some(ref adjustment) = self.adjustment { 124 properties.push(("adjustment", adjustment)); 125 } 126 if let Some(ref icons) = self.icons { 127 properties.push(("icons", icons)); 128 } 129 if let Some(ref size) = self.size { 130 properties.push(("size", size)); 131 } 132 if let Some(ref value) = self.value { 133 properties.push(("value", value)); 134 } 135 if let Some(ref always_show_image) = self.always_show_image { 136 properties.push(("always-show-image", always_show_image)); 137 } 138 if let Some(ref image) = self.image { 139 properties.push(("image", image)); 140 } 141 if let Some(ref image_position) = self.image_position { 142 properties.push(("image-position", image_position)); 143 } 144 if let Some(ref label) = self.label { 145 properties.push(("label", label)); 146 } 147 if let Some(ref relief) = self.relief { 148 properties.push(("relief", relief)); 149 } 150 if let Some(ref use_underline) = self.use_underline { 151 properties.push(("use-underline", use_underline)); 152 } 153 if let Some(ref border_width) = self.border_width { 154 properties.push(("border-width", border_width)); 155 } 156 if let Some(ref child) = self.child { 157 properties.push(("child", child)); 158 } 159 if let Some(ref resize_mode) = self.resize_mode { 160 properties.push(("resize-mode", resize_mode)); 161 } 162 if let Some(ref app_paintable) = self.app_paintable { 163 properties.push(("app-paintable", app_paintable)); 164 } 165 if let Some(ref can_default) = self.can_default { 166 properties.push(("can-default", can_default)); 167 } 168 if let Some(ref can_focus) = self.can_focus { 169 properties.push(("can-focus", can_focus)); 170 } 171 if let Some(ref events) = self.events { 172 properties.push(("events", events)); 173 } 174 if let Some(ref expand) = self.expand { 175 properties.push(("expand", expand)); 176 } 177 #[cfg(any(feature = "v3_20", feature = "dox"))] 178 { 179 if let Some(ref focus_on_click) = self.focus_on_click { 180 properties.push(("focus-on-click", focus_on_click)); 181 } 182 } 183 if let Some(ref halign) = self.halign { 184 properties.push(("halign", halign)); 185 } 186 if let Some(ref has_default) = self.has_default { 187 properties.push(("has-default", has_default)); 188 } 189 if let Some(ref has_focus) = self.has_focus { 190 properties.push(("has-focus", has_focus)); 191 } 192 if let Some(ref has_tooltip) = self.has_tooltip { 193 properties.push(("has-tooltip", has_tooltip)); 194 } 195 if let Some(ref height_request) = self.height_request { 196 properties.push(("height-request", height_request)); 197 } 198 if let Some(ref hexpand) = self.hexpand { 199 properties.push(("hexpand", hexpand)); 200 } 201 if let Some(ref hexpand_set) = self.hexpand_set { 202 properties.push(("hexpand-set", hexpand_set)); 203 } 204 if let Some(ref is_focus) = self.is_focus { 205 properties.push(("is-focus", is_focus)); 206 } 207 if let Some(ref margin) = self.margin { 208 properties.push(("margin", margin)); 209 } 210 if let Some(ref margin_bottom) = self.margin_bottom { 211 properties.push(("margin-bottom", margin_bottom)); 212 } 213 if let Some(ref margin_end) = self.margin_end { 214 properties.push(("margin-end", margin_end)); 215 } 216 if let Some(ref margin_start) = self.margin_start { 217 properties.push(("margin-start", margin_start)); 218 } 219 if let Some(ref margin_top) = self.margin_top { 220 properties.push(("margin-top", margin_top)); 221 } 222 if let Some(ref name) = self.name { 223 properties.push(("name", name)); 224 } 225 if let Some(ref no_show_all) = self.no_show_all { 226 properties.push(("no-show-all", no_show_all)); 227 } 228 if let Some(ref opacity) = self.opacity { 229 properties.push(("opacity", opacity)); 230 } 231 if let Some(ref parent) = self.parent { 232 properties.push(("parent", parent)); 233 } 234 if let Some(ref receives_default) = self.receives_default { 235 properties.push(("receives-default", receives_default)); 236 } 237 if let Some(ref sensitive) = self.sensitive { 238 properties.push(("sensitive", sensitive)); 239 } 240 if let Some(ref tooltip_markup) = self.tooltip_markup { 241 properties.push(("tooltip-markup", tooltip_markup)); 242 } 243 if let Some(ref tooltip_text) = self.tooltip_text { 244 properties.push(("tooltip-text", tooltip_text)); 245 } 246 if let Some(ref valign) = self.valign { 247 properties.push(("valign", valign)); 248 } 249 if let Some(ref vexpand) = self.vexpand { 250 properties.push(("vexpand", vexpand)); 251 } 252 if let Some(ref vexpand_set) = self.vexpand_set { 253 properties.push(("vexpand-set", vexpand_set)); 254 } 255 if let Some(ref visible) = self.visible { 256 properties.push(("visible", visible)); 257 } 258 if let Some(ref width_request) = self.width_request { 259 properties.push(("width-request", width_request)); 260 } 261 if let Some(ref action_name) = self.action_name { 262 properties.push(("action-name", action_name)); 263 } 264 if let Some(ref action_target) = self.action_target { 265 properties.push(("action-target", action_target)); 266 } 267 if let Some(ref orientation) = self.orientation { 268 properties.push(("orientation", orientation)); 269 } 270 glib::Object::new(ScaleButton::static_type(), &properties) 271 .expect("object new") 272 .downcast() 273 .expect("downcast") 274 } 275 adjustment<P: IsA<Adjustment>>(mut self, adjustment: &P) -> Self276 pub fn adjustment<P: IsA<Adjustment>>(mut self, adjustment: &P) -> Self { 277 self.adjustment = Some(adjustment.clone().upcast()); 278 self 279 } 280 icons(mut self, icons: Vec<String>) -> Self281 pub fn icons(mut self, icons: Vec<String>) -> Self { 282 self.icons = Some(icons); 283 self 284 } 285 size(mut self, size: IconSize) -> Self286 pub fn size(mut self, size: IconSize) -> Self { 287 self.size = Some(size); 288 self 289 } 290 value(mut self, value: f64) -> Self291 pub fn value(mut self, value: f64) -> Self { 292 self.value = Some(value); 293 self 294 } 295 always_show_image(mut self, always_show_image: bool) -> Self296 pub fn always_show_image(mut self, always_show_image: bool) -> Self { 297 self.always_show_image = Some(always_show_image); 298 self 299 } 300 image<P: IsA<Widget>>(mut self, image: &P) -> Self301 pub fn image<P: IsA<Widget>>(mut self, image: &P) -> Self { 302 self.image = Some(image.clone().upcast()); 303 self 304 } 305 image_position(mut self, image_position: PositionType) -> Self306 pub fn image_position(mut self, image_position: PositionType) -> Self { 307 self.image_position = Some(image_position); 308 self 309 } 310 label(mut self, label: &str) -> Self311 pub fn label(mut self, label: &str) -> Self { 312 self.label = Some(label.to_string()); 313 self 314 } 315 relief(mut self, relief: ReliefStyle) -> Self316 pub fn relief(mut self, relief: ReliefStyle) -> Self { 317 self.relief = Some(relief); 318 self 319 } 320 use_underline(mut self, use_underline: bool) -> Self321 pub fn use_underline(mut self, use_underline: bool) -> Self { 322 self.use_underline = Some(use_underline); 323 self 324 } 325 border_width(mut self, border_width: u32) -> Self326 pub fn border_width(mut self, border_width: u32) -> Self { 327 self.border_width = Some(border_width); 328 self 329 } 330 child<P: IsA<Widget>>(mut self, child: &P) -> Self331 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 332 self.child = Some(child.clone().upcast()); 333 self 334 } 335 resize_mode(mut self, resize_mode: ResizeMode) -> Self336 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 337 self.resize_mode = Some(resize_mode); 338 self 339 } 340 app_paintable(mut self, app_paintable: bool) -> Self341 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 342 self.app_paintable = Some(app_paintable); 343 self 344 } 345 can_default(mut self, can_default: bool) -> Self346 pub fn can_default(mut self, can_default: bool) -> Self { 347 self.can_default = Some(can_default); 348 self 349 } 350 can_focus(mut self, can_focus: bool) -> Self351 pub fn can_focus(mut self, can_focus: bool) -> Self { 352 self.can_focus = Some(can_focus); 353 self 354 } 355 events(mut self, events: gdk::EventMask) -> Self356 pub fn events(mut self, events: gdk::EventMask) -> Self { 357 self.events = Some(events); 358 self 359 } 360 expand(mut self, expand: bool) -> Self361 pub fn expand(mut self, expand: bool) -> Self { 362 self.expand = Some(expand); 363 self 364 } 365 366 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self367 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 368 self.focus_on_click = Some(focus_on_click); 369 self 370 } 371 halign(mut self, halign: Align) -> Self372 pub fn halign(mut self, halign: Align) -> Self { 373 self.halign = Some(halign); 374 self 375 } 376 has_default(mut self, has_default: bool) -> Self377 pub fn has_default(mut self, has_default: bool) -> Self { 378 self.has_default = Some(has_default); 379 self 380 } 381 has_focus(mut self, has_focus: bool) -> Self382 pub fn has_focus(mut self, has_focus: bool) -> Self { 383 self.has_focus = Some(has_focus); 384 self 385 } 386 has_tooltip(mut self, has_tooltip: bool) -> Self387 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 388 self.has_tooltip = Some(has_tooltip); 389 self 390 } 391 height_request(mut self, height_request: i32) -> Self392 pub fn height_request(mut self, height_request: i32) -> Self { 393 self.height_request = Some(height_request); 394 self 395 } 396 hexpand(mut self, hexpand: bool) -> Self397 pub fn hexpand(mut self, hexpand: bool) -> Self { 398 self.hexpand = Some(hexpand); 399 self 400 } 401 hexpand_set(mut self, hexpand_set: bool) -> Self402 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 403 self.hexpand_set = Some(hexpand_set); 404 self 405 } 406 is_focus(mut self, is_focus: bool) -> Self407 pub fn is_focus(mut self, is_focus: bool) -> Self { 408 self.is_focus = Some(is_focus); 409 self 410 } 411 margin(mut self, margin: i32) -> Self412 pub fn margin(mut self, margin: i32) -> Self { 413 self.margin = Some(margin); 414 self 415 } 416 margin_bottom(mut self, margin_bottom: i32) -> Self417 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 418 self.margin_bottom = Some(margin_bottom); 419 self 420 } 421 margin_end(mut self, margin_end: i32) -> Self422 pub fn margin_end(mut self, margin_end: i32) -> Self { 423 self.margin_end = Some(margin_end); 424 self 425 } 426 margin_start(mut self, margin_start: i32) -> Self427 pub fn margin_start(mut self, margin_start: i32) -> Self { 428 self.margin_start = Some(margin_start); 429 self 430 } 431 margin_top(mut self, margin_top: i32) -> Self432 pub fn margin_top(mut self, margin_top: i32) -> Self { 433 self.margin_top = Some(margin_top); 434 self 435 } 436 name(mut self, name: &str) -> Self437 pub fn name(mut self, name: &str) -> Self { 438 self.name = Some(name.to_string()); 439 self 440 } 441 no_show_all(mut self, no_show_all: bool) -> Self442 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 443 self.no_show_all = Some(no_show_all); 444 self 445 } 446 opacity(mut self, opacity: f64) -> Self447 pub fn opacity(mut self, opacity: f64) -> Self { 448 self.opacity = Some(opacity); 449 self 450 } 451 parent<P: IsA<Container>>(mut self, parent: &P) -> Self452 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 453 self.parent = Some(parent.clone().upcast()); 454 self 455 } 456 receives_default(mut self, receives_default: bool) -> Self457 pub fn receives_default(mut self, receives_default: bool) -> Self { 458 self.receives_default = Some(receives_default); 459 self 460 } 461 sensitive(mut self, sensitive: bool) -> Self462 pub fn sensitive(mut self, sensitive: bool) -> Self { 463 self.sensitive = Some(sensitive); 464 self 465 } 466 tooltip_markup(mut self, tooltip_markup: &str) -> Self467 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 468 self.tooltip_markup = Some(tooltip_markup.to_string()); 469 self 470 } 471 tooltip_text(mut self, tooltip_text: &str) -> Self472 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 473 self.tooltip_text = Some(tooltip_text.to_string()); 474 self 475 } 476 valign(mut self, valign: Align) -> Self477 pub fn valign(mut self, valign: Align) -> Self { 478 self.valign = Some(valign); 479 self 480 } 481 vexpand(mut self, vexpand: bool) -> Self482 pub fn vexpand(mut self, vexpand: bool) -> Self { 483 self.vexpand = Some(vexpand); 484 self 485 } 486 vexpand_set(mut self, vexpand_set: bool) -> Self487 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 488 self.vexpand_set = Some(vexpand_set); 489 self 490 } 491 visible(mut self, visible: bool) -> Self492 pub fn visible(mut self, visible: bool) -> Self { 493 self.visible = Some(visible); 494 self 495 } 496 width_request(mut self, width_request: i32) -> Self497 pub fn width_request(mut self, width_request: i32) -> Self { 498 self.width_request = Some(width_request); 499 self 500 } 501 action_name(mut self, action_name: &str) -> Self502 pub fn action_name(mut self, action_name: &str) -> Self { 503 self.action_name = Some(action_name.to_string()); 504 self 505 } 506 action_target(mut self, action_target: &glib::Variant) -> Self507 pub fn action_target(mut self, action_target: &glib::Variant) -> Self { 508 self.action_target = Some(action_target.clone()); 509 self 510 } 511 orientation(mut self, orientation: Orientation) -> Self512 pub fn orientation(mut self, orientation: Orientation) -> Self { 513 self.orientation = Some(orientation); 514 self 515 } 516 } 517 518 pub const NONE_SCALE_BUTTON: Option<&ScaleButton> = None; 519 520 pub trait ScaleButtonExt: 'static { get_adjustment(&self) -> Adjustment521 fn get_adjustment(&self) -> Adjustment; 522 get_minus_button(&self) -> Option<Button>523 fn get_minus_button(&self) -> Option<Button>; 524 get_plus_button(&self) -> Option<Button>525 fn get_plus_button(&self) -> Option<Button>; 526 get_popup(&self) -> Option<Widget>527 fn get_popup(&self) -> Option<Widget>; 528 get_value(&self) -> f64529 fn get_value(&self) -> f64; 530 set_adjustment<P: IsA<Adjustment>>(&self, adjustment: &P)531 fn set_adjustment<P: IsA<Adjustment>>(&self, adjustment: &P); 532 set_icons(&self, icons: &[&str])533 fn set_icons(&self, icons: &[&str]); 534 set_value(&self, value: f64)535 fn set_value(&self, value: f64); 536 get_property_icons(&self) -> Vec<GString>537 fn get_property_icons(&self) -> Vec<GString>; 538 get_property_size(&self) -> IconSize539 fn get_property_size(&self) -> IconSize; 540 set_property_size(&self, size: IconSize)541 fn set_property_size(&self, size: IconSize); 542 connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId543 fn connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 544 emit_popdown(&self)545 fn emit_popdown(&self); 546 connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId547 fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 548 emit_popup(&self)549 fn emit_popup(&self); 550 connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId551 fn connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId; 552 connect_property_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId553 fn connect_property_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 554 connect_property_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId555 fn connect_property_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 556 connect_property_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId557 fn connect_property_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 558 connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId559 fn connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 560 } 561 562 impl<O: IsA<ScaleButton>> ScaleButtonExt for O { get_adjustment(&self) -> Adjustment563 fn get_adjustment(&self) -> Adjustment { 564 unsafe { 565 from_glib_none(gtk_sys::gtk_scale_button_get_adjustment( 566 self.as_ref().to_glib_none().0, 567 )) 568 } 569 } 570 get_minus_button(&self) -> Option<Button>571 fn get_minus_button(&self) -> Option<Button> { 572 unsafe { 573 from_glib_none(gtk_sys::gtk_scale_button_get_minus_button( 574 self.as_ref().to_glib_none().0, 575 )) 576 } 577 } 578 get_plus_button(&self) -> Option<Button>579 fn get_plus_button(&self) -> Option<Button> { 580 unsafe { 581 from_glib_none(gtk_sys::gtk_scale_button_get_plus_button( 582 self.as_ref().to_glib_none().0, 583 )) 584 } 585 } 586 get_popup(&self) -> Option<Widget>587 fn get_popup(&self) -> Option<Widget> { 588 unsafe { 589 from_glib_none(gtk_sys::gtk_scale_button_get_popup( 590 self.as_ref().to_glib_none().0, 591 )) 592 } 593 } 594 get_value(&self) -> f64595 fn get_value(&self) -> f64 { 596 unsafe { gtk_sys::gtk_scale_button_get_value(self.as_ref().to_glib_none().0) } 597 } 598 set_adjustment<P: IsA<Adjustment>>(&self, adjustment: &P)599 fn set_adjustment<P: IsA<Adjustment>>(&self, adjustment: &P) { 600 unsafe { 601 gtk_sys::gtk_scale_button_set_adjustment( 602 self.as_ref().to_glib_none().0, 603 adjustment.as_ref().to_glib_none().0, 604 ); 605 } 606 } 607 set_icons(&self, icons: &[&str])608 fn set_icons(&self, icons: &[&str]) { 609 unsafe { 610 gtk_sys::gtk_scale_button_set_icons( 611 self.as_ref().to_glib_none().0, 612 icons.to_glib_none().0, 613 ); 614 } 615 } 616 set_value(&self, value: f64)617 fn set_value(&self, value: f64) { 618 unsafe { 619 gtk_sys::gtk_scale_button_set_value(self.as_ref().to_glib_none().0, value); 620 } 621 } 622 get_property_icons(&self) -> Vec<GString>623 fn get_property_icons(&self) -> Vec<GString> { 624 unsafe { 625 let mut value = Value::from_type(<Vec<GString> as StaticType>::static_type()); 626 gobject_sys::g_object_get_property( 627 self.to_glib_none().0 as *mut gobject_sys::GObject, 628 b"icons\0".as_ptr() as *const _, 629 value.to_glib_none_mut().0, 630 ); 631 value 632 .get() 633 .expect("Return Value for property `icons` getter") 634 .unwrap() 635 } 636 } 637 get_property_size(&self) -> IconSize638 fn get_property_size(&self) -> IconSize { 639 unsafe { 640 let mut value = Value::from_type(<IconSize as StaticType>::static_type()); 641 gobject_sys::g_object_get_property( 642 self.to_glib_none().0 as *mut gobject_sys::GObject, 643 b"size\0".as_ptr() as *const _, 644 value.to_glib_none_mut().0, 645 ); 646 value 647 .get() 648 .expect("Return Value for property `size` getter") 649 .unwrap() 650 } 651 } 652 set_property_size(&self, size: IconSize)653 fn set_property_size(&self, size: IconSize) { 654 unsafe { 655 gobject_sys::g_object_set_property( 656 self.to_glib_none().0 as *mut gobject_sys::GObject, 657 b"size\0".as_ptr() as *const _, 658 Value::from(&size).to_glib_none().0, 659 ); 660 } 661 } 662 connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId663 fn connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 664 unsafe extern "C" fn popdown_trampoline<P, F: Fn(&P) + 'static>( 665 this: *mut gtk_sys::GtkScaleButton, 666 f: glib_sys::gpointer, 667 ) where 668 P: IsA<ScaleButton>, 669 { 670 let f: &F = &*(f as *const F); 671 f(&ScaleButton::from_glib_borrow(this).unsafe_cast()) 672 } 673 unsafe { 674 let f: Box_<F> = Box_::new(f); 675 connect_raw( 676 self.as_ptr() as *mut _, 677 b"popdown\0".as_ptr() as *const _, 678 Some(transmute(popdown_trampoline::<Self, F> as usize)), 679 Box_::into_raw(f), 680 ) 681 } 682 } 683 emit_popdown(&self)684 fn emit_popdown(&self) { 685 let _ = unsafe { 686 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 687 .emit("popdown", &[]) 688 .unwrap() 689 }; 690 } 691 connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId692 fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 693 unsafe extern "C" fn popup_trampoline<P, F: Fn(&P) + 'static>( 694 this: *mut gtk_sys::GtkScaleButton, 695 f: glib_sys::gpointer, 696 ) where 697 P: IsA<ScaleButton>, 698 { 699 let f: &F = &*(f as *const F); 700 f(&ScaleButton::from_glib_borrow(this).unsafe_cast()) 701 } 702 unsafe { 703 let f: Box_<F> = Box_::new(f); 704 connect_raw( 705 self.as_ptr() as *mut _, 706 b"popup\0".as_ptr() as *const _, 707 Some(transmute(popup_trampoline::<Self, F> as usize)), 708 Box_::into_raw(f), 709 ) 710 } 711 } 712 emit_popup(&self)713 fn emit_popup(&self) { 714 let _ = unsafe { 715 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 716 .emit("popup", &[]) 717 .unwrap() 718 }; 719 } 720 connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId721 fn connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId { 722 unsafe extern "C" fn value_changed_trampoline<P, F: Fn(&P, f64) + 'static>( 723 this: *mut gtk_sys::GtkScaleButton, 724 value: libc::c_double, 725 f: glib_sys::gpointer, 726 ) where 727 P: IsA<ScaleButton>, 728 { 729 let f: &F = &*(f as *const F); 730 f(&ScaleButton::from_glib_borrow(this).unsafe_cast(), value) 731 } 732 unsafe { 733 let f: Box_<F> = Box_::new(f); 734 connect_raw( 735 self.as_ptr() as *mut _, 736 b"value-changed\0".as_ptr() as *const _, 737 Some(transmute(value_changed_trampoline::<Self, F> as usize)), 738 Box_::into_raw(f), 739 ) 740 } 741 } 742 connect_property_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId743 fn connect_property_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 744 unsafe extern "C" fn notify_adjustment_trampoline<P, F: Fn(&P) + 'static>( 745 this: *mut gtk_sys::GtkScaleButton, 746 _param_spec: glib_sys::gpointer, 747 f: glib_sys::gpointer, 748 ) where 749 P: IsA<ScaleButton>, 750 { 751 let f: &F = &*(f as *const F); 752 f(&ScaleButton::from_glib_borrow(this).unsafe_cast()) 753 } 754 unsafe { 755 let f: Box_<F> = Box_::new(f); 756 connect_raw( 757 self.as_ptr() as *mut _, 758 b"notify::adjustment\0".as_ptr() as *const _, 759 Some(transmute(notify_adjustment_trampoline::<Self, F> as usize)), 760 Box_::into_raw(f), 761 ) 762 } 763 } 764 connect_property_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId765 fn connect_property_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 766 unsafe extern "C" fn notify_icons_trampoline<P, F: Fn(&P) + 'static>( 767 this: *mut gtk_sys::GtkScaleButton, 768 _param_spec: glib_sys::gpointer, 769 f: glib_sys::gpointer, 770 ) where 771 P: IsA<ScaleButton>, 772 { 773 let f: &F = &*(f as *const F); 774 f(&ScaleButton::from_glib_borrow(this).unsafe_cast()) 775 } 776 unsafe { 777 let f: Box_<F> = Box_::new(f); 778 connect_raw( 779 self.as_ptr() as *mut _, 780 b"notify::icons\0".as_ptr() as *const _, 781 Some(transmute(notify_icons_trampoline::<Self, F> as usize)), 782 Box_::into_raw(f), 783 ) 784 } 785 } 786 connect_property_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId787 fn connect_property_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 788 unsafe extern "C" fn notify_size_trampoline<P, F: Fn(&P) + 'static>( 789 this: *mut gtk_sys::GtkScaleButton, 790 _param_spec: glib_sys::gpointer, 791 f: glib_sys::gpointer, 792 ) where 793 P: IsA<ScaleButton>, 794 { 795 let f: &F = &*(f as *const F); 796 f(&ScaleButton::from_glib_borrow(this).unsafe_cast()) 797 } 798 unsafe { 799 let f: Box_<F> = Box_::new(f); 800 connect_raw( 801 self.as_ptr() as *mut _, 802 b"notify::size\0".as_ptr() as *const _, 803 Some(transmute(notify_size_trampoline::<Self, F> as usize)), 804 Box_::into_raw(f), 805 ) 806 } 807 } 808 connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId809 fn connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 810 unsafe extern "C" fn notify_value_trampoline<P, F: Fn(&P) + 'static>( 811 this: *mut gtk_sys::GtkScaleButton, 812 _param_spec: glib_sys::gpointer, 813 f: glib_sys::gpointer, 814 ) where 815 P: IsA<ScaleButton>, 816 { 817 let f: &F = &*(f as *const F); 818 f(&ScaleButton::from_glib_borrow(this).unsafe_cast()) 819 } 820 unsafe { 821 let f: Box_<F> = Box_::new(f); 822 connect_raw( 823 self.as_ptr() as *mut _, 824 b"notify::value\0".as_ptr() as *const _, 825 Some(transmute(notify_value_trampoline::<Self, F> as usize)), 826 Box_::into_raw(f), 827 ) 828 } 829 } 830 } 831 832 impl fmt::Display for ScaleButton { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result833 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 834 write!(f, "ScaleButton") 835 } 836 } 837