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 | |
6 | use crate::{ColorBalanceChannel, ColorBalanceType}; |
7 | use glib::{ |
8 | prelude::*, |
9 | signal::{connect_raw, SignalHandlerId}, |
10 | translate::*, |
11 | }; |
12 | use std::{boxed::Box as Box_, mem::transmute}; |
13 | |
14 | glib::wrapper! { |
15 | #[doc (alias = "GstColorBalance" )] |
16 | pub struct ColorBalance(Interface<ffi::GstColorBalance, ffi::GstColorBalanceInterface>); |
17 | |
18 | match fn { |
19 | type_ => || ffi::gst_color_balance_get_type(), |
20 | } |
21 | } |
22 | |
23 | impl ColorBalance { |
24 | pub const NONE: Option<&'static ColorBalance> = None; |
25 | } |
26 | |
27 | unsafe impl Send for ColorBalance {} |
28 | unsafe impl Sync for ColorBalance {} |
29 | |
30 | mod sealed { |
31 | pub trait Sealed {} |
32 | impl<T: super::IsA<super::ColorBalance>> Sealed for T {} |
33 | } |
34 | |
35 | pub trait ColorBalanceExt: IsA<ColorBalance> + sealed::Sealed + 'static { |
36 | #[doc (alias = "gst_color_balance_get_balance_type" )] |
37 | #[doc (alias = "get_balance_type" )] |
38 | fn balance_type(&self) -> ColorBalanceType { |
39 | unsafe { |
40 | from_glib(ffi::gst_color_balance_get_balance_type( |
41 | self.as_ref().to_glib_none().0, |
42 | )) |
43 | } |
44 | } |
45 | |
46 | #[doc (alias = "gst_color_balance_get_value" )] |
47 | #[doc (alias = "get_value" )] |
48 | fn value(&self, channel: &impl IsA<ColorBalanceChannel>) -> i32 { |
49 | unsafe { |
50 | ffi::gst_color_balance_get_value( |
51 | self.as_ref().to_glib_none().0, |
52 | channel.as_ref().to_glib_none().0, |
53 | ) |
54 | } |
55 | } |
56 | |
57 | #[doc (alias = "gst_color_balance_list_channels" )] |
58 | fn list_channels(&self) -> Vec<ColorBalanceChannel> { |
59 | unsafe { |
60 | FromGlibPtrContainer::from_glib_none(ffi::gst_color_balance_list_channels( |
61 | self.as_ref().to_glib_none().0, |
62 | )) |
63 | } |
64 | } |
65 | |
66 | #[doc (alias = "gst_color_balance_set_value" )] |
67 | fn set_value(&self, channel: &impl IsA<ColorBalanceChannel>, value: i32) { |
68 | unsafe { |
69 | ffi::gst_color_balance_set_value( |
70 | self.as_ref().to_glib_none().0, |
71 | channel.as_ref().to_glib_none().0, |
72 | value, |
73 | ); |
74 | } |
75 | } |
76 | |
77 | #[doc (alias = "gst_color_balance_value_changed" )] |
78 | fn value_changed(&self, channel: &impl IsA<ColorBalanceChannel>, value: i32) { |
79 | unsafe { |
80 | ffi::gst_color_balance_value_changed( |
81 | self.as_ref().to_glib_none().0, |
82 | channel.as_ref().to_glib_none().0, |
83 | value, |
84 | ); |
85 | } |
86 | } |
87 | |
88 | #[doc (alias = "value-changed" )] |
89 | fn connect_value_changed<F: Fn(&Self, &ColorBalanceChannel, i32) + Send + Sync + 'static>( |
90 | &self, |
91 | f: F, |
92 | ) -> SignalHandlerId { |
93 | unsafe extern "C" fn value_changed_trampoline< |
94 | P: IsA<ColorBalance>, |
95 | F: Fn(&P, &ColorBalanceChannel, i32) + Send + Sync + 'static, |
96 | >( |
97 | this: *mut ffi::GstColorBalance, |
98 | channel: *mut ffi::GstColorBalanceChannel, |
99 | value: libc::c_int, |
100 | f: glib::ffi::gpointer, |
101 | ) { |
102 | let f: &F = &*(f as *const F); |
103 | f( |
104 | ColorBalance::from_glib_borrow(this).unsafe_cast_ref(), |
105 | &from_glib_borrow(channel), |
106 | value, |
107 | ) |
108 | } |
109 | unsafe { |
110 | let f: Box_<F> = Box_::new(f); |
111 | connect_raw( |
112 | self.as_ptr() as *mut _, |
113 | b"value-changed \0" .as_ptr() as *const _, |
114 | Some(transmute::<_, unsafe extern "C" fn()>( |
115 | value_changed_trampoline::<Self, F> as *const (), |
116 | )), |
117 | Box_::into_raw(f), |
118 | ) |
119 | } |
120 | } |
121 | } |
122 | |
123 | impl<O: IsA<ColorBalance>> ColorBalanceExt for O {} |
124 | |