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 gdk_pixbuf; 7 use glib::object::Cast; 8 use glib::object::IsA; 9 use glib::signal::connect_raw; 10 use glib::signal::SignalHandlerId; 11 use glib::translate::*; 12 use glib::StaticType; 13 use glib::ToValue; 14 use glib::Value; 15 use glib_sys; 16 use gobject_sys; 17 use gtk_sys; 18 use std::boxed::Box as Box_; 19 use std::fmt; 20 use std::mem::transmute; 21 use Align; 22 use Application; 23 use Bin; 24 use Buildable; 25 use ColorChooser; 26 use Container; 27 use Dialog; 28 use ResizeMode; 29 use Widget; 30 use Window; 31 use WindowPosition; 32 use WindowType; 33 34 glib_wrapper! { 35 pub struct ColorChooserDialog(Object<gtk_sys::GtkColorChooserDialog, gtk_sys::GtkColorChooserDialogClass, ColorChooserDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable, ColorChooser; 36 37 match fn { 38 get_type => || gtk_sys::gtk_color_chooser_dialog_get_type(), 39 } 40 } 41 42 impl ColorChooserDialog { new<P: IsA<Window>>(title: Option<&str>, parent: Option<&P>) -> ColorChooserDialog43 pub fn new<P: IsA<Window>>(title: Option<&str>, parent: Option<&P>) -> ColorChooserDialog { 44 assert_initialized_main_thread!(); 45 unsafe { 46 Widget::from_glib_none(gtk_sys::gtk_color_chooser_dialog_new( 47 title.to_glib_none().0, 48 parent.map(|p| p.as_ref()).to_glib_none().0, 49 )) 50 .unsafe_cast() 51 } 52 } 53 } 54 55 #[derive(Clone, Default)] 56 pub struct ColorChooserDialogBuilder { 57 show_editor: Option<bool>, 58 use_header_bar: Option<i32>, 59 accept_focus: Option<bool>, 60 application: Option<Application>, 61 attached_to: Option<Widget>, 62 decorated: Option<bool>, 63 default_height: Option<i32>, 64 default_width: Option<i32>, 65 deletable: Option<bool>, 66 destroy_with_parent: Option<bool>, 67 focus_on_map: Option<bool>, 68 focus_visible: Option<bool>, 69 gravity: Option<gdk::Gravity>, 70 hide_titlebar_when_maximized: Option<bool>, 71 icon: Option<gdk_pixbuf::Pixbuf>, 72 icon_name: Option<String>, 73 mnemonics_visible: Option<bool>, 74 modal: Option<bool>, 75 resizable: Option<bool>, 76 role: Option<String>, 77 screen: Option<gdk::Screen>, 78 skip_pager_hint: Option<bool>, 79 skip_taskbar_hint: Option<bool>, 80 startup_id: Option<String>, 81 title: Option<String>, 82 transient_for: Option<Window>, 83 type_: Option<WindowType>, 84 type_hint: Option<gdk::WindowTypeHint>, 85 urgency_hint: Option<bool>, 86 window_position: Option<WindowPosition>, 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 focus_on_click: Option<bool>, 97 halign: Option<Align>, 98 has_default: Option<bool>, 99 has_focus: Option<bool>, 100 has_tooltip: Option<bool>, 101 height_request: Option<i32>, 102 hexpand: Option<bool>, 103 hexpand_set: Option<bool>, 104 is_focus: Option<bool>, 105 margin: Option<i32>, 106 margin_bottom: Option<i32>, 107 margin_end: Option<i32>, 108 margin_start: Option<i32>, 109 margin_top: Option<i32>, 110 name: Option<String>, 111 no_show_all: Option<bool>, 112 opacity: Option<f64>, 113 parent: Option<Container>, 114 receives_default: Option<bool>, 115 sensitive: Option<bool>, 116 tooltip_markup: Option<String>, 117 tooltip_text: Option<String>, 118 valign: Option<Align>, 119 vexpand: Option<bool>, 120 vexpand_set: Option<bool>, 121 visible: Option<bool>, 122 width_request: Option<i32>, 123 rgba: Option<gdk::RGBA>, 124 use_alpha: Option<bool>, 125 } 126 127 impl ColorChooserDialogBuilder { new() -> Self128 pub fn new() -> Self { 129 Self::default() 130 } 131 build(self) -> ColorChooserDialog132 pub fn build(self) -> ColorChooserDialog { 133 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 134 if let Some(ref show_editor) = self.show_editor { 135 properties.push(("show-editor", show_editor)); 136 } 137 if let Some(ref use_header_bar) = self.use_header_bar { 138 properties.push(("use-header-bar", use_header_bar)); 139 } 140 if let Some(ref accept_focus) = self.accept_focus { 141 properties.push(("accept-focus", accept_focus)); 142 } 143 if let Some(ref application) = self.application { 144 properties.push(("application", application)); 145 } 146 if let Some(ref attached_to) = self.attached_to { 147 properties.push(("attached-to", attached_to)); 148 } 149 if let Some(ref decorated) = self.decorated { 150 properties.push(("decorated", decorated)); 151 } 152 if let Some(ref default_height) = self.default_height { 153 properties.push(("default-height", default_height)); 154 } 155 if let Some(ref default_width) = self.default_width { 156 properties.push(("default-width", default_width)); 157 } 158 if let Some(ref deletable) = self.deletable { 159 properties.push(("deletable", deletable)); 160 } 161 if let Some(ref destroy_with_parent) = self.destroy_with_parent { 162 properties.push(("destroy-with-parent", destroy_with_parent)); 163 } 164 if let Some(ref focus_on_map) = self.focus_on_map { 165 properties.push(("focus-on-map", focus_on_map)); 166 } 167 if let Some(ref focus_visible) = self.focus_visible { 168 properties.push(("focus-visible", focus_visible)); 169 } 170 if let Some(ref gravity) = self.gravity { 171 properties.push(("gravity", gravity)); 172 } 173 if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized { 174 properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized)); 175 } 176 if let Some(ref icon) = self.icon { 177 properties.push(("icon", icon)); 178 } 179 if let Some(ref icon_name) = self.icon_name { 180 properties.push(("icon-name", icon_name)); 181 } 182 if let Some(ref mnemonics_visible) = self.mnemonics_visible { 183 properties.push(("mnemonics-visible", mnemonics_visible)); 184 } 185 if let Some(ref modal) = self.modal { 186 properties.push(("modal", modal)); 187 } 188 if let Some(ref resizable) = self.resizable { 189 properties.push(("resizable", resizable)); 190 } 191 if let Some(ref role) = self.role { 192 properties.push(("role", role)); 193 } 194 if let Some(ref screen) = self.screen { 195 properties.push(("screen", screen)); 196 } 197 if let Some(ref skip_pager_hint) = self.skip_pager_hint { 198 properties.push(("skip-pager-hint", skip_pager_hint)); 199 } 200 if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint { 201 properties.push(("skip-taskbar-hint", skip_taskbar_hint)); 202 } 203 if let Some(ref startup_id) = self.startup_id { 204 properties.push(("startup-id", startup_id)); 205 } 206 if let Some(ref title) = self.title { 207 properties.push(("title", title)); 208 } 209 if let Some(ref transient_for) = self.transient_for { 210 properties.push(("transient-for", transient_for)); 211 } 212 if let Some(ref type_) = self.type_ { 213 properties.push(("type", type_)); 214 } 215 if let Some(ref type_hint) = self.type_hint { 216 properties.push(("type-hint", type_hint)); 217 } 218 if let Some(ref urgency_hint) = self.urgency_hint { 219 properties.push(("urgency-hint", urgency_hint)); 220 } 221 if let Some(ref window_position) = self.window_position { 222 properties.push(("window-position", window_position)); 223 } 224 if let Some(ref border_width) = self.border_width { 225 properties.push(("border-width", border_width)); 226 } 227 if let Some(ref child) = self.child { 228 properties.push(("child", child)); 229 } 230 if let Some(ref resize_mode) = self.resize_mode { 231 properties.push(("resize-mode", resize_mode)); 232 } 233 if let Some(ref app_paintable) = self.app_paintable { 234 properties.push(("app-paintable", app_paintable)); 235 } 236 if let Some(ref can_default) = self.can_default { 237 properties.push(("can-default", can_default)); 238 } 239 if let Some(ref can_focus) = self.can_focus { 240 properties.push(("can-focus", can_focus)); 241 } 242 if let Some(ref events) = self.events { 243 properties.push(("events", events)); 244 } 245 if let Some(ref expand) = self.expand { 246 properties.push(("expand", expand)); 247 } 248 #[cfg(any(feature = "v3_20", feature = "dox"))] 249 { 250 if let Some(ref focus_on_click) = self.focus_on_click { 251 properties.push(("focus-on-click", focus_on_click)); 252 } 253 } 254 if let Some(ref halign) = self.halign { 255 properties.push(("halign", halign)); 256 } 257 if let Some(ref has_default) = self.has_default { 258 properties.push(("has-default", has_default)); 259 } 260 if let Some(ref has_focus) = self.has_focus { 261 properties.push(("has-focus", has_focus)); 262 } 263 if let Some(ref has_tooltip) = self.has_tooltip { 264 properties.push(("has-tooltip", has_tooltip)); 265 } 266 if let Some(ref height_request) = self.height_request { 267 properties.push(("height-request", height_request)); 268 } 269 if let Some(ref hexpand) = self.hexpand { 270 properties.push(("hexpand", hexpand)); 271 } 272 if let Some(ref hexpand_set) = self.hexpand_set { 273 properties.push(("hexpand-set", hexpand_set)); 274 } 275 if let Some(ref is_focus) = self.is_focus { 276 properties.push(("is-focus", is_focus)); 277 } 278 if let Some(ref margin) = self.margin { 279 properties.push(("margin", margin)); 280 } 281 if let Some(ref margin_bottom) = self.margin_bottom { 282 properties.push(("margin-bottom", margin_bottom)); 283 } 284 if let Some(ref margin_end) = self.margin_end { 285 properties.push(("margin-end", margin_end)); 286 } 287 if let Some(ref margin_start) = self.margin_start { 288 properties.push(("margin-start", margin_start)); 289 } 290 if let Some(ref margin_top) = self.margin_top { 291 properties.push(("margin-top", margin_top)); 292 } 293 if let Some(ref name) = self.name { 294 properties.push(("name", name)); 295 } 296 if let Some(ref no_show_all) = self.no_show_all { 297 properties.push(("no-show-all", no_show_all)); 298 } 299 if let Some(ref opacity) = self.opacity { 300 properties.push(("opacity", opacity)); 301 } 302 if let Some(ref parent) = self.parent { 303 properties.push(("parent", parent)); 304 } 305 if let Some(ref receives_default) = self.receives_default { 306 properties.push(("receives-default", receives_default)); 307 } 308 if let Some(ref sensitive) = self.sensitive { 309 properties.push(("sensitive", sensitive)); 310 } 311 if let Some(ref tooltip_markup) = self.tooltip_markup { 312 properties.push(("tooltip-markup", tooltip_markup)); 313 } 314 if let Some(ref tooltip_text) = self.tooltip_text { 315 properties.push(("tooltip-text", tooltip_text)); 316 } 317 if let Some(ref valign) = self.valign { 318 properties.push(("valign", valign)); 319 } 320 if let Some(ref vexpand) = self.vexpand { 321 properties.push(("vexpand", vexpand)); 322 } 323 if let Some(ref vexpand_set) = self.vexpand_set { 324 properties.push(("vexpand-set", vexpand_set)); 325 } 326 if let Some(ref visible) = self.visible { 327 properties.push(("visible", visible)); 328 } 329 if let Some(ref width_request) = self.width_request { 330 properties.push(("width-request", width_request)); 331 } 332 if let Some(ref rgba) = self.rgba { 333 properties.push(("rgba", rgba)); 334 } 335 if let Some(ref use_alpha) = self.use_alpha { 336 properties.push(("use-alpha", use_alpha)); 337 } 338 glib::Object::new(ColorChooserDialog::static_type(), &properties) 339 .expect("object new") 340 .downcast() 341 .expect("downcast") 342 } 343 show_editor(mut self, show_editor: bool) -> Self344 pub fn show_editor(mut self, show_editor: bool) -> Self { 345 self.show_editor = Some(show_editor); 346 self 347 } 348 use_header_bar(mut self, use_header_bar: i32) -> Self349 pub fn use_header_bar(mut self, use_header_bar: i32) -> Self { 350 self.use_header_bar = Some(use_header_bar); 351 self 352 } 353 accept_focus(mut self, accept_focus: bool) -> Self354 pub fn accept_focus(mut self, accept_focus: bool) -> Self { 355 self.accept_focus = Some(accept_focus); 356 self 357 } 358 application<P: IsA<Application>>(mut self, application: &P) -> Self359 pub fn application<P: IsA<Application>>(mut self, application: &P) -> Self { 360 self.application = Some(application.clone().upcast()); 361 self 362 } 363 attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self364 pub fn attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self { 365 self.attached_to = Some(attached_to.clone().upcast()); 366 self 367 } 368 decorated(mut self, decorated: bool) -> Self369 pub fn decorated(mut self, decorated: bool) -> Self { 370 self.decorated = Some(decorated); 371 self 372 } 373 default_height(mut self, default_height: i32) -> Self374 pub fn default_height(mut self, default_height: i32) -> Self { 375 self.default_height = Some(default_height); 376 self 377 } 378 default_width(mut self, default_width: i32) -> Self379 pub fn default_width(mut self, default_width: i32) -> Self { 380 self.default_width = Some(default_width); 381 self 382 } 383 deletable(mut self, deletable: bool) -> Self384 pub fn deletable(mut self, deletable: bool) -> Self { 385 self.deletable = Some(deletable); 386 self 387 } 388 destroy_with_parent(mut self, destroy_with_parent: bool) -> Self389 pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self { 390 self.destroy_with_parent = Some(destroy_with_parent); 391 self 392 } 393 focus_on_map(mut self, focus_on_map: bool) -> Self394 pub fn focus_on_map(mut self, focus_on_map: bool) -> Self { 395 self.focus_on_map = Some(focus_on_map); 396 self 397 } 398 focus_visible(mut self, focus_visible: bool) -> Self399 pub fn focus_visible(mut self, focus_visible: bool) -> Self { 400 self.focus_visible = Some(focus_visible); 401 self 402 } 403 gravity(mut self, gravity: gdk::Gravity) -> Self404 pub fn gravity(mut self, gravity: gdk::Gravity) -> Self { 405 self.gravity = Some(gravity); 406 self 407 } 408 hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self409 pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self { 410 self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized); 411 self 412 } 413 icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self414 pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self { 415 self.icon = Some(icon.clone()); 416 self 417 } 418 icon_name(mut self, icon_name: &str) -> Self419 pub fn icon_name(mut self, icon_name: &str) -> Self { 420 self.icon_name = Some(icon_name.to_string()); 421 self 422 } 423 mnemonics_visible(mut self, mnemonics_visible: bool) -> Self424 pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self { 425 self.mnemonics_visible = Some(mnemonics_visible); 426 self 427 } 428 modal(mut self, modal: bool) -> Self429 pub fn modal(mut self, modal: bool) -> Self { 430 self.modal = Some(modal); 431 self 432 } 433 resizable(mut self, resizable: bool) -> Self434 pub fn resizable(mut self, resizable: bool) -> Self { 435 self.resizable = Some(resizable); 436 self 437 } 438 role(mut self, role: &str) -> Self439 pub fn role(mut self, role: &str) -> Self { 440 self.role = Some(role.to_string()); 441 self 442 } 443 screen(mut self, screen: &gdk::Screen) -> Self444 pub fn screen(mut self, screen: &gdk::Screen) -> Self { 445 self.screen = Some(screen.clone()); 446 self 447 } 448 skip_pager_hint(mut self, skip_pager_hint: bool) -> Self449 pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self { 450 self.skip_pager_hint = Some(skip_pager_hint); 451 self 452 } 453 skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self454 pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self { 455 self.skip_taskbar_hint = Some(skip_taskbar_hint); 456 self 457 } 458 startup_id(mut self, startup_id: &str) -> Self459 pub fn startup_id(mut self, startup_id: &str) -> Self { 460 self.startup_id = Some(startup_id.to_string()); 461 self 462 } 463 title(mut self, title: &str) -> Self464 pub fn title(mut self, title: &str) -> Self { 465 self.title = Some(title.to_string()); 466 self 467 } 468 transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self469 pub fn transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self { 470 self.transient_for = Some(transient_for.clone().upcast()); 471 self 472 } 473 type_(mut self, type_: WindowType) -> Self474 pub fn type_(mut self, type_: WindowType) -> Self { 475 self.type_ = Some(type_); 476 self 477 } 478 type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self479 pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self { 480 self.type_hint = Some(type_hint); 481 self 482 } 483 urgency_hint(mut self, urgency_hint: bool) -> Self484 pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { 485 self.urgency_hint = Some(urgency_hint); 486 self 487 } 488 window_position(mut self, window_position: WindowPosition) -> Self489 pub fn window_position(mut self, window_position: WindowPosition) -> Self { 490 self.window_position = Some(window_position); 491 self 492 } 493 border_width(mut self, border_width: u32) -> Self494 pub fn border_width(mut self, border_width: u32) -> Self { 495 self.border_width = Some(border_width); 496 self 497 } 498 child<P: IsA<Widget>>(mut self, child: &P) -> Self499 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 500 self.child = Some(child.clone().upcast()); 501 self 502 } 503 resize_mode(mut self, resize_mode: ResizeMode) -> Self504 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 505 self.resize_mode = Some(resize_mode); 506 self 507 } 508 app_paintable(mut self, app_paintable: bool) -> Self509 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 510 self.app_paintable = Some(app_paintable); 511 self 512 } 513 can_default(mut self, can_default: bool) -> Self514 pub fn can_default(mut self, can_default: bool) -> Self { 515 self.can_default = Some(can_default); 516 self 517 } 518 can_focus(mut self, can_focus: bool) -> Self519 pub fn can_focus(mut self, can_focus: bool) -> Self { 520 self.can_focus = Some(can_focus); 521 self 522 } 523 events(mut self, events: gdk::EventMask) -> Self524 pub fn events(mut self, events: gdk::EventMask) -> Self { 525 self.events = Some(events); 526 self 527 } 528 expand(mut self, expand: bool) -> Self529 pub fn expand(mut self, expand: bool) -> Self { 530 self.expand = Some(expand); 531 self 532 } 533 534 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self535 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 536 self.focus_on_click = Some(focus_on_click); 537 self 538 } 539 halign(mut self, halign: Align) -> Self540 pub fn halign(mut self, halign: Align) -> Self { 541 self.halign = Some(halign); 542 self 543 } 544 has_default(mut self, has_default: bool) -> Self545 pub fn has_default(mut self, has_default: bool) -> Self { 546 self.has_default = Some(has_default); 547 self 548 } 549 has_focus(mut self, has_focus: bool) -> Self550 pub fn has_focus(mut self, has_focus: bool) -> Self { 551 self.has_focus = Some(has_focus); 552 self 553 } 554 has_tooltip(mut self, has_tooltip: bool) -> Self555 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 556 self.has_tooltip = Some(has_tooltip); 557 self 558 } 559 height_request(mut self, height_request: i32) -> Self560 pub fn height_request(mut self, height_request: i32) -> Self { 561 self.height_request = Some(height_request); 562 self 563 } 564 hexpand(mut self, hexpand: bool) -> Self565 pub fn hexpand(mut self, hexpand: bool) -> Self { 566 self.hexpand = Some(hexpand); 567 self 568 } 569 hexpand_set(mut self, hexpand_set: bool) -> Self570 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 571 self.hexpand_set = Some(hexpand_set); 572 self 573 } 574 is_focus(mut self, is_focus: bool) -> Self575 pub fn is_focus(mut self, is_focus: bool) -> Self { 576 self.is_focus = Some(is_focus); 577 self 578 } 579 margin(mut self, margin: i32) -> Self580 pub fn margin(mut self, margin: i32) -> Self { 581 self.margin = Some(margin); 582 self 583 } 584 margin_bottom(mut self, margin_bottom: i32) -> Self585 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 586 self.margin_bottom = Some(margin_bottom); 587 self 588 } 589 margin_end(mut self, margin_end: i32) -> Self590 pub fn margin_end(mut self, margin_end: i32) -> Self { 591 self.margin_end = Some(margin_end); 592 self 593 } 594 margin_start(mut self, margin_start: i32) -> Self595 pub fn margin_start(mut self, margin_start: i32) -> Self { 596 self.margin_start = Some(margin_start); 597 self 598 } 599 margin_top(mut self, margin_top: i32) -> Self600 pub fn margin_top(mut self, margin_top: i32) -> Self { 601 self.margin_top = Some(margin_top); 602 self 603 } 604 name(mut self, name: &str) -> Self605 pub fn name(mut self, name: &str) -> Self { 606 self.name = Some(name.to_string()); 607 self 608 } 609 no_show_all(mut self, no_show_all: bool) -> Self610 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 611 self.no_show_all = Some(no_show_all); 612 self 613 } 614 opacity(mut self, opacity: f64) -> Self615 pub fn opacity(mut self, opacity: f64) -> Self { 616 self.opacity = Some(opacity); 617 self 618 } 619 parent<P: IsA<Container>>(mut self, parent: &P) -> Self620 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 621 self.parent = Some(parent.clone().upcast()); 622 self 623 } 624 receives_default(mut self, receives_default: bool) -> Self625 pub fn receives_default(mut self, receives_default: bool) -> Self { 626 self.receives_default = Some(receives_default); 627 self 628 } 629 sensitive(mut self, sensitive: bool) -> Self630 pub fn sensitive(mut self, sensitive: bool) -> Self { 631 self.sensitive = Some(sensitive); 632 self 633 } 634 tooltip_markup(mut self, tooltip_markup: &str) -> Self635 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 636 self.tooltip_markup = Some(tooltip_markup.to_string()); 637 self 638 } 639 tooltip_text(mut self, tooltip_text: &str) -> Self640 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 641 self.tooltip_text = Some(tooltip_text.to_string()); 642 self 643 } 644 valign(mut self, valign: Align) -> Self645 pub fn valign(mut self, valign: Align) -> Self { 646 self.valign = Some(valign); 647 self 648 } 649 vexpand(mut self, vexpand: bool) -> Self650 pub fn vexpand(mut self, vexpand: bool) -> Self { 651 self.vexpand = Some(vexpand); 652 self 653 } 654 vexpand_set(mut self, vexpand_set: bool) -> Self655 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 656 self.vexpand_set = Some(vexpand_set); 657 self 658 } 659 visible(mut self, visible: bool) -> Self660 pub fn visible(mut self, visible: bool) -> Self { 661 self.visible = Some(visible); 662 self 663 } 664 width_request(mut self, width_request: i32) -> Self665 pub fn width_request(mut self, width_request: i32) -> Self { 666 self.width_request = Some(width_request); 667 self 668 } 669 rgba(mut self, rgba: &gdk::RGBA) -> Self670 pub fn rgba(mut self, rgba: &gdk::RGBA) -> Self { 671 self.rgba = Some(rgba.clone()); 672 self 673 } 674 use_alpha(mut self, use_alpha: bool) -> Self675 pub fn use_alpha(mut self, use_alpha: bool) -> Self { 676 self.use_alpha = Some(use_alpha); 677 self 678 } 679 } 680 681 pub const NONE_COLOR_CHOOSER_DIALOG: Option<&ColorChooserDialog> = None; 682 683 pub trait ColorChooserDialogExt: 'static { get_property_show_editor(&self) -> bool684 fn get_property_show_editor(&self) -> bool; 685 set_property_show_editor(&self, show_editor: bool)686 fn set_property_show_editor(&self, show_editor: bool); 687 connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId688 fn connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 689 } 690 691 impl<O: IsA<ColorChooserDialog>> ColorChooserDialogExt for O { get_property_show_editor(&self) -> bool692 fn get_property_show_editor(&self) -> bool { 693 unsafe { 694 let mut value = Value::from_type(<bool as StaticType>::static_type()); 695 gobject_sys::g_object_get_property( 696 self.to_glib_none().0 as *mut gobject_sys::GObject, 697 b"show-editor\0".as_ptr() as *const _, 698 value.to_glib_none_mut().0, 699 ); 700 value 701 .get() 702 .expect("Return Value for property `show-editor` getter") 703 .unwrap() 704 } 705 } 706 set_property_show_editor(&self, show_editor: bool)707 fn set_property_show_editor(&self, show_editor: bool) { 708 unsafe { 709 gobject_sys::g_object_set_property( 710 self.to_glib_none().0 as *mut gobject_sys::GObject, 711 b"show-editor\0".as_ptr() as *const _, 712 Value::from(&show_editor).to_glib_none().0, 713 ); 714 } 715 } 716 connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId717 fn connect_property_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 718 unsafe extern "C" fn notify_show_editor_trampoline<P, F: Fn(&P) + 'static>( 719 this: *mut gtk_sys::GtkColorChooserDialog, 720 _param_spec: glib_sys::gpointer, 721 f: glib_sys::gpointer, 722 ) where 723 P: IsA<ColorChooserDialog>, 724 { 725 let f: &F = &*(f as *const F); 726 f(&ColorChooserDialog::from_glib_borrow(this).unsafe_cast()) 727 } 728 unsafe { 729 let f: Box_<F> = Box_::new(f); 730 connect_raw( 731 self.as_ptr() as *mut _, 732 b"notify::show-editor\0".as_ptr() as *const _, 733 Some(transmute(notify_show_editor_trampoline::<Self, F> as usize)), 734 Box_::into_raw(f), 735 ) 736 } 737 } 738 } 739 740 impl fmt::Display for ColorChooserDialog { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result741 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 742 write!(f, "ColorChooserDialog") 743 } 744 } 745