1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
#![allow(deprecated)]

use crate::{
    ffi, Extractable, MetaContainer, Source, TextHAlign, TextVAlign, TimelineElement, TrackElement,
    VideoSource,
};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    /// [`TitleSource`][crate::TitleSource] is a GESTimelineElement that implements the notion
    /// of titles in GES.
    ///
    /// # Implements
    ///
    /// [`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]
    #[doc(alias = "GESTitleSource")]
    pub struct TitleSource(Object<ffi::GESTitleSource, ffi::GESTitleSourceClass>) @extends VideoSource, Source, TrackElement, TimelineElement, @implements Extractable, MetaContainer;

    match fn {
        type_ => || ffi::ges_title_source_get_type(),
    }
}

impl TitleSource {
    pub const NONE: Option<&'static TitleSource> = None;
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::TitleSource>> Sealed for T {}
}

/// Trait containing all [`struct@TitleSource`] methods.
///
/// # Implementors
///
/// [`TitleSource`][struct@crate::TitleSource]
pub trait TitleSourceExt: IsA<TitleSource> + sealed::Sealed + 'static {
    /// Get the background used by `self`.
    ///
    /// # Returns
    ///
    /// The background used by `self`.
    #[doc(alias = "ges_title_source_get_background_color")]
    #[doc(alias = "get_background_color")]
    fn background_color(&self) -> u32 {
        unsafe { ffi::ges_title_source_get_background_color(self.as_ref().to_glib_none().0) }
    }

    /// Get the pango font description used by `self`.
    ///
    /// # Deprecated since 1.16
    ///
    /// Use ges_timeline_element_get_child_property instead
    /// (this actually returns a newly allocated string)
    ///
    /// # Returns
    ///
    /// The pango font description used by this
    /// `self`.
    #[cfg_attr(feature = "v1_16", deprecated = "Since 1.16")]
    #[allow(deprecated)]
    #[doc(alias = "ges_title_source_get_font_desc")]
    #[doc(alias = "get_font_desc")]
    fn font_desc(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::ges_title_source_get_font_desc(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Get the horizontal aligment used by `self`.
    ///
    /// # Returns
    ///
    /// The horizontal aligment used by `self`.
    #[doc(alias = "ges_title_source_get_halignment")]
    #[doc(alias = "get_halignment")]
    fn halignment(&self) -> TextHAlign {
        unsafe {
            from_glib(ffi::ges_title_source_get_halignment(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Get the text currently set on the `self`.
    ///
    /// # Deprecated since 1.16
    ///
    /// Use ges_timeline_element_get_child_property instead
    /// (this actually returns a newly allocated string)
    ///
    /// # Returns
    ///
    /// The text currently set on the `self`.
    #[cfg_attr(feature = "v1_16", deprecated = "Since 1.16")]
    #[allow(deprecated)]
    #[doc(alias = "ges_title_source_get_text")]
    #[doc(alias = "get_text")]
    fn text(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::ges_title_source_get_text(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Get the color used by `self`.
    ///
    /// # Returns
    ///
    /// The color used by `self`.
    #[doc(alias = "ges_title_source_get_text_color")]
    #[doc(alias = "get_text_color")]
    fn text_color(&self) -> u32 {
        unsafe { ffi::ges_title_source_get_text_color(self.as_ref().to_glib_none().0) }
    }

    /// Get the vertical aligment used by `self`.
    ///
    /// # Returns
    ///
    /// The vertical aligment used by `self`.
    #[doc(alias = "ges_title_source_get_valignment")]
    #[doc(alias = "get_valignment")]
    fn valignment(&self) -> TextVAlign {
        unsafe {
            from_glib(ffi::ges_title_source_get_valignment(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Get the horizontal position used by `self`.
    ///
    /// # Returns
    ///
    /// The horizontal position used by `self`.
    #[doc(alias = "ges_title_source_get_xpos")]
    #[doc(alias = "get_xpos")]
    fn xpos(&self) -> f64 {
        unsafe { ffi::ges_title_source_get_xpos(self.as_ref().to_glib_none().0) }
    }

    /// Get the vertical position used by `self`.
    ///
    /// # Returns
    ///
    /// The vertical position used by `self`.
    #[doc(alias = "ges_title_source_get_ypos")]
    #[doc(alias = "get_ypos")]
    fn ypos(&self) -> f64 {
        unsafe { ffi::ges_title_source_get_ypos(self.as_ref().to_glib_none().0) }
    }

    /// Sets the color of the background
    /// ## `color`
    /// the color `self` is being set to
    #[doc(alias = "ges_title_source_set_background_color")]
    fn set_background_color(&self, color: u32) {
        unsafe {
            ffi::ges_title_source_set_background_color(self.as_ref().to_glib_none().0, color);
        }
    }

    /// Set the pango font description this source will use to render
    /// the text.
    /// ## `font_desc`
    /// the pango font description
    #[doc(alias = "ges_title_source_set_font_desc")]
    fn set_font_desc(&self, font_desc: Option<&str>) {
        unsafe {
            ffi::ges_title_source_set_font_desc(
                self.as_ref().to_glib_none().0,
                font_desc.to_glib_none().0,
            );
        }
    }

    /// Sets the vertical aligment of the text.
    /// ## `halign`
    /// [`TextHAlign`][crate::TextHAlign]
    #[doc(alias = "ges_title_source_set_halignment")]
    fn set_halignment(&self, halign: TextHAlign) {
        unsafe {
            ffi::ges_title_source_set_halignment(
                self.as_ref().to_glib_none().0,
                halign.into_glib(),
            );
        }
    }

    /// Sets the text this track element will render.
    ///
    /// # Deprecated
    ///
    /// use ges_track_element_get/set_children_properties on the
    /// GESTrackElement instead
    /// ## `text`
    /// the text to render. an internal copy of this text will be
    /// made.
    #[doc(alias = "ges_title_source_set_text")]
    fn set_text(&self, text: Option<&str>) {
        unsafe {
            ffi::ges_title_source_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
        }
    }

    /// Sets the color of the text.
    /// ## `color`
    /// the color `self` is being set to
    #[doc(alias = "ges_title_source_set_text_color")]
    fn set_text_color(&self, color: u32) {
        unsafe {
            ffi::ges_title_source_set_text_color(self.as_ref().to_glib_none().0, color);
        }
    }

    /// Sets the vertical aligment of the text.
    /// ## `valign`
    /// [`TextVAlign`][crate::TextVAlign]
    #[doc(alias = "ges_title_source_set_valignment")]
    fn set_valignment(&self, valign: TextVAlign) {
        unsafe {
            ffi::ges_title_source_set_valignment(
                self.as_ref().to_glib_none().0,
                valign.into_glib(),
            );
        }
    }

    /// Sets the horizontal position of the text.
    /// ## `position`
    /// the horizontal position `self` is being set to
    #[doc(alias = "ges_title_source_set_xpos")]
    fn set_xpos(&self, position: f64) {
        unsafe {
            ffi::ges_title_source_set_xpos(self.as_ref().to_glib_none().0, position);
        }
    }

    /// Sets the vertical position of the text.
    /// ## `position`
    /// the color `self` is being set to
    #[doc(alias = "ges_title_source_set_ypos")]
    fn set_ypos(&self, position: f64) {
        unsafe {
            ffi::ges_title_source_set_ypos(self.as_ref().to_glib_none().0, position);
        }
    }
}

impl<O: IsA<TitleSource>> TitleSourceExt for O {}