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
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{Win32HCursor, HCURSOR};
use glib::object::IsA;
use glib::{translate::*, types::Pointee};
use std::ptr::NonNull;

impl Win32HCursor {
    #[doc(alias = "gdk_win32_hcursor_new")]
    pub fn new(
        display: &impl IsA<crate::Win32Display>,
        handle: HCURSOR,
        destroyable: bool,
    ) -> Self {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gdk_win32_hcursor_new(
                display.as_ref().to_glib_none().0,
                handle.0,
                destroyable.into_glib(),
            ))
        }
    }

    pub fn handle(&self) -> HCURSOR {
        let ptr: NonNull<Pointee> = glib::ObjectExt::property(self, "handle");
        HCURSOR(ptr.as_ptr() as _)
    }
}