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
// 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, Operation, TextHAlign, TextVAlign, TimelineElement,
TrackElement,
};
use glib::{prelude::*, translate::*};
glib::wrapper! {
///
///
/// # Implements
///
/// [`TextOverlayExt`][trait@crate::prelude::TextOverlayExt], [`OperationExt`][trait@crate::prelude::OperationExt], [`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 = "GESTextOverlay")]
pub struct TextOverlay(Object<ffi::GESTextOverlay, ffi::GESTextOverlayClass>) @extends Operation, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
match fn {
type_ => || ffi::ges_text_overlay_get_type(),
}
}
impl TextOverlay {
pub const NONE: Option<&'static TextOverlay> = None;
/// Creates a new [`TextOverlay`][crate::TextOverlay].
///
/// # Deprecated since 1.18
///
/// This should never be called by applications as this will
/// be created by clips.
///
/// # Returns
///
/// The newly created [`TextOverlay`][crate::TextOverlay] or
/// [`None`] if something went wrong.
#[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
#[allow(deprecated)]
#[doc(alias = "ges_text_overlay_new")]
pub fn new() -> Option<TextOverlay> {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::ges_text_overlay_new()) }
}
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::TextOverlay>> Sealed for T {}
}
/// Trait containing all [`struct@TextOverlay`] methods.
///
/// # Implementors
///
/// [`TextOverlay`][struct@crate::TextOverlay]
pub trait TextOverlayExt: IsA<TextOverlay> + sealed::Sealed + 'static {
/// Get the color used by `source`.
///
/// # Returns
///
/// The color used by `source`.
#[doc(alias = "ges_text_overlay_get_color")]
#[doc(alias = "get_color")]
fn color(&self) -> u32 {
unsafe { ffi::ges_text_overlay_get_color(self.as_ref().to_glib_none().0) }
}
/// Get the pango font description currently set on `source`.
///
/// # Returns
///
/// The pango font description currently set on `source`.
#[doc(alias = "ges_text_overlay_get_font_desc")]
#[doc(alias = "get_font_desc")]
fn font_desc(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::ges_text_overlay_get_font_desc(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the horizontal aligment used by `source`.
///
/// # Returns
///
/// The horizontal aligment used by `source`.
#[doc(alias = "ges_text_overlay_get_halignment")]
#[doc(alias = "get_halignment")]
fn halignment(&self) -> TextHAlign {
unsafe {
from_glib(ffi::ges_text_overlay_get_halignment(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the text currently set on `source`.
///
/// # Returns
///
/// The text currently set on `source`.
#[doc(alias = "ges_text_overlay_get_text")]
#[doc(alias = "get_text")]
fn text(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::ges_text_overlay_get_text(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the vertical aligment used by `source`.
///
/// # Returns
///
/// The vertical aligment used by `source`.
#[doc(alias = "ges_text_overlay_get_valignment")]
#[doc(alias = "get_valignment")]
fn valignment(&self) -> TextVAlign {
unsafe {
from_glib(ffi::ges_text_overlay_get_valignment(
self.as_ref().to_glib_none().0,
))
}
}
/// Get the horizontal position used by `source`.
///
/// # Returns
///
/// The horizontal position used by `source`.
#[doc(alias = "ges_text_overlay_get_xpos")]
#[doc(alias = "get_xpos")]
fn xpos(&self) -> f64 {
unsafe { ffi::ges_text_overlay_get_xpos(self.as_ref().to_glib_none().0) }
}
/// Get the vertical position used by `source`.
///
/// # Returns
///
/// The vertical position used by `source`.
#[doc(alias = "ges_text_overlay_get_ypos")]
#[doc(alias = "get_ypos")]
fn ypos(&self) -> f64 {
unsafe { ffi::ges_text_overlay_get_ypos(self.as_ref().to_glib_none().0) }
}
/// Sets the color of the text.
/// ## `color`
/// The color `self` is being set to
#[doc(alias = "ges_text_overlay_set_color")]
fn set_color(&self, color: u32) {
unsafe {
ffi::ges_text_overlay_set_color(self.as_ref().to_glib_none().0, color);
}
}
/// Sets the pango font description of the text this track element
/// will render.
/// ## `font_desc`
/// the pango font description
#[doc(alias = "ges_text_overlay_set_font_desc")]
fn set_font_desc(&self, font_desc: Option<&str>) {
unsafe {
ffi::ges_text_overlay_set_font_desc(
self.as_ref().to_glib_none().0,
font_desc.to_glib_none().0,
);
}
}
/// Sets the horizontal aligment of the text.
/// ## `halign`
/// The [`TextHAlign`][crate::TextHAlign] defining the horizontal alignment
/// of the text render by `self`.
#[doc(alias = "ges_text_overlay_set_halignment")]
fn set_halignment(&self, halign: TextHAlign) {
unsafe {
ffi::ges_text_overlay_set_halignment(
self.as_ref().to_glib_none().0,
halign.into_glib(),
);
}
}
/// Sets the text this track element will render.
/// ## `text`
/// the text to render. an internal copy of this text will be
/// made.
#[doc(alias = "ges_text_overlay_set_text")]
fn set_text(&self, text: Option<&str>) {
unsafe {
ffi::ges_text_overlay_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
}
}
/// Sets the vertical aligment of the text.
/// ## `valign`
/// The [`TextVAlign`][crate::TextVAlign] defining the vertical alignment
/// of the text render by `self`.
#[doc(alias = "ges_text_overlay_set_valignment")]
fn set_valignment(&self, valign: TextVAlign) {
unsafe {
ffi::ges_text_overlay_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_text_overlay_set_xpos")]
fn set_xpos(&self, position: f64) {
unsafe {
ffi::ges_text_overlay_set_xpos(self.as_ref().to_glib_none().0, position);
}
}
/// Sets the vertical position of the text.
/// ## `position`
/// The vertical position `self` is being set to
#[doc(alias = "ges_text_overlay_set_ypos")]
fn set_ypos(&self, position: f64) {
unsafe {
ffi::ges_text_overlay_set_ypos(self.as_ref().to_glib_none().0, position);
}
}
}
impl<O: IsA<TextOverlay>> TextOverlayExt for O {}