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