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

use std::ptr::NonNull;

use glib::{translate::*, types::Pointee};

use crate::{prelude::*, Win32HCursor, HCURSOR};

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> = ObjectExt::property(self, "handle");
        HCURSOR(ptr.as_ptr() as _)
    }
}