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::Actionable; 6 use crate::Align; 7 use crate::Bin; 8 use crate::Buildable; 9 use crate::Button; 10 use crate::ColorChooser; 11 use crate::Container; 12 use crate::PositionType; 13 use crate::ReliefStyle; 14 use crate::ResizeMode; 15 use crate::Widget; 16 use glib::object::Cast; 17 use glib::object::IsA; 18 use glib::signal::connect_raw; 19 use glib::signal::SignalHandlerId; 20 use glib::translate::*; 21 use glib::StaticType; 22 use glib::ToValue; 23 use std::boxed::Box as Box_; 24 use std::fmt; 25 use std::mem::transmute; 26 27 glib::wrapper! { 28 #[doc(alias = "GtkColorButton")] 29 pub struct ColorButton(Object<ffi::GtkColorButton, ffi::GtkColorButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable, ColorChooser; 30 31 match fn { 32 type_ => || ffi::gtk_color_button_get_type(), 33 } 34 } 35 36 impl ColorButton { 37 #[doc(alias = "gtk_color_button_new")] new() -> ColorButton38 pub fn new() -> ColorButton { 39 assert_initialized_main_thread!(); 40 unsafe { Widget::from_glib_none(ffi::gtk_color_button_new()).unsafe_cast() } 41 } 42 43 #[doc(alias = "gtk_color_button_new_with_rgba")] 44 #[doc(alias = "new_with_rgba")] with_rgba(rgba: &gdk::RGBA) -> ColorButton45 pub fn with_rgba(rgba: &gdk::RGBA) -> ColorButton { 46 assert_initialized_main_thread!(); 47 unsafe { 48 Widget::from_glib_none(ffi::gtk_color_button_new_with_rgba(rgba.to_glib_none().0)) 49 .unsafe_cast() 50 } 51 } 52 53 // rustdoc-stripper-ignore-next 54 /// Creates a new builder-pattern struct instance to construct [`ColorButton`] objects. 55 /// 56 /// This method returns an instance of [`ColorButtonBuilder`] which can be used to create [`ColorButton`] objects. builder() -> ColorButtonBuilder57 pub fn builder() -> ColorButtonBuilder { 58 ColorButtonBuilder::default() 59 } 60 } 61 62 impl Default for ColorButton { default() -> Self63 fn default() -> Self { 64 Self::new() 65 } 66 } 67 68 #[derive(Clone, Default)] 69 // rustdoc-stripper-ignore-next 70 /// A [builder-pattern] type to construct [`ColorButton`] objects. 71 /// 72 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 73 pub struct ColorButtonBuilder { 74 alpha: Option<u32>, 75 rgba: Option<gdk::RGBA>, 76 #[cfg(any(feature = "v3_20", feature = "dox"))] 77 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 78 show_editor: Option<bool>, 79 title: Option<String>, 80 use_alpha: Option<bool>, 81 always_show_image: Option<bool>, 82 image: Option<Widget>, 83 image_position: Option<PositionType>, 84 label: Option<String>, 85 relief: Option<ReliefStyle>, 86 use_underline: Option<bool>, 87 border_width: Option<u32>, 88 child: Option<Widget>, 89 resize_mode: Option<ResizeMode>, 90 app_paintable: Option<bool>, 91 can_default: Option<bool>, 92 can_focus: Option<bool>, 93 events: Option<gdk::EventMask>, 94 expand: Option<bool>, 95 #[cfg(any(feature = "v3_20", feature = "dox"))] 96 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 97 focus_on_click: Option<bool>, 98 halign: Option<Align>, 99 has_default: Option<bool>, 100 has_focus: Option<bool>, 101 has_tooltip: Option<bool>, 102 height_request: Option<i32>, 103 hexpand: Option<bool>, 104 hexpand_set: Option<bool>, 105 is_focus: Option<bool>, 106 margin: Option<i32>, 107 margin_bottom: Option<i32>, 108 margin_end: Option<i32>, 109 margin_start: Option<i32>, 110 margin_top: Option<i32>, 111 name: Option<String>, 112 no_show_all: Option<bool>, 113 opacity: Option<f64>, 114 parent: Option<Container>, 115 receives_default: Option<bool>, 116 sensitive: Option<bool>, 117 tooltip_markup: Option<String>, 118 tooltip_text: Option<String>, 119 valign: Option<Align>, 120 vexpand: Option<bool>, 121 vexpand_set: Option<bool>, 122 visible: Option<bool>, 123 width_request: Option<i32>, 124 action_name: Option<String>, 125 action_target: Option<glib::Variant>, 126 } 127 128 impl ColorButtonBuilder { 129 // rustdoc-stripper-ignore-next 130 /// Create a new [`ColorButtonBuilder`]. new() -> Self131 pub fn new() -> Self { 132 Self::default() 133 } 134 135 // rustdoc-stripper-ignore-next 136 /// Build the [`ColorButton`]. build(self) -> ColorButton137 pub fn build(self) -> ColorButton { 138 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 139 if let Some(ref alpha) = self.alpha { 140 properties.push(("alpha", alpha)); 141 } 142 if let Some(ref rgba) = self.rgba { 143 properties.push(("rgba", rgba)); 144 } 145 #[cfg(any(feature = "v3_20", feature = "dox"))] 146 if let Some(ref show_editor) = self.show_editor { 147 properties.push(("show-editor", show_editor)); 148 } 149 if let Some(ref title) = self.title { 150 properties.push(("title", title)); 151 } 152 if let Some(ref use_alpha) = self.use_alpha { 153 properties.push(("use-alpha", use_alpha)); 154 } 155 if let Some(ref always_show_image) = self.always_show_image { 156 properties.push(("always-show-image", always_show_image)); 157 } 158 if let Some(ref image) = self.image { 159 properties.push(("image", image)); 160 } 161 if let Some(ref image_position) = self.image_position { 162 properties.push(("image-position", image_position)); 163 } 164 if let Some(ref label) = self.label { 165 properties.push(("label", label)); 166 } 167 if let Some(ref relief) = self.relief { 168 properties.push(("relief", relief)); 169 } 170 if let Some(ref use_underline) = self.use_underline { 171 properties.push(("use-underline", use_underline)); 172 } 173 if let Some(ref border_width) = self.border_width { 174 properties.push(("border-width", border_width)); 175 } 176 if let Some(ref child) = self.child { 177 properties.push(("child", child)); 178 } 179 if let Some(ref resize_mode) = self.resize_mode { 180 properties.push(("resize-mode", resize_mode)); 181 } 182 if let Some(ref app_paintable) = self.app_paintable { 183 properties.push(("app-paintable", app_paintable)); 184 } 185 if let Some(ref can_default) = self.can_default { 186 properties.push(("can-default", can_default)); 187 } 188 if let Some(ref can_focus) = self.can_focus { 189 properties.push(("can-focus", can_focus)); 190 } 191 if let Some(ref events) = self.events { 192 properties.push(("events", events)); 193 } 194 if let Some(ref expand) = self.expand { 195 properties.push(("expand", expand)); 196 } 197 #[cfg(any(feature = "v3_20", feature = "dox"))] 198 if let Some(ref focus_on_click) = self.focus_on_click { 199 properties.push(("focus-on-click", focus_on_click)); 200 } 201 if let Some(ref halign) = self.halign { 202 properties.push(("halign", halign)); 203 } 204 if let Some(ref has_default) = self.has_default { 205 properties.push(("has-default", has_default)); 206 } 207 if let Some(ref has_focus) = self.has_focus { 208 properties.push(("has-focus", has_focus)); 209 } 210 if let Some(ref has_tooltip) = self.has_tooltip { 211 properties.push(("has-tooltip", has_tooltip)); 212 } 213 if let Some(ref height_request) = self.height_request { 214 properties.push(("height-request", height_request)); 215 } 216 if let Some(ref hexpand) = self.hexpand { 217 properties.push(("hexpand", hexpand)); 218 } 219 if let Some(ref hexpand_set) = self.hexpand_set { 220 properties.push(("hexpand-set", hexpand_set)); 221 } 222 if let Some(ref is_focus) = self.is_focus { 223 properties.push(("is-focus", is_focus)); 224 } 225 if let Some(ref margin) = self.margin { 226 properties.push(("margin", margin)); 227 } 228 if let Some(ref margin_bottom) = self.margin_bottom { 229 properties.push(("margin-bottom", margin_bottom)); 230 } 231 if let Some(ref margin_end) = self.margin_end { 232 properties.push(("margin-end", margin_end)); 233 } 234 if let Some(ref margin_start) = self.margin_start { 235 properties.push(("margin-start", margin_start)); 236 } 237 if let Some(ref margin_top) = self.margin_top { 238 properties.push(("margin-top", margin_top)); 239 } 240 if let Some(ref name) = self.name { 241 properties.push(("name", name)); 242 } 243 if let Some(ref no_show_all) = self.no_show_all { 244 properties.push(("no-show-all", no_show_all)); 245 } 246 if let Some(ref opacity) = self.opacity { 247 properties.push(("opacity", opacity)); 248 } 249 if let Some(ref parent) = self.parent { 250 properties.push(("parent", parent)); 251 } 252 if let Some(ref receives_default) = self.receives_default { 253 properties.push(("receives-default", receives_default)); 254 } 255 if let Some(ref sensitive) = self.sensitive { 256 properties.push(("sensitive", sensitive)); 257 } 258 if let Some(ref tooltip_markup) = self.tooltip_markup { 259 properties.push(("tooltip-markup", tooltip_markup)); 260 } 261 if let Some(ref tooltip_text) = self.tooltip_text { 262 properties.push(("tooltip-text", tooltip_text)); 263 } 264 if let Some(ref valign) = self.valign { 265 properties.push(("valign", valign)); 266 } 267 if let Some(ref vexpand) = self.vexpand { 268 properties.push(("vexpand", vexpand)); 269 } 270 if let Some(ref vexpand_set) = self.vexpand_set { 271 properties.push(("vexpand-set", vexpand_set)); 272 } 273 if let Some(ref visible) = self.visible { 274 properties.push(("visible", visible)); 275 } 276 if let Some(ref width_request) = self.width_request { 277 properties.push(("width-request", width_request)); 278 } 279 if let Some(ref action_name) = self.action_name { 280 properties.push(("action-name", action_name)); 281 } 282 if let Some(ref action_target) = self.action_target { 283 properties.push(("action-target", action_target)); 284 } 285 glib::Object::new::<ColorButton>(&properties) 286 .expect("Failed to create an instance of ColorButton") 287 } 288 alpha(mut self, alpha: u32) -> Self289 pub fn alpha(mut self, alpha: u32) -> Self { 290 self.alpha = Some(alpha); 291 self 292 } 293 rgba(mut self, rgba: &gdk::RGBA) -> Self294 pub fn rgba(mut self, rgba: &gdk::RGBA) -> Self { 295 self.rgba = Some(rgba.clone()); 296 self 297 } 298 299 #[cfg(any(feature = "v3_20", feature = "dox"))] 300 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] show_editor(mut self, show_editor: bool) -> Self301 pub fn show_editor(mut self, show_editor: bool) -> Self { 302 self.show_editor = Some(show_editor); 303 self 304 } 305 title(mut self, title: &str) -> Self306 pub fn title(mut self, title: &str) -> Self { 307 self.title = Some(title.to_string()); 308 self 309 } 310 use_alpha(mut self, use_alpha: bool) -> Self311 pub fn use_alpha(mut self, use_alpha: bool) -> Self { 312 self.use_alpha = Some(use_alpha); 313 self 314 } 315 always_show_image(mut self, always_show_image: bool) -> Self316 pub fn always_show_image(mut self, always_show_image: bool) -> Self { 317 self.always_show_image = Some(always_show_image); 318 self 319 } 320 image<P: IsA<Widget>>(mut self, image: &P) -> Self321 pub fn image<P: IsA<Widget>>(mut self, image: &P) -> Self { 322 self.image = Some(image.clone().upcast()); 323 self 324 } 325 image_position(mut self, image_position: PositionType) -> Self326 pub fn image_position(mut self, image_position: PositionType) -> Self { 327 self.image_position = Some(image_position); 328 self 329 } 330 label(mut self, label: &str) -> Self331 pub fn label(mut self, label: &str) -> Self { 332 self.label = Some(label.to_string()); 333 self 334 } 335 relief(mut self, relief: ReliefStyle) -> Self336 pub fn relief(mut self, relief: ReliefStyle) -> Self { 337 self.relief = Some(relief); 338 self 339 } 340 use_underline(mut self, use_underline: bool) -> Self341 pub fn use_underline(mut self, use_underline: bool) -> Self { 342 self.use_underline = Some(use_underline); 343 self 344 } 345 border_width(mut self, border_width: u32) -> Self346 pub fn border_width(mut self, border_width: u32) -> Self { 347 self.border_width = Some(border_width); 348 self 349 } 350 child<P: IsA<Widget>>(mut self, child: &P) -> Self351 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 352 self.child = Some(child.clone().upcast()); 353 self 354 } 355 resize_mode(mut self, resize_mode: ResizeMode) -> Self356 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 357 self.resize_mode = Some(resize_mode); 358 self 359 } 360 app_paintable(mut self, app_paintable: bool) -> Self361 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 362 self.app_paintable = Some(app_paintable); 363 self 364 } 365 can_default(mut self, can_default: bool) -> Self366 pub fn can_default(mut self, can_default: bool) -> Self { 367 self.can_default = Some(can_default); 368 self 369 } 370 can_focus(mut self, can_focus: bool) -> Self371 pub fn can_focus(mut self, can_focus: bool) -> Self { 372 self.can_focus = Some(can_focus); 373 self 374 } 375 events(mut self, events: gdk::EventMask) -> Self376 pub fn events(mut self, events: gdk::EventMask) -> Self { 377 self.events = Some(events); 378 self 379 } 380 expand(mut self, expand: bool) -> Self381 pub fn expand(mut self, expand: bool) -> Self { 382 self.expand = Some(expand); 383 self 384 } 385 386 #[cfg(any(feature = "v3_20", feature = "dox"))] 387 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self388 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 389 self.focus_on_click = Some(focus_on_click); 390 self 391 } 392 halign(mut self, halign: Align) -> Self393 pub fn halign(mut self, halign: Align) -> Self { 394 self.halign = Some(halign); 395 self 396 } 397 has_default(mut self, has_default: bool) -> Self398 pub fn has_default(mut self, has_default: bool) -> Self { 399 self.has_default = Some(has_default); 400 self 401 } 402 has_focus(mut self, has_focus: bool) -> Self403 pub fn has_focus(mut self, has_focus: bool) -> Self { 404 self.has_focus = Some(has_focus); 405 self 406 } 407 has_tooltip(mut self, has_tooltip: bool) -> Self408 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 409 self.has_tooltip = Some(has_tooltip); 410 self 411 } 412 height_request(mut self, height_request: i32) -> Self413 pub fn height_request(mut self, height_request: i32) -> Self { 414 self.height_request = Some(height_request); 415 self 416 } 417 hexpand(mut self, hexpand: bool) -> Self418 pub fn hexpand(mut self, hexpand: bool) -> Self { 419 self.hexpand = Some(hexpand); 420 self 421 } 422 hexpand_set(mut self, hexpand_set: bool) -> Self423 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 424 self.hexpand_set = Some(hexpand_set); 425 self 426 } 427 is_focus(mut self, is_focus: bool) -> Self428 pub fn is_focus(mut self, is_focus: bool) -> Self { 429 self.is_focus = Some(is_focus); 430 self 431 } 432 margin(mut self, margin: i32) -> Self433 pub fn margin(mut self, margin: i32) -> Self { 434 self.margin = Some(margin); 435 self 436 } 437 margin_bottom(mut self, margin_bottom: i32) -> Self438 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 439 self.margin_bottom = Some(margin_bottom); 440 self 441 } 442 margin_end(mut self, margin_end: i32) -> Self443 pub fn margin_end(mut self, margin_end: i32) -> Self { 444 self.margin_end = Some(margin_end); 445 self 446 } 447 margin_start(mut self, margin_start: i32) -> Self448 pub fn margin_start(mut self, margin_start: i32) -> Self { 449 self.margin_start = Some(margin_start); 450 self 451 } 452 margin_top(mut self, margin_top: i32) -> Self453 pub fn margin_top(mut self, margin_top: i32) -> Self { 454 self.margin_top = Some(margin_top); 455 self 456 } 457 name(mut self, name: &str) -> Self458 pub fn name(mut self, name: &str) -> Self { 459 self.name = Some(name.to_string()); 460 self 461 } 462 no_show_all(mut self, no_show_all: bool) -> Self463 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 464 self.no_show_all = Some(no_show_all); 465 self 466 } 467 opacity(mut self, opacity: f64) -> Self468 pub fn opacity(mut self, opacity: f64) -> Self { 469 self.opacity = Some(opacity); 470 self 471 } 472 parent<P: IsA<Container>>(mut self, parent: &P) -> Self473 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 474 self.parent = Some(parent.clone().upcast()); 475 self 476 } 477 receives_default(mut self, receives_default: bool) -> Self478 pub fn receives_default(mut self, receives_default: bool) -> Self { 479 self.receives_default = Some(receives_default); 480 self 481 } 482 sensitive(mut self, sensitive: bool) -> Self483 pub fn sensitive(mut self, sensitive: bool) -> Self { 484 self.sensitive = Some(sensitive); 485 self 486 } 487 tooltip_markup(mut self, tooltip_markup: &str) -> Self488 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 489 self.tooltip_markup = Some(tooltip_markup.to_string()); 490 self 491 } 492 tooltip_text(mut self, tooltip_text: &str) -> Self493 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 494 self.tooltip_text = Some(tooltip_text.to_string()); 495 self 496 } 497 valign(mut self, valign: Align) -> Self498 pub fn valign(mut self, valign: Align) -> Self { 499 self.valign = Some(valign); 500 self 501 } 502 vexpand(mut self, vexpand: bool) -> Self503 pub fn vexpand(mut self, vexpand: bool) -> Self { 504 self.vexpand = Some(vexpand); 505 self 506 } 507 vexpand_set(mut self, vexpand_set: bool) -> Self508 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 509 self.vexpand_set = Some(vexpand_set); 510 self 511 } 512 visible(mut self, visible: bool) -> Self513 pub fn visible(mut self, visible: bool) -> Self { 514 self.visible = Some(visible); 515 self 516 } 517 width_request(mut self, width_request: i32) -> Self518 pub fn width_request(mut self, width_request: i32) -> Self { 519 self.width_request = Some(width_request); 520 self 521 } 522 action_name(mut self, action_name: &str) -> Self523 pub fn action_name(mut self, action_name: &str) -> Self { 524 self.action_name = Some(action_name.to_string()); 525 self 526 } 527 action_target(mut self, action_target: &glib::Variant) -> Self528 pub fn action_target(mut self, action_target: &glib::Variant) -> Self { 529 self.action_target = Some(action_target.clone()); 530 self 531 } 532 } 533 534 pub const NONE_COLOR_BUTTON: Option<&ColorButton> = None; 535 536 pub trait ColorButtonExt: 'static { 537 #[doc(alias = "gtk_color_button_get_title")] 538 #[doc(alias = "get_title")] title(&self) -> Option<glib::GString>539 fn title(&self) -> Option<glib::GString>; 540 541 #[doc(alias = "gtk_color_button_set_title")] set_title(&self, title: &str)542 fn set_title(&self, title: &str); 543 alpha(&self) -> u32544 fn alpha(&self) -> u32; 545 set_alpha(&self, alpha: u32)546 fn set_alpha(&self, alpha: u32); 547 548 #[cfg(any(feature = "v3_20", feature = "dox"))] 549 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 550 #[doc(alias = "show-editor")] shows_editor(&self) -> bool551 fn shows_editor(&self) -> bool; 552 553 #[cfg(any(feature = "v3_20", feature = "dox"))] 554 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 555 #[doc(alias = "show-editor")] set_show_editor(&self, show_editor: bool)556 fn set_show_editor(&self, show_editor: bool); 557 558 #[doc(alias = "color-set")] connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId559 fn connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 560 561 #[doc(alias = "alpha")] connect_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId562 fn connect_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 563 564 #[doc(alias = "rgba")] connect_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId565 fn connect_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 566 567 #[cfg(any(feature = "v3_20", feature = "dox"))] 568 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 569 #[doc(alias = "show-editor")] connect_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId570 fn connect_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 571 572 #[doc(alias = "title")] connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId573 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 574 575 #[doc(alias = "use-alpha")] connect_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId576 fn connect_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 577 } 578 579 impl<O: IsA<ColorButton>> ColorButtonExt for O { title(&self) -> Option<glib::GString>580 fn title(&self) -> Option<glib::GString> { 581 unsafe { 582 from_glib_none(ffi::gtk_color_button_get_title( 583 self.as_ref().to_glib_none().0, 584 )) 585 } 586 } 587 set_title(&self, title: &str)588 fn set_title(&self, title: &str) { 589 unsafe { 590 ffi::gtk_color_button_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0); 591 } 592 } 593 alpha(&self) -> u32594 fn alpha(&self) -> u32 { 595 unsafe { 596 let mut value = glib::Value::from_type(<u32 as StaticType>::static_type()); 597 glib::gobject_ffi::g_object_get_property( 598 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 599 b"alpha\0".as_ptr() as *const _, 600 value.to_glib_none_mut().0, 601 ); 602 value 603 .get() 604 .expect("Return Value for property `alpha` getter") 605 } 606 } 607 set_alpha(&self, alpha: u32)608 fn set_alpha(&self, alpha: u32) { 609 unsafe { 610 glib::gobject_ffi::g_object_set_property( 611 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 612 b"alpha\0".as_ptr() as *const _, 613 alpha.to_value().to_glib_none().0, 614 ); 615 } 616 } 617 618 #[cfg(any(feature = "v3_20", feature = "dox"))] 619 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] shows_editor(&self) -> bool620 fn shows_editor(&self) -> bool { 621 unsafe { 622 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 623 glib::gobject_ffi::g_object_get_property( 624 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 625 b"show-editor\0".as_ptr() as *const _, 626 value.to_glib_none_mut().0, 627 ); 628 value 629 .get() 630 .expect("Return Value for property `show-editor` getter") 631 } 632 } 633 634 #[cfg(any(feature = "v3_20", feature = "dox"))] 635 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] set_show_editor(&self, show_editor: bool)636 fn set_show_editor(&self, show_editor: bool) { 637 unsafe { 638 glib::gobject_ffi::g_object_set_property( 639 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 640 b"show-editor\0".as_ptr() as *const _, 641 show_editor.to_value().to_glib_none().0, 642 ); 643 } 644 } 645 connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId646 fn connect_color_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 647 unsafe extern "C" fn color_set_trampoline<P: IsA<ColorButton>, F: Fn(&P) + 'static>( 648 this: *mut ffi::GtkColorButton, 649 f: glib::ffi::gpointer, 650 ) { 651 let f: &F = &*(f as *const F); 652 f(ColorButton::from_glib_borrow(this).unsafe_cast_ref()) 653 } 654 unsafe { 655 let f: Box_<F> = Box_::new(f); 656 connect_raw( 657 self.as_ptr() as *mut _, 658 b"color-set\0".as_ptr() as *const _, 659 Some(transmute::<_, unsafe extern "C" fn()>( 660 color_set_trampoline::<Self, F> as *const (), 661 )), 662 Box_::into_raw(f), 663 ) 664 } 665 } 666 connect_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId667 fn connect_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 668 unsafe extern "C" fn notify_alpha_trampoline<P: IsA<ColorButton>, F: Fn(&P) + 'static>( 669 this: *mut ffi::GtkColorButton, 670 _param_spec: glib::ffi::gpointer, 671 f: glib::ffi::gpointer, 672 ) { 673 let f: &F = &*(f as *const F); 674 f(ColorButton::from_glib_borrow(this).unsafe_cast_ref()) 675 } 676 unsafe { 677 let f: Box_<F> = Box_::new(f); 678 connect_raw( 679 self.as_ptr() as *mut _, 680 b"notify::alpha\0".as_ptr() as *const _, 681 Some(transmute::<_, unsafe extern "C" fn()>( 682 notify_alpha_trampoline::<Self, F> as *const (), 683 )), 684 Box_::into_raw(f), 685 ) 686 } 687 } 688 connect_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId689 fn connect_rgba_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 690 unsafe extern "C" fn notify_rgba_trampoline<P: IsA<ColorButton>, F: Fn(&P) + 'static>( 691 this: *mut ffi::GtkColorButton, 692 _param_spec: glib::ffi::gpointer, 693 f: glib::ffi::gpointer, 694 ) { 695 let f: &F = &*(f as *const F); 696 f(ColorButton::from_glib_borrow(this).unsafe_cast_ref()) 697 } 698 unsafe { 699 let f: Box_<F> = Box_::new(f); 700 connect_raw( 701 self.as_ptr() as *mut _, 702 b"notify::rgba\0".as_ptr() as *const _, 703 Some(transmute::<_, unsafe extern "C" fn()>( 704 notify_rgba_trampoline::<Self, F> as *const (), 705 )), 706 Box_::into_raw(f), 707 ) 708 } 709 } 710 711 #[cfg(any(feature = "v3_20", feature = "dox"))] 712 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] connect_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId713 fn connect_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 714 unsafe extern "C" fn notify_show_editor_trampoline< 715 P: IsA<ColorButton>, 716 F: Fn(&P) + 'static, 717 >( 718 this: *mut ffi::GtkColorButton, 719 _param_spec: glib::ffi::gpointer, 720 f: glib::ffi::gpointer, 721 ) { 722 let f: &F = &*(f as *const F); 723 f(ColorButton::from_glib_borrow(this).unsafe_cast_ref()) 724 } 725 unsafe { 726 let f: Box_<F> = Box_::new(f); 727 connect_raw( 728 self.as_ptr() as *mut _, 729 b"notify::show-editor\0".as_ptr() as *const _, 730 Some(transmute::<_, unsafe extern "C" fn()>( 731 notify_show_editor_trampoline::<Self, F> as *const (), 732 )), 733 Box_::into_raw(f), 734 ) 735 } 736 } 737 connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId738 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 739 unsafe extern "C" fn notify_title_trampoline<P: IsA<ColorButton>, F: Fn(&P) + 'static>( 740 this: *mut ffi::GtkColorButton, 741 _param_spec: glib::ffi::gpointer, 742 f: glib::ffi::gpointer, 743 ) { 744 let f: &F = &*(f as *const F); 745 f(ColorButton::from_glib_borrow(this).unsafe_cast_ref()) 746 } 747 unsafe { 748 let f: Box_<F> = Box_::new(f); 749 connect_raw( 750 self.as_ptr() as *mut _, 751 b"notify::title\0".as_ptr() as *const _, 752 Some(transmute::<_, unsafe extern "C" fn()>( 753 notify_title_trampoline::<Self, F> as *const (), 754 )), 755 Box_::into_raw(f), 756 ) 757 } 758 } 759 connect_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId760 fn connect_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 761 unsafe extern "C" fn notify_use_alpha_trampoline< 762 P: IsA<ColorButton>, 763 F: Fn(&P) + 'static, 764 >( 765 this: *mut ffi::GtkColorButton, 766 _param_spec: glib::ffi::gpointer, 767 f: glib::ffi::gpointer, 768 ) { 769 let f: &F = &*(f as *const F); 770 f(ColorButton::from_glib_borrow(this).unsafe_cast_ref()) 771 } 772 unsafe { 773 let f: Box_<F> = Box_::new(f); 774 connect_raw( 775 self.as_ptr() as *mut _, 776 b"notify::use-alpha\0".as_ptr() as *const _, 777 Some(transmute::<_, unsafe extern "C" fn()>( 778 notify_use_alpha_trampoline::<Self, F> as *const (), 779 )), 780 Box_::into_raw(f), 781 ) 782 } 783 } 784 } 785 786 impl fmt::Display for ColorButton { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result787 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 788 f.write_str("ColorButton") 789 } 790 } 791