gstreamer_editing_services/auto/
text_overlay_clip.rs1use crate::{
7 ffi, Clip, Container, Extractable, MetaContainer, OperationClip, OverlayClip, TextHAlign,
8 TextVAlign, TimelineElement,
9};
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 #[doc(alias = "GESTextOverlayClip")]
19 pub struct TextOverlayClip(Object<ffi::GESTextOverlayClip, ffi::GESTextOverlayClipClass>) @extends OverlayClip, OperationClip, Clip, Container, TimelineElement, @implements Extractable, MetaContainer;
20
21 match fn {
22 type_ => || ffi::ges_text_overlay_clip_get_type(),
23 }
24}
25
26impl TextOverlayClip {
27 pub const NONE: Option<&'static TextOverlayClip> = None;
28
29 #[doc(alias = "ges_text_overlay_clip_new")]
30 pub fn new() -> Option<TextOverlayClip> {
31 assert_initialized_main_thread!();
32 unsafe { from_glib_none(ffi::ges_text_overlay_clip_new()) }
33 }
34}
35
36mod sealed {
37 pub trait Sealed {}
38 impl<T: super::IsA<super::TextOverlayClip>> Sealed for T {}
39}
40
41pub trait TextOverlayClipExt: IsA<TextOverlayClip> + sealed::Sealed + 'static {
42 #[doc(alias = "ges_text_overlay_clip_get_color")]
43 #[doc(alias = "get_color")]
44 fn color(&self) -> u32 {
45 unsafe { ffi::ges_text_overlay_clip_get_color(self.as_ref().to_glib_none().0) }
46 }
47
48 #[doc(alias = "ges_text_overlay_clip_get_font_desc")]
49 #[doc(alias = "get_font_desc")]
50 #[doc(alias = "font-desc")]
51 fn font_desc(&self) -> Option<glib::GString> {
52 unsafe {
53 from_glib_none(ffi::ges_text_overlay_clip_get_font_desc(
54 self.as_ref().to_glib_none().0,
55 ))
56 }
57 }
58
59 #[doc(alias = "ges_text_overlay_clip_get_halignment")]
60 #[doc(alias = "get_halignment")]
61 fn halignment(&self) -> TextHAlign {
62 unsafe {
63 from_glib(ffi::ges_text_overlay_clip_get_halignment(
64 self.as_ref().to_glib_none().0,
65 ))
66 }
67 }
68
69 #[doc(alias = "ges_text_overlay_clip_get_text")]
70 #[doc(alias = "get_text")]
71 fn text(&self) -> Option<glib::GString> {
72 unsafe {
73 from_glib_none(ffi::ges_text_overlay_clip_get_text(
74 self.as_ref().to_glib_none().0,
75 ))
76 }
77 }
78
79 #[doc(alias = "ges_text_overlay_clip_get_valignment")]
80 #[doc(alias = "get_valignment")]
81 fn valignment(&self) -> TextVAlign {
82 unsafe {
83 from_glib(ffi::ges_text_overlay_clip_get_valignment(
84 self.as_ref().to_glib_none().0,
85 ))
86 }
87 }
88
89 #[doc(alias = "ges_text_overlay_clip_get_xpos")]
90 #[doc(alias = "get_xpos")]
91 fn xpos(&self) -> f64 {
92 unsafe { ffi::ges_text_overlay_clip_get_xpos(self.as_ref().to_glib_none().0) }
93 }
94
95 #[doc(alias = "ges_text_overlay_clip_get_ypos")]
96 #[doc(alias = "get_ypos")]
97 fn ypos(&self) -> f64 {
98 unsafe { ffi::ges_text_overlay_clip_get_ypos(self.as_ref().to_glib_none().0) }
99 }
100
101 #[doc(alias = "ges_text_overlay_clip_set_color")]
102 #[doc(alias = "color")]
103 fn set_color(&self, color: u32) {
104 unsafe {
105 ffi::ges_text_overlay_clip_set_color(self.as_ref().to_glib_none().0, color);
106 }
107 }
108
109 #[doc(alias = "ges_text_overlay_clip_set_font_desc")]
110 #[doc(alias = "font-desc")]
111 fn set_font_desc(&self, font_desc: Option<&str>) {
112 unsafe {
113 ffi::ges_text_overlay_clip_set_font_desc(
114 self.as_ref().to_glib_none().0,
115 font_desc.to_glib_none().0,
116 );
117 }
118 }
119
120 #[doc(alias = "ges_text_overlay_clip_set_halign")]
121 fn set_halign(&self, halign: TextHAlign) {
122 unsafe {
123 ffi::ges_text_overlay_clip_set_halign(
124 self.as_ref().to_glib_none().0,
125 halign.into_glib(),
126 );
127 }
128 }
129
130 #[doc(alias = "ges_text_overlay_clip_set_text")]
131 #[doc(alias = "text")]
132 fn set_text(&self, text: Option<&str>) {
133 unsafe {
134 ffi::ges_text_overlay_clip_set_text(
135 self.as_ref().to_glib_none().0,
136 text.to_glib_none().0,
137 );
138 }
139 }
140
141 #[doc(alias = "ges_text_overlay_clip_set_valign")]
142 fn set_valign(&self, valign: TextVAlign) {
143 unsafe {
144 ffi::ges_text_overlay_clip_set_valign(
145 self.as_ref().to_glib_none().0,
146 valign.into_glib(),
147 );
148 }
149 }
150
151 #[doc(alias = "ges_text_overlay_clip_set_xpos")]
152 #[doc(alias = "xpos")]
153 fn set_xpos(&self, position: f64) {
154 unsafe {
155 ffi::ges_text_overlay_clip_set_xpos(self.as_ref().to_glib_none().0, position);
156 }
157 }
158
159 #[doc(alias = "ges_text_overlay_clip_set_ypos")]
160 #[doc(alias = "ypos")]
161 fn set_ypos(&self, position: f64) {
162 unsafe {
163 ffi::ges_text_overlay_clip_set_ypos(self.as_ref().to_glib_none().0, position);
164 }
165 }
166
167 fn set_halignment(&self, halignment: TextHAlign) {
168 ObjectExt::set_property(self.as_ref(), "halignment", halignment)
169 }
170
171 fn set_valignment(&self, valignment: TextVAlign) {
172 ObjectExt::set_property(self.as_ref(), "valignment", valignment)
173 }
174
175 #[doc(alias = "color")]
176 fn connect_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
177 unsafe extern "C" fn notify_color_trampoline<
178 P: IsA<TextOverlayClip>,
179 F: Fn(&P) + 'static,
180 >(
181 this: *mut ffi::GESTextOverlayClip,
182 _param_spec: glib::ffi::gpointer,
183 f: glib::ffi::gpointer,
184 ) {
185 let f: &F = &*(f as *const F);
186 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
187 }
188 unsafe {
189 let f: Box_<F> = Box_::new(f);
190 connect_raw(
191 self.as_ptr() as *mut _,
192 b"notify::color\0".as_ptr() as *const _,
193 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
194 notify_color_trampoline::<Self, F> as *const (),
195 )),
196 Box_::into_raw(f),
197 )
198 }
199 }
200
201 #[doc(alias = "font-desc")]
202 fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
203 unsafe extern "C" fn notify_font_desc_trampoline<
204 P: IsA<TextOverlayClip>,
205 F: Fn(&P) + 'static,
206 >(
207 this: *mut ffi::GESTextOverlayClip,
208 _param_spec: glib::ffi::gpointer,
209 f: glib::ffi::gpointer,
210 ) {
211 let f: &F = &*(f as *const F);
212 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
213 }
214 unsafe {
215 let f: Box_<F> = Box_::new(f);
216 connect_raw(
217 self.as_ptr() as *mut _,
218 b"notify::font-desc\0".as_ptr() as *const _,
219 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
220 notify_font_desc_trampoline::<Self, F> as *const (),
221 )),
222 Box_::into_raw(f),
223 )
224 }
225 }
226
227 #[doc(alias = "halignment")]
228 fn connect_halignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
229 unsafe extern "C" fn notify_halignment_trampoline<
230 P: IsA<TextOverlayClip>,
231 F: Fn(&P) + 'static,
232 >(
233 this: *mut ffi::GESTextOverlayClip,
234 _param_spec: glib::ffi::gpointer,
235 f: glib::ffi::gpointer,
236 ) {
237 let f: &F = &*(f as *const F);
238 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
239 }
240 unsafe {
241 let f: Box_<F> = Box_::new(f);
242 connect_raw(
243 self.as_ptr() as *mut _,
244 b"notify::halignment\0".as_ptr() as *const _,
245 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
246 notify_halignment_trampoline::<Self, F> as *const (),
247 )),
248 Box_::into_raw(f),
249 )
250 }
251 }
252
253 #[doc(alias = "text")]
254 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
255 unsafe extern "C" fn notify_text_trampoline<
256 P: IsA<TextOverlayClip>,
257 F: Fn(&P) + 'static,
258 >(
259 this: *mut ffi::GESTextOverlayClip,
260 _param_spec: glib::ffi::gpointer,
261 f: glib::ffi::gpointer,
262 ) {
263 let f: &F = &*(f as *const F);
264 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
265 }
266 unsafe {
267 let f: Box_<F> = Box_::new(f);
268 connect_raw(
269 self.as_ptr() as *mut _,
270 b"notify::text\0".as_ptr() as *const _,
271 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
272 notify_text_trampoline::<Self, F> as *const (),
273 )),
274 Box_::into_raw(f),
275 )
276 }
277 }
278
279 #[doc(alias = "valignment")]
280 fn connect_valignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
281 unsafe extern "C" fn notify_valignment_trampoline<
282 P: IsA<TextOverlayClip>,
283 F: Fn(&P) + 'static,
284 >(
285 this: *mut ffi::GESTextOverlayClip,
286 _param_spec: glib::ffi::gpointer,
287 f: glib::ffi::gpointer,
288 ) {
289 let f: &F = &*(f as *const F);
290 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
291 }
292 unsafe {
293 let f: Box_<F> = Box_::new(f);
294 connect_raw(
295 self.as_ptr() as *mut _,
296 b"notify::valignment\0".as_ptr() as *const _,
297 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
298 notify_valignment_trampoline::<Self, F> as *const (),
299 )),
300 Box_::into_raw(f),
301 )
302 }
303 }
304
305 #[doc(alias = "xpos")]
306 fn connect_xpos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
307 unsafe extern "C" fn notify_xpos_trampoline<
308 P: IsA<TextOverlayClip>,
309 F: Fn(&P) + 'static,
310 >(
311 this: *mut ffi::GESTextOverlayClip,
312 _param_spec: glib::ffi::gpointer,
313 f: glib::ffi::gpointer,
314 ) {
315 let f: &F = &*(f as *const F);
316 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
317 }
318 unsafe {
319 let f: Box_<F> = Box_::new(f);
320 connect_raw(
321 self.as_ptr() as *mut _,
322 b"notify::xpos\0".as_ptr() as *const _,
323 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
324 notify_xpos_trampoline::<Self, F> as *const (),
325 )),
326 Box_::into_raw(f),
327 )
328 }
329 }
330
331 #[doc(alias = "ypos")]
332 fn connect_ypos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
333 unsafe extern "C" fn notify_ypos_trampoline<
334 P: IsA<TextOverlayClip>,
335 F: Fn(&P) + 'static,
336 >(
337 this: *mut ffi::GESTextOverlayClip,
338 _param_spec: glib::ffi::gpointer,
339 f: glib::ffi::gpointer,
340 ) {
341 let f: &F = &*(f as *const F);
342 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
343 }
344 unsafe {
345 let f: Box_<F> = Box_::new(f);
346 connect_raw(
347 self.as_ptr() as *mut _,
348 b"notify::ypos\0".as_ptr() as *const _,
349 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
350 notify_ypos_trampoline::<Self, F> as *const (),
351 )),
352 Box_::into_raw(f),
353 )
354 }
355 }
356}
357
358impl<O: IsA<TextOverlayClip>> TextOverlayClipExt for O {}