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