gdk4/
drag_surface_size.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::{ffi, prelude::*};
4use glib::translate::*;
5
6/// The [`DragSurfaceSize`][crate::DragSurfaceSize] struct contains information that is useful
7/// to compute the size of a drag surface.
8#[repr(transparent)]
9#[doc(alias = "GdkDragSurfaceSize")]
10pub struct DragSurfaceSize(std::ptr::NonNull<ffi::GdkDragSurfaceSize>);
11
12impl StaticType for DragSurfaceSize {
13    fn static_type() -> glib::Type {
14        unsafe { from_glib(ffi::gdk_drag_surface_size_get_type()) }
15    }
16}
17
18impl DragSurfaceSize {
19    /// Sets the size the drag surface prefers to be resized to.
20    /// ## `width`
21    /// the width
22    /// ## `height`
23    /// the height
24    #[doc(alias = "gdk_drag_surface_size_set_size")]
25    pub fn set_size(&self, width: i32, height: i32) {
26        unsafe { ffi::gdk_drag_surface_size_set_size(self.0.as_ptr(), width, height) }
27    }
28}