// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files // DO NOT EDIT use std::boxed::Box as Box_; use glib::prelude::*; use glib::signal::{SignalHandlerId, connect_raw}; use glib::translate::*; use crate::ffi; glib::wrapper! { #[doc(alias = "GlyFrameRequest")] pub struct FrameRequest(Object); match fn { type_ => || ffi::gly_frame_request_get_type(), } } impl FrameRequest { #[doc(alias = "gly_frame_request_new")] pub fn new() -> FrameRequest { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gly_frame_request_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct /// [`FrameRequest`] objects. /// /// This method returns an instance of /// [`FrameRequestBuilder`](crate::builders::FrameRequestBuilder) which can /// be used to create [`FrameRequest`] objects. pub fn builder() -> FrameRequestBuilder { FrameRequestBuilder::new() } #[doc(alias = "gly_frame_request_set_loop_animation")] #[doc(alias = "loop-animation")] pub fn set_loop_animation(&self, loop_animation: bool) { unsafe { ffi::gly_frame_request_set_loop_animation( self.to_glib_none().0, loop_animation.into_glib(), ); } } #[doc(alias = "gly_frame_request_set_scale")] pub fn set_scale(&self, width: u32, height: u32) { unsafe { ffi::gly_frame_request_set_scale(self.to_glib_none().0, width, height); } } #[doc(alias = "loop-animation")] pub fn is_loop_animation(&self) -> bool { ObjectExt::property(self, "loop-animation") } #[doc(alias = "scale-height")] pub fn scale_height(&self) -> u32 { ObjectExt::property(self, "scale-height") } #[doc(alias = "scale-width")] pub fn scale_width(&self) -> u32 { ObjectExt::property(self, "scale-width") } #[doc(alias = "loop-animation")] pub fn connect_loop_animation_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_loop_animation_trampoline< F: Fn(&FrameRequest) + Send + Sync + 'static, >( this: *mut ffi::GlyFrameRequest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { unsafe { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::loop-animation".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_loop_animation_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "scale-height")] pub fn connect_scale_height_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_scale_height_trampoline< F: Fn(&FrameRequest) + Send + Sync + 'static, >( this: *mut ffi::GlyFrameRequest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { unsafe { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::scale-height".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_scale_height_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "scale-width")] pub fn connect_scale_width_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_scale_width_trampoline< F: Fn(&FrameRequest) + Send + Sync + 'static, >( this: *mut ffi::GlyFrameRequest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { unsafe { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, c"notify::scale-width".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_scale_width_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for FrameRequest { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`FrameRequest`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct FrameRequestBuilder { builder: glib::object::ObjectBuilder<'static, FrameRequest>, } impl FrameRequestBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn loop_animation(self, loop_animation: bool) -> Self { Self { builder: self.builder.property("loop-animation", loop_animation), } } // rustdoc-stripper-ignore-next /// Build the [`FrameRequest`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> FrameRequest { assert_initialized_main_thread!(); self.builder.build() } } unsafe impl Send for FrameRequest {} unsafe impl Sync for FrameRequest {}