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