gtk4/auto/symbolic_paintable.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
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// An interface that supports symbolic colors in paintables.
10 ///
11 /// [`gdk::Paintable`][crate::gdk::Paintable]s implementing the interface will have the
12 /// `vfunc::Gtk::SymbolicPaintable::snapshot_symbolic` function called and
13 /// have the colors for drawing symbolic icons passed. At least 4 colors are guaranteed
14 /// to be passed every time.
15 ///
16 /// These 4 colors are the foreground color, and the colors to use for errors, warnings
17 /// and success information in that order.
18 ///
19 /// More colors may be added in the future.
20 ///
21 /// # Implements
22 ///
23 /// [`SymbolicPaintableExt`][trait@crate::prelude::SymbolicPaintableExt], [`trait@gdk::prelude::PaintableExt`]
24 #[doc(alias = "GtkSymbolicPaintable")]
25 pub struct SymbolicPaintable(Interface<ffi::GtkSymbolicPaintable, ffi::GtkSymbolicPaintableInterface>) @requires gdk::Paintable;
26
27 match fn {
28 type_ => || ffi::gtk_symbolic_paintable_get_type(),
29 }
30}
31
32impl SymbolicPaintable {
33 pub const NONE: Option<&'static SymbolicPaintable> = None;
34}
35
36/// Trait containing all [`struct@SymbolicPaintable`] methods.
37///
38/// # Implementors
39///
40/// [`IconPaintable`][struct@crate::IconPaintable], [`SymbolicPaintable`][struct@crate::SymbolicPaintable]
41pub trait SymbolicPaintableExt: IsA<SymbolicPaintable> + 'static {
42 /// Snapshots the paintable with the given colors.
43 ///
44 /// If less than 4 colors are provided, GTK will pad the array with default
45 /// colors.
46 /// ## `snapshot`
47 /// a [`gdk::Snapshot`][crate::gdk::Snapshot] to snapshot to
48 /// ## `width`
49 /// width to snapshot in
50 /// ## `height`
51 /// height to snapshot in
52 /// ## `colors`
53 /// a pointer to an array of colors
54 #[doc(alias = "gtk_symbolic_paintable_snapshot_symbolic")]
55 fn snapshot_symbolic(
56 &self,
57 snapshot: &impl IsA<gdk::Snapshot>,
58 width: f64,
59 height: f64,
60 colors: &[gdk::RGBA],
61 ) {
62 let n_colors = colors.len() as _;
63 unsafe {
64 ffi::gtk_symbolic_paintable_snapshot_symbolic(
65 self.as_ref().to_glib_none().0,
66 snapshot.as_ref().to_glib_none().0,
67 width,
68 height,
69 colors.to_glib_none().0,
70 n_colors,
71 );
72 }
73 }
74}
75
76impl<O: IsA<SymbolicPaintable>> SymbolicPaintableExt for O {}