gtk4/auto/font_chooser.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#![allow(deprecated)]
use crate::{ffi, FontChooserLevel};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// [`FontChooser`][crate::FontChooser] is an interface that can be implemented by widgets
/// for choosing fonts.
///
/// In GTK, the main objects that implement this interface are
/// [`FontChooserWidget`][crate::FontChooserWidget], [`FontChooserDialog`][crate::FontChooserDialog] and
/// [`FontButton`][crate::FontButton].
///
/// ## Properties
///
///
/// #### `font`
/// The font description as a string, e.g. "Sans Italic 12".
///
/// Readable | Writeable
///
///
/// #### `font-desc`
/// The font description as a [`pango::FontDescription`][crate::pango::FontDescription].
///
/// Readable | Writeable
///
///
/// #### `font-features`
/// The selected font features.
///
/// The format of the string is compatible with
/// CSS and with Pango attributes.
///
/// Readable
///
///
/// #### `language`
/// The language for which the font features were selected.
///
/// Readable | Writeable
///
///
/// #### `level`
/// The level of granularity to offer for selecting fonts.
///
/// Readable | Writeable
///
///
/// #### `preview-text`
/// The string with which to preview the font.
///
/// Readable | Writeable
///
///
/// #### `show-preview-entry`
/// Whether to show an entry to change the preview text.
///
/// Readable | Writeable
///
/// ## Signals
///
///
/// #### `font-activated`
/// Emitted when a font is activated.
///
/// This usually happens when the user double clicks an item,
/// or an item is selected and the user presses one of the keys
/// Space, Shift+Space, Return or Enter.
///
///
///
/// # Implements
///
/// [`FontChooserExt`][trait@crate::prelude::FontChooserExt], [`FontChooserExtManual`][trait@crate::prelude::FontChooserExtManual]
#[doc(alias = "GtkFontChooser")]
pub struct FontChooser(Interface<ffi::GtkFontChooser, ffi::GtkFontChooserIface>);
match fn {
type_ => || ffi::gtk_font_chooser_get_type(),
}
}
impl FontChooser {
pub const NONE: Option<&'static FontChooser> = None;
}
/// Trait containing all [`struct@FontChooser`] methods.
///
/// # Implementors
///
/// [`FontButton`][struct@crate::FontButton], [`FontChooserDialog`][struct@crate::FontChooserDialog], [`FontChooserWidget`][struct@crate::FontChooserWidget], [`FontChooser`][struct@crate::FontChooser]
pub trait FontChooserExt: IsA<FontChooser> + 'static {
/// Gets the currently-selected font name.
///
/// Note that this can be a different string than what you set with
/// [`set_font()`][Self::set_font()], as the font chooser widget may
/// normalize font names and thus return a string with a different
/// structure. For example, “Helvetica Italic Bold 12” could be
/// normalized to “Helvetica Bold Italic 12”.
///
/// Use `Pango::FontDescription::equal()` if you want to compare two
/// font descriptions.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// A string with the name
/// of the current font
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_font")]
#[doc(alias = "get_font")]
fn font(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::gtk_font_chooser_get_font(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the currently-selected font.
///
/// Note that this can be a different string than what you set with
/// [`set_font()`][Self::set_font()], as the font chooser widget may
/// normalize font names and thus return a string with a different
/// structure. For example, “Helvetica Italic Bold 12” could be
/// normalized to “Helvetica Bold Italic 12”.
///
/// Use `Pango::FontDescription::equal()` if you want to compare two
/// font descriptions.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// A [`pango::FontDescription`][crate::pango::FontDescription] for the
/// current font
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_font_desc")]
#[doc(alias = "get_font_desc")]
#[doc(alias = "font-desc")]
fn font_desc(&self) -> Option<pango::FontDescription> {
unsafe {
from_glib_full(ffi::gtk_font_chooser_get_font_desc(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the [`pango::FontFace`][crate::pango::FontFace] representing the selected font group
/// details (i.e. family, slant, weight, width, etc).
///
/// If the selected font is not installed, returns [`None`].
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// A [`pango::FontFace`][crate::pango::FontFace] representing the
/// selected font group details
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_font_face")]
#[doc(alias = "get_font_face")]
fn font_face(&self) -> Option<pango::FontFace> {
unsafe {
from_glib_none(ffi::gtk_font_chooser_get_font_face(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the [`pango::FontFamily`][crate::pango::FontFamily] representing the selected font family.
///
/// Font families are a collection of font faces.
///
/// If the selected font is not installed, returns [`None`].
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// A [`pango::FontFamily`][crate::pango::FontFamily] representing the
/// selected font family
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_font_family")]
#[doc(alias = "get_font_family")]
fn font_family(&self) -> Option<pango::FontFamily> {
unsafe {
from_glib_none(ffi::gtk_font_chooser_get_font_family(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the currently-selected font features.
///
/// The format of the returned string is compatible with the
/// [CSS font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc).
/// It can be passed to `Pango::AttrFontFeatures::new()`.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// the currently selected font features
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_font_features")]
#[doc(alias = "get_font_features")]
#[doc(alias = "font-features")]
fn font_features(&self) -> glib::GString {
unsafe {
from_glib_full(ffi::gtk_font_chooser_get_font_features(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the custom font map of this font chooser widget,
/// or [`None`] if it does not have one.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// a [`pango::FontMap`][crate::pango::FontMap]
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_font_map")]
#[doc(alias = "get_font_map")]
fn font_map(&self) -> Option<pango::FontMap> {
unsafe {
from_glib_full(ffi::gtk_font_chooser_get_font_map(
self.as_ref().to_glib_none().0,
))
}
}
/// The selected font size.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// A n integer representing the selected font size,
/// or -1 if no font size is selected.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_font_size")]
#[doc(alias = "get_font_size")]
fn font_size(&self) -> i32 {
unsafe { ffi::gtk_font_chooser_get_font_size(self.as_ref().to_glib_none().0) }
}
/// Gets the language that is used for font features.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// the currently selected language
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_language")]
#[doc(alias = "get_language")]
fn language(&self) -> glib::GString {
unsafe {
from_glib_full(ffi::gtk_font_chooser_get_language(
self.as_ref().to_glib_none().0,
))
}
}
/// Returns the current level of granularity for selecting fonts.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// the current granularity level
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_level")]
#[doc(alias = "get_level")]
fn level(&self) -> FontChooserLevel {
unsafe {
from_glib(ffi::gtk_font_chooser_get_level(
self.as_ref().to_glib_none().0,
))
}
}
/// Gets the text displayed in the preview area.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// the text displayed in the preview area
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_preview_text")]
#[doc(alias = "get_preview_text")]
#[doc(alias = "preview-text")]
fn preview_text(&self) -> glib::GString {
unsafe {
from_glib_full(ffi::gtk_font_chooser_get_preview_text(
self.as_ref().to_glib_none().0,
))
}
}
/// Returns whether the preview entry is shown or not.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
///
/// # Returns
///
/// [`true`] if the preview entry is shown or [`false`] if it is hidden.
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_get_show_preview_entry")]
#[doc(alias = "get_show_preview_entry")]
#[doc(alias = "show-preview-entry")]
fn shows_preview_entry(&self) -> bool {
unsafe {
from_glib(ffi::gtk_font_chooser_get_show_preview_entry(
self.as_ref().to_glib_none().0,
))
}
}
/// Adds a filter function that decides which fonts to display
/// in the font chooser.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `filter`
/// a `GtkFontFilterFunc`
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_filter_func")]
fn set_filter_func<P: Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>(
&self,
filter: P,
) {
let filter_data: Box_<P> = Box_::new(filter);
unsafe extern "C" fn filter_func<
P: Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static,
>(
family: *const pango::ffi::PangoFontFamily,
face: *const pango::ffi::PangoFontFace,
data: glib::ffi::gpointer,
) -> glib::ffi::gboolean {
let family = from_glib_borrow(family);
let face = from_glib_borrow(face);
let callback = &*(data as *mut P);
(*callback)(&family, &face).into_glib()
}
let filter = Some(filter_func::<P> as _);
unsafe extern "C" fn destroy_func<
P: Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static,
>(
data: glib::ffi::gpointer,
) {
let _callback = Box_::from_raw(data as *mut P);
}
let destroy_call3 = Some(destroy_func::<P> as _);
let super_callback0: Box_<P> = filter_data;
unsafe {
ffi::gtk_font_chooser_set_filter_func(
self.as_ref().to_glib_none().0,
filter,
Box_::into_raw(super_callback0) as *mut _,
destroy_call3,
);
}
}
/// Sets the currently-selected font.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `fontname`
/// a font name like “Helvetica 12” or “Times Bold 18”
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_font")]
#[doc(alias = "font")]
fn set_font(&self, fontname: &str) {
unsafe {
ffi::gtk_font_chooser_set_font(
self.as_ref().to_glib_none().0,
fontname.to_glib_none().0,
);
}
}
/// Sets the currently-selected font from @font_desc.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `font_desc`
/// a [`pango::FontDescription`][crate::pango::FontDescription]
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_font_desc")]
#[doc(alias = "font-desc")]
fn set_font_desc(&self, font_desc: &pango::FontDescription) {
unsafe {
ffi::gtk_font_chooser_set_font_desc(
self.as_ref().to_glib_none().0,
font_desc.to_glib_none().0,
);
}
}
/// Sets a custom font map to use for this font chooser widget.
///
/// A custom font map can be used to present application-specific
/// fonts instead of or in addition to the normal system fonts.
///
/// **⚠️ The following code is in c ⚠️**
///
/// ```c
/// FcConfig *config;
/// PangoFontMap *fontmap;
///
/// config = FcInitLoadConfigAndFonts ();
/// FcConfigAppFontAddFile (config, my_app_font_file);
///
/// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
/// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
///
/// gtk_font_chooser_set_font_map (font_chooser, fontmap);
/// ```
///
/// Note that other GTK widgets will only be able to use the
/// application-specific font if it is present in the font map they use:
///
/// **⚠️ The following code is in c ⚠️**
///
/// ```c
/// context = gtk_widget_get_pango_context (label);
/// pango_context_set_font_map (context, fontmap);
/// ```
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `fontmap`
/// a [`pango::FontMap`][crate::pango::FontMap]
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_font_map")]
fn set_font_map(&self, fontmap: Option<&impl IsA<pango::FontMap>>) {
unsafe {
ffi::gtk_font_chooser_set_font_map(
self.as_ref().to_glib_none().0,
fontmap.map(|p| p.as_ref()).to_glib_none().0,
);
}
}
/// Sets the language to use for font features.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `language`
/// a language
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_language")]
#[doc(alias = "language")]
fn set_language(&self, language: &str) {
unsafe {
ffi::gtk_font_chooser_set_language(
self.as_ref().to_glib_none().0,
language.to_glib_none().0,
);
}
}
/// Sets the desired level of granularity for selecting fonts.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `level`
/// the desired level of granularity
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_level")]
#[doc(alias = "level")]
fn set_level(&self, level: FontChooserLevel) {
unsafe {
ffi::gtk_font_chooser_set_level(self.as_ref().to_glib_none().0, level.into_glib());
}
}
/// Sets the text displayed in the preview area.
///
/// The @text is used to show how the selected font looks.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `text`
/// the text to display in the preview area
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_preview_text")]
#[doc(alias = "preview-text")]
fn set_preview_text(&self, text: &str) {
unsafe {
ffi::gtk_font_chooser_set_preview_text(
self.as_ref().to_glib_none().0,
text.to_glib_none().0,
);
}
}
/// Shows or hides the editable preview entry.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton]
/// instead
/// ## `show_preview_entry`
/// whether to show the editable preview entry or not
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_font_chooser_set_show_preview_entry")]
#[doc(alias = "show-preview-entry")]
fn set_show_preview_entry(&self, show_preview_entry: bool) {
unsafe {
ffi::gtk_font_chooser_set_show_preview_entry(
self.as_ref().to_glib_none().0,
show_preview_entry.into_glib(),
);
}
}
/// Emitted when a font is activated.
///
/// This usually happens when the user double clicks an item,
/// or an item is selected and the user presses one of the keys
/// Space, Shift+Space, Return or Enter.
///
/// # Deprecated since 4.10
///
/// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
/// ## `fontname`
/// the font name
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "font-activated")]
fn connect_font_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn font_activated_trampoline<
P: IsA<FontChooser>,
F: Fn(&P, &str) + 'static,
>(
this: *mut ffi::GtkFontChooser,
fontname: *mut std::ffi::c_char,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(
FontChooser::from_glib_borrow(this).unsafe_cast_ref(),
&glib::GString::from_glib_borrow(fontname),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"font-activated\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
font_activated_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "font")]
fn connect_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_font_trampoline<P: IsA<FontChooser>, F: Fn(&P) + 'static>(
this: *mut ffi::GtkFontChooser,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::font\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_font_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "font-desc")]
fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_font_desc_trampoline<
P: IsA<FontChooser>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GtkFontChooser,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::font-desc\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_font_desc_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "font-features")]
fn connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_font_features_trampoline<
P: IsA<FontChooser>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GtkFontChooser,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::font-features\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_font_features_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "language")]
fn connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_language_trampoline<
P: IsA<FontChooser>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GtkFontChooser,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::language\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_language_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "level")]
fn connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_level_trampoline<P: IsA<FontChooser>, F: Fn(&P) + 'static>(
this: *mut ffi::GtkFontChooser,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::level\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_level_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "preview-text")]
fn connect_preview_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_preview_text_trampoline<
P: IsA<FontChooser>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GtkFontChooser,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::preview-text\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_preview_text_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[doc(alias = "show-preview-entry")]
fn connect_show_preview_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_show_preview_entry_trampoline<
P: IsA<FontChooser>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GtkFontChooser,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::show-preview-entry\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_show_preview_entry_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<FontChooser>> FontChooserExt for O {}