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::Container; 11 use crate::FontChooser; 12 #[cfg(any(feature = "v3_24", feature = "dox"))] 13 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 14 use crate::FontChooserLevel; 15 use crate::PositionType; 16 use crate::ReliefStyle; 17 use crate::ResizeMode; 18 use crate::Widget; 19 use glib::object::Cast; 20 use glib::object::IsA; 21 use glib::signal::connect_raw; 22 use glib::signal::SignalHandlerId; 23 use glib::translate::*; 24 use glib::StaticType; 25 use glib::ToValue; 26 use std::boxed::Box as Box_; 27 use std::fmt; 28 use std::mem::transmute; 29 30 glib::wrapper! { 31 #[doc(alias = "GtkFontButton")] 32 pub struct FontButton(Object<ffi::GtkFontButton, ffi::GtkFontButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable, FontChooser; 33 34 match fn { 35 type_ => || ffi::gtk_font_button_get_type(), 36 } 37 } 38 39 impl FontButton { 40 #[doc(alias = "gtk_font_button_new")] new() -> FontButton41 pub fn new() -> FontButton { 42 assert_initialized_main_thread!(); 43 unsafe { Widget::from_glib_none(ffi::gtk_font_button_new()).unsafe_cast() } 44 } 45 46 #[doc(alias = "gtk_font_button_new_with_font")] 47 #[doc(alias = "new_with_font")] with_font(fontname: &str) -> FontButton48 pub fn with_font(fontname: &str) -> FontButton { 49 assert_initialized_main_thread!(); 50 unsafe { 51 Widget::from_glib_none(ffi::gtk_font_button_new_with_font( 52 fontname.to_glib_none().0, 53 )) 54 .unsafe_cast() 55 } 56 } 57 58 // rustdoc-stripper-ignore-next 59 /// Creates a new builder-pattern struct instance to construct [`FontButton`] objects. 60 /// 61 /// This method returns an instance of [`FontButtonBuilder`] which can be used to create [`FontButton`] objects. builder() -> FontButtonBuilder62 pub fn builder() -> FontButtonBuilder { 63 FontButtonBuilder::default() 64 } 65 } 66 67 impl Default for FontButton { default() -> Self68 fn default() -> Self { 69 Self::new() 70 } 71 } 72 73 #[derive(Clone, Default)] 74 // rustdoc-stripper-ignore-next 75 /// A [builder-pattern] type to construct [`FontButton`] objects. 76 /// 77 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 78 pub struct FontButtonBuilder { 79 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 80 font_name: Option<String>, 81 show_size: Option<bool>, 82 show_style: Option<bool>, 83 title: Option<String>, 84 use_font: Option<bool>, 85 use_size: Option<bool>, 86 always_show_image: Option<bool>, 87 image: Option<Widget>, 88 image_position: Option<PositionType>, 89 label: Option<String>, 90 relief: Option<ReliefStyle>, 91 use_underline: Option<bool>, 92 border_width: Option<u32>, 93 child: Option<Widget>, 94 resize_mode: Option<ResizeMode>, 95 app_paintable: Option<bool>, 96 can_default: Option<bool>, 97 can_focus: Option<bool>, 98 events: Option<gdk::EventMask>, 99 expand: Option<bool>, 100 #[cfg(any(feature = "v3_20", feature = "dox"))] 101 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 102 focus_on_click: Option<bool>, 103 halign: Option<Align>, 104 has_default: Option<bool>, 105 has_focus: Option<bool>, 106 has_tooltip: Option<bool>, 107 height_request: Option<i32>, 108 hexpand: Option<bool>, 109 hexpand_set: Option<bool>, 110 is_focus: Option<bool>, 111 margin: Option<i32>, 112 margin_bottom: Option<i32>, 113 margin_end: Option<i32>, 114 margin_start: Option<i32>, 115 margin_top: Option<i32>, 116 name: Option<String>, 117 no_show_all: Option<bool>, 118 opacity: Option<f64>, 119 parent: Option<Container>, 120 receives_default: Option<bool>, 121 sensitive: Option<bool>, 122 tooltip_markup: Option<String>, 123 tooltip_text: Option<String>, 124 valign: Option<Align>, 125 vexpand: Option<bool>, 126 vexpand_set: Option<bool>, 127 visible: Option<bool>, 128 width_request: Option<i32>, 129 action_name: Option<String>, 130 action_target: Option<glib::Variant>, 131 font: Option<String>, 132 font_desc: Option<pango::FontDescription>, 133 #[cfg(any(feature = "v3_24", feature = "dox"))] 134 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 135 language: Option<String>, 136 #[cfg(any(feature = "v3_24", feature = "dox"))] 137 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 138 level: Option<FontChooserLevel>, 139 preview_text: Option<String>, 140 show_preview_entry: Option<bool>, 141 } 142 143 impl FontButtonBuilder { 144 // rustdoc-stripper-ignore-next 145 /// Create a new [`FontButtonBuilder`]. new() -> Self146 pub fn new() -> Self { 147 Self::default() 148 } 149 150 // rustdoc-stripper-ignore-next 151 /// Build the [`FontButton`]. build(self) -> FontButton152 pub fn build(self) -> FontButton { 153 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 154 if let Some(ref font_name) = self.font_name { 155 properties.push(("font-name", font_name)); 156 } 157 if let Some(ref show_size) = self.show_size { 158 properties.push(("show-size", show_size)); 159 } 160 if let Some(ref show_style) = self.show_style { 161 properties.push(("show-style", show_style)); 162 } 163 if let Some(ref title) = self.title { 164 properties.push(("title", title)); 165 } 166 if let Some(ref use_font) = self.use_font { 167 properties.push(("use-font", use_font)); 168 } 169 if let Some(ref use_size) = self.use_size { 170 properties.push(("use-size", use_size)); 171 } 172 if let Some(ref always_show_image) = self.always_show_image { 173 properties.push(("always-show-image", always_show_image)); 174 } 175 if let Some(ref image) = self.image { 176 properties.push(("image", image)); 177 } 178 if let Some(ref image_position) = self.image_position { 179 properties.push(("image-position", image_position)); 180 } 181 if let Some(ref label) = self.label { 182 properties.push(("label", label)); 183 } 184 if let Some(ref relief) = self.relief { 185 properties.push(("relief", relief)); 186 } 187 if let Some(ref use_underline) = self.use_underline { 188 properties.push(("use-underline", use_underline)); 189 } 190 if let Some(ref border_width) = self.border_width { 191 properties.push(("border-width", border_width)); 192 } 193 if let Some(ref child) = self.child { 194 properties.push(("child", child)); 195 } 196 if let Some(ref resize_mode) = self.resize_mode { 197 properties.push(("resize-mode", resize_mode)); 198 } 199 if let Some(ref app_paintable) = self.app_paintable { 200 properties.push(("app-paintable", app_paintable)); 201 } 202 if let Some(ref can_default) = self.can_default { 203 properties.push(("can-default", can_default)); 204 } 205 if let Some(ref can_focus) = self.can_focus { 206 properties.push(("can-focus", can_focus)); 207 } 208 if let Some(ref events) = self.events { 209 properties.push(("events", events)); 210 } 211 if let Some(ref expand) = self.expand { 212 properties.push(("expand", expand)); 213 } 214 #[cfg(any(feature = "v3_20", feature = "dox"))] 215 if let Some(ref focus_on_click) = self.focus_on_click { 216 properties.push(("focus-on-click", focus_on_click)); 217 } 218 if let Some(ref halign) = self.halign { 219 properties.push(("halign", halign)); 220 } 221 if let Some(ref has_default) = self.has_default { 222 properties.push(("has-default", has_default)); 223 } 224 if let Some(ref has_focus) = self.has_focus { 225 properties.push(("has-focus", has_focus)); 226 } 227 if let Some(ref has_tooltip) = self.has_tooltip { 228 properties.push(("has-tooltip", has_tooltip)); 229 } 230 if let Some(ref height_request) = self.height_request { 231 properties.push(("height-request", height_request)); 232 } 233 if let Some(ref hexpand) = self.hexpand { 234 properties.push(("hexpand", hexpand)); 235 } 236 if let Some(ref hexpand_set) = self.hexpand_set { 237 properties.push(("hexpand-set", hexpand_set)); 238 } 239 if let Some(ref is_focus) = self.is_focus { 240 properties.push(("is-focus", is_focus)); 241 } 242 if let Some(ref margin) = self.margin { 243 properties.push(("margin", margin)); 244 } 245 if let Some(ref margin_bottom) = self.margin_bottom { 246 properties.push(("margin-bottom", margin_bottom)); 247 } 248 if let Some(ref margin_end) = self.margin_end { 249 properties.push(("margin-end", margin_end)); 250 } 251 if let Some(ref margin_start) = self.margin_start { 252 properties.push(("margin-start", margin_start)); 253 } 254 if let Some(ref margin_top) = self.margin_top { 255 properties.push(("margin-top", margin_top)); 256 } 257 if let Some(ref name) = self.name { 258 properties.push(("name", name)); 259 } 260 if let Some(ref no_show_all) = self.no_show_all { 261 properties.push(("no-show-all", no_show_all)); 262 } 263 if let Some(ref opacity) = self.opacity { 264 properties.push(("opacity", opacity)); 265 } 266 if let Some(ref parent) = self.parent { 267 properties.push(("parent", parent)); 268 } 269 if let Some(ref receives_default) = self.receives_default { 270 properties.push(("receives-default", receives_default)); 271 } 272 if let Some(ref sensitive) = self.sensitive { 273 properties.push(("sensitive", sensitive)); 274 } 275 if let Some(ref tooltip_markup) = self.tooltip_markup { 276 properties.push(("tooltip-markup", tooltip_markup)); 277 } 278 if let Some(ref tooltip_text) = self.tooltip_text { 279 properties.push(("tooltip-text", tooltip_text)); 280 } 281 if let Some(ref valign) = self.valign { 282 properties.push(("valign", valign)); 283 } 284 if let Some(ref vexpand) = self.vexpand { 285 properties.push(("vexpand", vexpand)); 286 } 287 if let Some(ref vexpand_set) = self.vexpand_set { 288 properties.push(("vexpand-set", vexpand_set)); 289 } 290 if let Some(ref visible) = self.visible { 291 properties.push(("visible", visible)); 292 } 293 if let Some(ref width_request) = self.width_request { 294 properties.push(("width-request", width_request)); 295 } 296 if let Some(ref action_name) = self.action_name { 297 properties.push(("action-name", action_name)); 298 } 299 if let Some(ref action_target) = self.action_target { 300 properties.push(("action-target", action_target)); 301 } 302 if let Some(ref font) = self.font { 303 properties.push(("font", font)); 304 } 305 if let Some(ref font_desc) = self.font_desc { 306 properties.push(("font-desc", font_desc)); 307 } 308 #[cfg(any(feature = "v3_24", feature = "dox"))] 309 if let Some(ref language) = self.language { 310 properties.push(("language", language)); 311 } 312 #[cfg(any(feature = "v3_24", feature = "dox"))] 313 if let Some(ref level) = self.level { 314 properties.push(("level", level)); 315 } 316 if let Some(ref preview_text) = self.preview_text { 317 properties.push(("preview-text", preview_text)); 318 } 319 if let Some(ref show_preview_entry) = self.show_preview_entry { 320 properties.push(("show-preview-entry", show_preview_entry)); 321 } 322 glib::Object::new::<FontButton>(&properties) 323 .expect("Failed to create an instance of FontButton") 324 } 325 326 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] font_name(mut self, font_name: &str) -> Self327 pub fn font_name(mut self, font_name: &str) -> Self { 328 self.font_name = Some(font_name.to_string()); 329 self 330 } 331 show_size(mut self, show_size: bool) -> Self332 pub fn show_size(mut self, show_size: bool) -> Self { 333 self.show_size = Some(show_size); 334 self 335 } 336 show_style(mut self, show_style: bool) -> Self337 pub fn show_style(mut self, show_style: bool) -> Self { 338 self.show_style = Some(show_style); 339 self 340 } 341 title(mut self, title: &str) -> Self342 pub fn title(mut self, title: &str) -> Self { 343 self.title = Some(title.to_string()); 344 self 345 } 346 use_font(mut self, use_font: bool) -> Self347 pub fn use_font(mut self, use_font: bool) -> Self { 348 self.use_font = Some(use_font); 349 self 350 } 351 use_size(mut self, use_size: bool) -> Self352 pub fn use_size(mut self, use_size: bool) -> Self { 353 self.use_size = Some(use_size); 354 self 355 } 356 always_show_image(mut self, always_show_image: bool) -> Self357 pub fn always_show_image(mut self, always_show_image: bool) -> Self { 358 self.always_show_image = Some(always_show_image); 359 self 360 } 361 image<P: IsA<Widget>>(mut self, image: &P) -> Self362 pub fn image<P: IsA<Widget>>(mut self, image: &P) -> Self { 363 self.image = Some(image.clone().upcast()); 364 self 365 } 366 image_position(mut self, image_position: PositionType) -> Self367 pub fn image_position(mut self, image_position: PositionType) -> Self { 368 self.image_position = Some(image_position); 369 self 370 } 371 label(mut self, label: &str) -> Self372 pub fn label(mut self, label: &str) -> Self { 373 self.label = Some(label.to_string()); 374 self 375 } 376 relief(mut self, relief: ReliefStyle) -> Self377 pub fn relief(mut self, relief: ReliefStyle) -> Self { 378 self.relief = Some(relief); 379 self 380 } 381 use_underline(mut self, use_underline: bool) -> Self382 pub fn use_underline(mut self, use_underline: bool) -> Self { 383 self.use_underline = Some(use_underline); 384 self 385 } 386 border_width(mut self, border_width: u32) -> Self387 pub fn border_width(mut self, border_width: u32) -> Self { 388 self.border_width = Some(border_width); 389 self 390 } 391 child<P: IsA<Widget>>(mut self, child: &P) -> Self392 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 393 self.child = Some(child.clone().upcast()); 394 self 395 } 396 resize_mode(mut self, resize_mode: ResizeMode) -> Self397 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 398 self.resize_mode = Some(resize_mode); 399 self 400 } 401 app_paintable(mut self, app_paintable: bool) -> Self402 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 403 self.app_paintable = Some(app_paintable); 404 self 405 } 406 can_default(mut self, can_default: bool) -> Self407 pub fn can_default(mut self, can_default: bool) -> Self { 408 self.can_default = Some(can_default); 409 self 410 } 411 can_focus(mut self, can_focus: bool) -> Self412 pub fn can_focus(mut self, can_focus: bool) -> Self { 413 self.can_focus = Some(can_focus); 414 self 415 } 416 events(mut self, events: gdk::EventMask) -> Self417 pub fn events(mut self, events: gdk::EventMask) -> Self { 418 self.events = Some(events); 419 self 420 } 421 expand(mut self, expand: bool) -> Self422 pub fn expand(mut self, expand: bool) -> Self { 423 self.expand = Some(expand); 424 self 425 } 426 427 #[cfg(any(feature = "v3_20", feature = "dox"))] 428 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self429 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 430 self.focus_on_click = Some(focus_on_click); 431 self 432 } 433 halign(mut self, halign: Align) -> Self434 pub fn halign(mut self, halign: Align) -> Self { 435 self.halign = Some(halign); 436 self 437 } 438 has_default(mut self, has_default: bool) -> Self439 pub fn has_default(mut self, has_default: bool) -> Self { 440 self.has_default = Some(has_default); 441 self 442 } 443 has_focus(mut self, has_focus: bool) -> Self444 pub fn has_focus(mut self, has_focus: bool) -> Self { 445 self.has_focus = Some(has_focus); 446 self 447 } 448 has_tooltip(mut self, has_tooltip: bool) -> Self449 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 450 self.has_tooltip = Some(has_tooltip); 451 self 452 } 453 height_request(mut self, height_request: i32) -> Self454 pub fn height_request(mut self, height_request: i32) -> Self { 455 self.height_request = Some(height_request); 456 self 457 } 458 hexpand(mut self, hexpand: bool) -> Self459 pub fn hexpand(mut self, hexpand: bool) -> Self { 460 self.hexpand = Some(hexpand); 461 self 462 } 463 hexpand_set(mut self, hexpand_set: bool) -> Self464 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 465 self.hexpand_set = Some(hexpand_set); 466 self 467 } 468 is_focus(mut self, is_focus: bool) -> Self469 pub fn is_focus(mut self, is_focus: bool) -> Self { 470 self.is_focus = Some(is_focus); 471 self 472 } 473 margin(mut self, margin: i32) -> Self474 pub fn margin(mut self, margin: i32) -> Self { 475 self.margin = Some(margin); 476 self 477 } 478 margin_bottom(mut self, margin_bottom: i32) -> Self479 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 480 self.margin_bottom = Some(margin_bottom); 481 self 482 } 483 margin_end(mut self, margin_end: i32) -> Self484 pub fn margin_end(mut self, margin_end: i32) -> Self { 485 self.margin_end = Some(margin_end); 486 self 487 } 488 margin_start(mut self, margin_start: i32) -> Self489 pub fn margin_start(mut self, margin_start: i32) -> Self { 490 self.margin_start = Some(margin_start); 491 self 492 } 493 margin_top(mut self, margin_top: i32) -> Self494 pub fn margin_top(mut self, margin_top: i32) -> Self { 495 self.margin_top = Some(margin_top); 496 self 497 } 498 name(mut self, name: &str) -> Self499 pub fn name(mut self, name: &str) -> Self { 500 self.name = Some(name.to_string()); 501 self 502 } 503 no_show_all(mut self, no_show_all: bool) -> Self504 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 505 self.no_show_all = Some(no_show_all); 506 self 507 } 508 opacity(mut self, opacity: f64) -> Self509 pub fn opacity(mut self, opacity: f64) -> Self { 510 self.opacity = Some(opacity); 511 self 512 } 513 parent<P: IsA<Container>>(mut self, parent: &P) -> Self514 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 515 self.parent = Some(parent.clone().upcast()); 516 self 517 } 518 receives_default(mut self, receives_default: bool) -> Self519 pub fn receives_default(mut self, receives_default: bool) -> Self { 520 self.receives_default = Some(receives_default); 521 self 522 } 523 sensitive(mut self, sensitive: bool) -> Self524 pub fn sensitive(mut self, sensitive: bool) -> Self { 525 self.sensitive = Some(sensitive); 526 self 527 } 528 tooltip_markup(mut self, tooltip_markup: &str) -> Self529 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 530 self.tooltip_markup = Some(tooltip_markup.to_string()); 531 self 532 } 533 tooltip_text(mut self, tooltip_text: &str) -> Self534 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 535 self.tooltip_text = Some(tooltip_text.to_string()); 536 self 537 } 538 valign(mut self, valign: Align) -> Self539 pub fn valign(mut self, valign: Align) -> Self { 540 self.valign = Some(valign); 541 self 542 } 543 vexpand(mut self, vexpand: bool) -> Self544 pub fn vexpand(mut self, vexpand: bool) -> Self { 545 self.vexpand = Some(vexpand); 546 self 547 } 548 vexpand_set(mut self, vexpand_set: bool) -> Self549 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 550 self.vexpand_set = Some(vexpand_set); 551 self 552 } 553 visible(mut self, visible: bool) -> Self554 pub fn visible(mut self, visible: bool) -> Self { 555 self.visible = Some(visible); 556 self 557 } 558 width_request(mut self, width_request: i32) -> Self559 pub fn width_request(mut self, width_request: i32) -> Self { 560 self.width_request = Some(width_request); 561 self 562 } 563 action_name(mut self, action_name: &str) -> Self564 pub fn action_name(mut self, action_name: &str) -> Self { 565 self.action_name = Some(action_name.to_string()); 566 self 567 } 568 action_target(mut self, action_target: &glib::Variant) -> Self569 pub fn action_target(mut self, action_target: &glib::Variant) -> Self { 570 self.action_target = Some(action_target.clone()); 571 self 572 } 573 font(mut self, font: &str) -> Self574 pub fn font(mut self, font: &str) -> Self { 575 self.font = Some(font.to_string()); 576 self 577 } 578 font_desc(mut self, font_desc: &pango::FontDescription) -> Self579 pub fn font_desc(mut self, font_desc: &pango::FontDescription) -> Self { 580 self.font_desc = Some(font_desc.clone()); 581 self 582 } 583 584 #[cfg(any(feature = "v3_24", feature = "dox"))] 585 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] language(mut self, language: &str) -> Self586 pub fn language(mut self, language: &str) -> Self { 587 self.language = Some(language.to_string()); 588 self 589 } 590 591 #[cfg(any(feature = "v3_24", feature = "dox"))] 592 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] level(mut self, level: FontChooserLevel) -> Self593 pub fn level(mut self, level: FontChooserLevel) -> Self { 594 self.level = Some(level); 595 self 596 } 597 preview_text(mut self, preview_text: &str) -> Self598 pub fn preview_text(mut self, preview_text: &str) -> Self { 599 self.preview_text = Some(preview_text.to_string()); 600 self 601 } 602 show_preview_entry(mut self, show_preview_entry: bool) -> Self603 pub fn show_preview_entry(mut self, show_preview_entry: bool) -> Self { 604 self.show_preview_entry = Some(show_preview_entry); 605 self 606 } 607 } 608 609 pub const NONE_FONT_BUTTON: Option<&FontButton> = None; 610 611 pub trait FontButtonExt: 'static { 612 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 613 #[doc(alias = "gtk_font_button_get_font_name")] 614 #[doc(alias = "get_font_name")] font_name(&self) -> Option<glib::GString>615 fn font_name(&self) -> Option<glib::GString>; 616 617 #[doc(alias = "gtk_font_button_get_show_size")] 618 #[doc(alias = "get_show_size")] shows_size(&self) -> bool619 fn shows_size(&self) -> bool; 620 621 #[doc(alias = "gtk_font_button_get_show_style")] 622 #[doc(alias = "get_show_style")] shows_style(&self) -> bool623 fn shows_style(&self) -> bool; 624 625 #[doc(alias = "gtk_font_button_get_title")] 626 #[doc(alias = "get_title")] title(&self) -> Option<glib::GString>627 fn title(&self) -> Option<glib::GString>; 628 629 #[doc(alias = "gtk_font_button_get_use_font")] 630 #[doc(alias = "get_use_font")] uses_font(&self) -> bool631 fn uses_font(&self) -> bool; 632 633 #[doc(alias = "gtk_font_button_get_use_size")] 634 #[doc(alias = "get_use_size")] uses_size(&self) -> bool635 fn uses_size(&self) -> bool; 636 637 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 638 #[doc(alias = "gtk_font_button_set_font_name")] set_font_name(&self, fontname: &str) -> bool639 fn set_font_name(&self, fontname: &str) -> bool; 640 641 #[doc(alias = "gtk_font_button_set_show_size")] set_show_size(&self, show_size: bool)642 fn set_show_size(&self, show_size: bool); 643 644 #[doc(alias = "gtk_font_button_set_show_style")] set_show_style(&self, show_style: bool)645 fn set_show_style(&self, show_style: bool); 646 647 #[doc(alias = "gtk_font_button_set_title")] set_title(&self, title: &str)648 fn set_title(&self, title: &str); 649 650 #[doc(alias = "gtk_font_button_set_use_font")] set_use_font(&self, use_font: bool)651 fn set_use_font(&self, use_font: bool); 652 653 #[doc(alias = "gtk_font_button_set_use_size")] set_use_size(&self, use_size: bool)654 fn set_use_size(&self, use_size: bool); 655 656 #[doc(alias = "font-set")] connect_font_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId657 fn connect_font_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 658 659 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 660 #[doc(alias = "font-name")] connect_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId661 fn connect_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 662 663 #[doc(alias = "show-size")] connect_show_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId664 fn connect_show_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 665 666 #[doc(alias = "show-style")] connect_show_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId667 fn connect_show_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 668 669 #[doc(alias = "title")] connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId670 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 671 672 #[doc(alias = "use-font")] connect_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId673 fn connect_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 674 675 #[doc(alias = "use-size")] connect_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId676 fn connect_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 677 } 678 679 impl<O: IsA<FontButton>> FontButtonExt for O { font_name(&self) -> Option<glib::GString>680 fn font_name(&self) -> Option<glib::GString> { 681 unsafe { 682 from_glib_none(ffi::gtk_font_button_get_font_name( 683 self.as_ref().to_glib_none().0, 684 )) 685 } 686 } 687 shows_size(&self) -> bool688 fn shows_size(&self) -> bool { 689 unsafe { 690 from_glib(ffi::gtk_font_button_get_show_size( 691 self.as_ref().to_glib_none().0, 692 )) 693 } 694 } 695 shows_style(&self) -> bool696 fn shows_style(&self) -> bool { 697 unsafe { 698 from_glib(ffi::gtk_font_button_get_show_style( 699 self.as_ref().to_glib_none().0, 700 )) 701 } 702 } 703 title(&self) -> Option<glib::GString>704 fn title(&self) -> Option<glib::GString> { 705 unsafe { 706 from_glib_none(ffi::gtk_font_button_get_title( 707 self.as_ref().to_glib_none().0, 708 )) 709 } 710 } 711 uses_font(&self) -> bool712 fn uses_font(&self) -> bool { 713 unsafe { 714 from_glib(ffi::gtk_font_button_get_use_font( 715 self.as_ref().to_glib_none().0, 716 )) 717 } 718 } 719 uses_size(&self) -> bool720 fn uses_size(&self) -> bool { 721 unsafe { 722 from_glib(ffi::gtk_font_button_get_use_size( 723 self.as_ref().to_glib_none().0, 724 )) 725 } 726 } 727 set_font_name(&self, fontname: &str) -> bool728 fn set_font_name(&self, fontname: &str) -> bool { 729 unsafe { 730 from_glib(ffi::gtk_font_button_set_font_name( 731 self.as_ref().to_glib_none().0, 732 fontname.to_glib_none().0, 733 )) 734 } 735 } 736 set_show_size(&self, show_size: bool)737 fn set_show_size(&self, show_size: bool) { 738 unsafe { 739 ffi::gtk_font_button_set_show_size( 740 self.as_ref().to_glib_none().0, 741 show_size.into_glib(), 742 ); 743 } 744 } 745 set_show_style(&self, show_style: bool)746 fn set_show_style(&self, show_style: bool) { 747 unsafe { 748 ffi::gtk_font_button_set_show_style( 749 self.as_ref().to_glib_none().0, 750 show_style.into_glib(), 751 ); 752 } 753 } 754 set_title(&self, title: &str)755 fn set_title(&self, title: &str) { 756 unsafe { 757 ffi::gtk_font_button_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0); 758 } 759 } 760 set_use_font(&self, use_font: bool)761 fn set_use_font(&self, use_font: bool) { 762 unsafe { 763 ffi::gtk_font_button_set_use_font(self.as_ref().to_glib_none().0, use_font.into_glib()); 764 } 765 } 766 set_use_size(&self, use_size: bool)767 fn set_use_size(&self, use_size: bool) { 768 unsafe { 769 ffi::gtk_font_button_set_use_size(self.as_ref().to_glib_none().0, use_size.into_glib()); 770 } 771 } 772 connect_font_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId773 fn connect_font_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 774 unsafe extern "C" fn font_set_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>( 775 this: *mut ffi::GtkFontButton, 776 f: glib::ffi::gpointer, 777 ) { 778 let f: &F = &*(f as *const F); 779 f(FontButton::from_glib_borrow(this).unsafe_cast_ref()) 780 } 781 unsafe { 782 let f: Box_<F> = Box_::new(f); 783 connect_raw( 784 self.as_ptr() as *mut _, 785 b"font-set\0".as_ptr() as *const _, 786 Some(transmute::<_, unsafe extern "C" fn()>( 787 font_set_trampoline::<Self, F> as *const (), 788 )), 789 Box_::into_raw(f), 790 ) 791 } 792 } 793 connect_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId794 fn connect_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 795 unsafe extern "C" fn notify_font_name_trampoline< 796 P: IsA<FontButton>, 797 F: Fn(&P) + 'static, 798 >( 799 this: *mut ffi::GtkFontButton, 800 _param_spec: glib::ffi::gpointer, 801 f: glib::ffi::gpointer, 802 ) { 803 let f: &F = &*(f as *const F); 804 f(FontButton::from_glib_borrow(this).unsafe_cast_ref()) 805 } 806 unsafe { 807 let f: Box_<F> = Box_::new(f); 808 connect_raw( 809 self.as_ptr() as *mut _, 810 b"notify::font-name\0".as_ptr() as *const _, 811 Some(transmute::<_, unsafe extern "C" fn()>( 812 notify_font_name_trampoline::<Self, F> as *const (), 813 )), 814 Box_::into_raw(f), 815 ) 816 } 817 } 818 connect_show_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId819 fn connect_show_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 820 unsafe extern "C" fn notify_show_size_trampoline< 821 P: IsA<FontButton>, 822 F: Fn(&P) + 'static, 823 >( 824 this: *mut ffi::GtkFontButton, 825 _param_spec: glib::ffi::gpointer, 826 f: glib::ffi::gpointer, 827 ) { 828 let f: &F = &*(f as *const F); 829 f(FontButton::from_glib_borrow(this).unsafe_cast_ref()) 830 } 831 unsafe { 832 let f: Box_<F> = Box_::new(f); 833 connect_raw( 834 self.as_ptr() as *mut _, 835 b"notify::show-size\0".as_ptr() as *const _, 836 Some(transmute::<_, unsafe extern "C" fn()>( 837 notify_show_size_trampoline::<Self, F> as *const (), 838 )), 839 Box_::into_raw(f), 840 ) 841 } 842 } 843 connect_show_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId844 fn connect_show_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 845 unsafe extern "C" fn notify_show_style_trampoline< 846 P: IsA<FontButton>, 847 F: Fn(&P) + 'static, 848 >( 849 this: *mut ffi::GtkFontButton, 850 _param_spec: glib::ffi::gpointer, 851 f: glib::ffi::gpointer, 852 ) { 853 let f: &F = &*(f as *const F); 854 f(FontButton::from_glib_borrow(this).unsafe_cast_ref()) 855 } 856 unsafe { 857 let f: Box_<F> = Box_::new(f); 858 connect_raw( 859 self.as_ptr() as *mut _, 860 b"notify::show-style\0".as_ptr() as *const _, 861 Some(transmute::<_, unsafe extern "C" fn()>( 862 notify_show_style_trampoline::<Self, F> as *const (), 863 )), 864 Box_::into_raw(f), 865 ) 866 } 867 } 868 connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId869 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 870 unsafe extern "C" fn notify_title_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>( 871 this: *mut ffi::GtkFontButton, 872 _param_spec: glib::ffi::gpointer, 873 f: glib::ffi::gpointer, 874 ) { 875 let f: &F = &*(f as *const F); 876 f(FontButton::from_glib_borrow(this).unsafe_cast_ref()) 877 } 878 unsafe { 879 let f: Box_<F> = Box_::new(f); 880 connect_raw( 881 self.as_ptr() as *mut _, 882 b"notify::title\0".as_ptr() as *const _, 883 Some(transmute::<_, unsafe extern "C" fn()>( 884 notify_title_trampoline::<Self, F> as *const (), 885 )), 886 Box_::into_raw(f), 887 ) 888 } 889 } 890 connect_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId891 fn connect_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 892 unsafe extern "C" fn notify_use_font_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>( 893 this: *mut ffi::GtkFontButton, 894 _param_spec: glib::ffi::gpointer, 895 f: glib::ffi::gpointer, 896 ) { 897 let f: &F = &*(f as *const F); 898 f(FontButton::from_glib_borrow(this).unsafe_cast_ref()) 899 } 900 unsafe { 901 let f: Box_<F> = Box_::new(f); 902 connect_raw( 903 self.as_ptr() as *mut _, 904 b"notify::use-font\0".as_ptr() as *const _, 905 Some(transmute::<_, unsafe extern "C" fn()>( 906 notify_use_font_trampoline::<Self, F> as *const (), 907 )), 908 Box_::into_raw(f), 909 ) 910 } 911 } 912 connect_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId913 fn connect_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 914 unsafe extern "C" fn notify_use_size_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>( 915 this: *mut ffi::GtkFontButton, 916 _param_spec: glib::ffi::gpointer, 917 f: glib::ffi::gpointer, 918 ) { 919 let f: &F = &*(f as *const F); 920 f(FontButton::from_glib_borrow(this).unsafe_cast_ref()) 921 } 922 unsafe { 923 let f: Box_<F> = Box_::new(f); 924 connect_raw( 925 self.as_ptr() as *mut _, 926 b"notify::use-size\0".as_ptr() as *const _, 927 Some(transmute::<_, unsafe extern "C" fn()>( 928 notify_use_size_trampoline::<Self, F> as *const (), 929 )), 930 Box_::into_raw(f), 931 ) 932 } 933 } 934 } 935 936 impl fmt::Display for FontButton { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result937 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 938 f.write_str("FontButton") 939 } 940 } 941