libadwaita/auto/property_animation_target.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{AnimationTarget, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// An [`AnimationTarget`][crate::AnimationTarget] changing the value of a property of a
11 /// [`glib::Object`][crate::glib::Object] instance.
12 ///
13 /// ## Properties
14 ///
15 ///
16 /// #### `object`
17 /// The object whose property will be animated.
18 ///
19 /// The [`PropertyAnimationTarget`][crate::PropertyAnimationTarget] instance does not hold a strong reference
20 /// on the object; make sure the object is kept alive throughout the target's
21 /// lifetime.
22 ///
23 /// Readable | Writeable | Construct Only
24 ///
25 ///
26 /// #### `pspec`
27 /// The `GParamSpec` of the property to be animated.
28 ///
29 /// Readable | Writeable | Construct Only
30 ///
31 /// # Implements
32 ///
33 /// [`AnimationTargetExt`][trait@crate::prelude::AnimationTargetExt], [`trait@glib::ObjectExt`]
34 #[doc(alias = "AdwPropertyAnimationTarget")]
35 pub struct PropertyAnimationTarget(Object<ffi::AdwPropertyAnimationTarget, ffi::AdwPropertyAnimationTargetClass>) @extends AnimationTarget;
36
37 match fn {
38 type_ => || ffi::adw_property_animation_target_get_type(),
39 }
40}
41
42impl PropertyAnimationTarget {
43 /// Creates a new [`PropertyAnimationTarget`][crate::PropertyAnimationTarget] for the @property_name property on
44 /// @object.
45 /// ## `object`
46 /// an object to be animated
47 /// ## `property_name`
48 /// the name of the property on @object to animate
49 ///
50 /// # Returns
51 ///
52 /// the newly created [`PropertyAnimationTarget`][crate::PropertyAnimationTarget]
53 #[doc(alias = "adw_property_animation_target_new")]
54 pub fn new(object: &impl IsA<glib::Object>, property_name: &str) -> PropertyAnimationTarget {
55 assert_initialized_main_thread!();
56 unsafe {
57 AnimationTarget::from_glib_full(ffi::adw_property_animation_target_new(
58 object.as_ref().to_glib_none().0,
59 property_name.to_glib_none().0,
60 ))
61 .unsafe_cast()
62 }
63 }
64
65 /// Creates a new [`PropertyAnimationTarget`][crate::PropertyAnimationTarget] for the @pspec property on
66 /// @object.
67 /// ## `object`
68 /// an object to be animated
69 /// ## `pspec`
70 /// the param spec of the property on @object to animate
71 ///
72 /// # Returns
73 ///
74 /// new newly created [`PropertyAnimationTarget`][crate::PropertyAnimationTarget]
75 #[doc(alias = "adw_property_animation_target_new_for_pspec")]
76 #[doc(alias = "new_for_pspec")]
77 pub fn for_pspec(
78 object: &impl IsA<glib::Object>,
79 pspec: impl AsRef<glib::ParamSpec>,
80 ) -> PropertyAnimationTarget {
81 assert_initialized_main_thread!();
82 unsafe {
83 AnimationTarget::from_glib_full(ffi::adw_property_animation_target_new_for_pspec(
84 object.as_ref().to_glib_none().0,
85 pspec.as_ref().to_glib_none().0,
86 ))
87 .unsafe_cast()
88 }
89 }
90
91 /// Gets the object animated by @self.
92 ///
93 /// The [`PropertyAnimationTarget`][crate::PropertyAnimationTarget] instance does not hold a strong reference on
94 /// the object; make sure the object is kept alive throughout the target's
95 /// lifetime.
96 ///
97 /// # Returns
98 ///
99 /// the animated object
100 #[doc(alias = "adw_property_animation_target_get_object")]
101 #[doc(alias = "get_object")]
102 pub fn object(&self) -> glib::Object {
103 unsafe {
104 from_glib_none(ffi::adw_property_animation_target_get_object(
105 self.to_glib_none().0,
106 ))
107 }
108 }
109
110 /// Gets the `GParamSpec` of the property animated by @self.
111 ///
112 /// # Returns
113 ///
114 /// the animated property's `GParamSpec`
115 #[doc(alias = "adw_property_animation_target_get_pspec")]
116 #[doc(alias = "get_pspec")]
117 pub fn pspec(&self) -> glib::ParamSpec {
118 unsafe {
119 from_glib_none(ffi::adw_property_animation_target_get_pspec(
120 self.to_glib_none().0,
121 ))
122 }
123 }
124}