gstreamer_editing_services/auto/
title_source.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// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{
8    ffi, Extractable, MetaContainer, Source, TextHAlign, TextVAlign, TimelineElement, TrackElement,
9    VideoSource,
10};
11use glib::{prelude::*, translate::*};
12
13glib::wrapper! {
14    /// [`TitleSource`][crate::TitleSource] is a GESTimelineElement that implements the notion
15    /// of titles in GES.
16    ///
17    /// # Implements
18    ///
19    /// [`TitleSourceExt`][trait@crate::prelude::TitleSourceExt], [`VideoSourceExt`][trait@crate::prelude::VideoSourceExt], [`SourceExt`][trait@crate::prelude::SourceExt], [`TrackElementExt`][trait@crate::prelude::TrackElementExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
20    #[doc(alias = "GESTitleSource")]
21    pub struct TitleSource(Object<ffi::GESTitleSource, ffi::GESTitleSourceClass>) @extends VideoSource, Source, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
22
23    match fn {
24        type_ => || ffi::ges_title_source_get_type(),
25    }
26}
27
28impl TitleSource {
29    pub const NONE: Option<&'static TitleSource> = None;
30}
31
32mod sealed {
33    pub trait Sealed {}
34    impl<T: super::IsA<super::TitleSource>> Sealed for T {}
35}
36
37/// Trait containing all [`struct@TitleSource`] methods.
38///
39/// # Implementors
40///
41/// [`TitleSource`][struct@crate::TitleSource]
42pub trait TitleSourceExt: IsA<TitleSource> + sealed::Sealed + 'static {
43    /// Get the background used by `self`.
44    ///
45    /// # Returns
46    ///
47    /// The background used by `self`.
48    #[doc(alias = "ges_title_source_get_background_color")]
49    #[doc(alias = "get_background_color")]
50    fn background_color(&self) -> u32 {
51        unsafe { ffi::ges_title_source_get_background_color(self.as_ref().to_glib_none().0) }
52    }
53
54    /// Get the pango font description used by `self`.
55    ///
56    /// # Deprecated since 1.16
57    ///
58    /// Use ges_timeline_element_get_child_property instead
59    /// (this actually returns a newly allocated string)
60    ///
61    /// # Returns
62    ///
63    /// The pango font description used by this
64    /// `self`.
65    #[cfg_attr(feature = "v1_16", deprecated = "Since 1.16")]
66    #[allow(deprecated)]
67    #[doc(alias = "ges_title_source_get_font_desc")]
68    #[doc(alias = "get_font_desc")]
69    fn font_desc(&self) -> Option<glib::GString> {
70        unsafe {
71            from_glib_full(ffi::ges_title_source_get_font_desc(
72                self.as_ref().to_glib_none().0,
73            ))
74        }
75    }
76
77    /// Get the horizontal aligment used by `self`.
78    ///
79    /// # Returns
80    ///
81    /// The horizontal aligment used by `self`.
82    #[doc(alias = "ges_title_source_get_halignment")]
83    #[doc(alias = "get_halignment")]
84    fn halignment(&self) -> TextHAlign {
85        unsafe {
86            from_glib(ffi::ges_title_source_get_halignment(
87                self.as_ref().to_glib_none().0,
88            ))
89        }
90    }
91
92    /// Get the text currently set on the `self`.
93    ///
94    /// # Deprecated since 1.16
95    ///
96    /// Use ges_timeline_element_get_child_property instead
97    /// (this actually returns a newly allocated string)
98    ///
99    /// # Returns
100    ///
101    /// The text currently set on the `self`.
102    #[cfg_attr(feature = "v1_16", deprecated = "Since 1.16")]
103    #[allow(deprecated)]
104    #[doc(alias = "ges_title_source_get_text")]
105    #[doc(alias = "get_text")]
106    fn text(&self) -> Option<glib::GString> {
107        unsafe {
108            from_glib_full(ffi::ges_title_source_get_text(
109                self.as_ref().to_glib_none().0,
110            ))
111        }
112    }
113
114    /// Get the color used by `self`.
115    ///
116    /// # Returns
117    ///
118    /// The color used by `self`.
119    #[doc(alias = "ges_title_source_get_text_color")]
120    #[doc(alias = "get_text_color")]
121    fn text_color(&self) -> u32 {
122        unsafe { ffi::ges_title_source_get_text_color(self.as_ref().to_glib_none().0) }
123    }
124
125    /// Get the vertical aligment used by `self`.
126    ///
127    /// # Returns
128    ///
129    /// The vertical aligment used by `self`.
130    #[doc(alias = "ges_title_source_get_valignment")]
131    #[doc(alias = "get_valignment")]
132    fn valignment(&self) -> TextVAlign {
133        unsafe {
134            from_glib(ffi::ges_title_source_get_valignment(
135                self.as_ref().to_glib_none().0,
136            ))
137        }
138    }
139
140    /// Get the horizontal position used by `self`.
141    ///
142    /// # Returns
143    ///
144    /// The horizontal position used by `self`.
145    #[doc(alias = "ges_title_source_get_xpos")]
146    #[doc(alias = "get_xpos")]
147    fn xpos(&self) -> f64 {
148        unsafe { ffi::ges_title_source_get_xpos(self.as_ref().to_glib_none().0) }
149    }
150
151    /// Get the vertical position used by `self`.
152    ///
153    /// # Returns
154    ///
155    /// The vertical position used by `self`.
156    #[doc(alias = "ges_title_source_get_ypos")]
157    #[doc(alias = "get_ypos")]
158    fn ypos(&self) -> f64 {
159        unsafe { ffi::ges_title_source_get_ypos(self.as_ref().to_glib_none().0) }
160    }
161
162    /// Sets the color of the background
163    /// ## `color`
164    /// the color `self` is being set to
165    #[doc(alias = "ges_title_source_set_background_color")]
166    fn set_background_color(&self, color: u32) {
167        unsafe {
168            ffi::ges_title_source_set_background_color(self.as_ref().to_glib_none().0, color);
169        }
170    }
171
172    /// Set the pango font description this source will use to render
173    /// the text.
174    /// ## `font_desc`
175    /// the pango font description
176    #[doc(alias = "ges_title_source_set_font_desc")]
177    fn set_font_desc(&self, font_desc: Option<&str>) {
178        unsafe {
179            ffi::ges_title_source_set_font_desc(
180                self.as_ref().to_glib_none().0,
181                font_desc.to_glib_none().0,
182            );
183        }
184    }
185
186    /// Sets the vertical aligment of the text.
187    /// ## `halign`
188    /// [`TextHAlign`][crate::TextHAlign]
189    #[doc(alias = "ges_title_source_set_halignment")]
190    fn set_halignment(&self, halign: TextHAlign) {
191        unsafe {
192            ffi::ges_title_source_set_halignment(
193                self.as_ref().to_glib_none().0,
194                halign.into_glib(),
195            );
196        }
197    }
198
199    /// Sets the text this track element will render.
200    ///
201    /// # Deprecated
202    ///
203    /// use ges_track_element_get/set_children_properties on the
204    /// GESTrackElement instead
205    /// ## `text`
206    /// the text to render. an internal copy of this text will be
207    /// made.
208    #[doc(alias = "ges_title_source_set_text")]
209    fn set_text(&self, text: Option<&str>) {
210        unsafe {
211            ffi::ges_title_source_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
212        }
213    }
214
215    /// Sets the color of the text.
216    /// ## `color`
217    /// the color `self` is being set to
218    #[doc(alias = "ges_title_source_set_text_color")]
219    fn set_text_color(&self, color: u32) {
220        unsafe {
221            ffi::ges_title_source_set_text_color(self.as_ref().to_glib_none().0, color);
222        }
223    }
224
225    /// Sets the vertical aligment of the text.
226    /// ## `valign`
227    /// [`TextVAlign`][crate::TextVAlign]
228    #[doc(alias = "ges_title_source_set_valignment")]
229    fn set_valignment(&self, valign: TextVAlign) {
230        unsafe {
231            ffi::ges_title_source_set_valignment(
232                self.as_ref().to_glib_none().0,
233                valign.into_glib(),
234            );
235        }
236    }
237
238    /// Sets the horizontal position of the text.
239    /// ## `position`
240    /// the horizontal position `self` is being set to
241    #[doc(alias = "ges_title_source_set_xpos")]
242    fn set_xpos(&self, position: f64) {
243        unsafe {
244            ffi::ges_title_source_set_xpos(self.as_ref().to_glib_none().0, position);
245        }
246    }
247
248    /// Sets the vertical position of the text.
249    /// ## `position`
250    /// the color `self` is being set to
251    #[doc(alias = "ges_title_source_set_ypos")]
252    fn set_ypos(&self, position: f64) {
253        unsafe {
254            ffi::ges_title_source_set_ypos(self.as_ref().to_glib_none().0, position);
255        }
256    }
257}
258
259impl<O: IsA<TitleSource>> TitleSourceExt for O {}