1 | use core::ffi::c_void; |
2 | use core::ptr; |
3 | |
4 | /// Raw display handle for Windows. |
5 | /// |
6 | /// It could be used regardless of Windows window backend. |
7 | /// |
8 | /// ## Construction |
9 | /// ``` |
10 | /// # use raw_window_handle::WindowsDisplayHandle; |
11 | /// let mut display_handle = WindowsDisplayHandle::empty(); |
12 | /// /* set fields */ |
13 | /// ``` |
14 | #[non_exhaustive ] |
15 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)] |
16 | pub struct WindowsDisplayHandle; |
17 | |
18 | impl WindowsDisplayHandle { |
19 | pub fn empty() -> Self { |
20 | Self |
21 | } |
22 | } |
23 | |
24 | /// Raw window handle for Win32. |
25 | /// |
26 | /// ## Construction |
27 | /// ``` |
28 | /// # use raw_window_handle::Win32WindowHandle; |
29 | /// let mut window_handle = Win32WindowHandle::empty(); |
30 | /// /* set fields */ |
31 | /// ``` |
32 | #[non_exhaustive ] |
33 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)] |
34 | pub struct Win32WindowHandle { |
35 | /// A Win32 `HWND` handle. |
36 | pub hwnd: *mut c_void, |
37 | /// The `HINSTANCE` associated with this type's `HWND`. |
38 | pub hinstance: *mut c_void, |
39 | } |
40 | |
41 | impl Win32WindowHandle { |
42 | pub fn empty() -> Self { |
43 | Self { |
44 | hwnd: ptr::null_mut(), |
45 | hinstance: ptr::null_mut(), |
46 | } |
47 | } |
48 | } |
49 | |
50 | /// Raw window handle for WinRT. |
51 | /// |
52 | /// ## Construction |
53 | /// ``` |
54 | /// # use raw_window_handle::WinRtWindowHandle; |
55 | /// let mut window_handle = WinRtWindowHandle::empty(); |
56 | /// /* set fields */ |
57 | /// ``` |
58 | #[non_exhaustive ] |
59 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)] |
60 | pub struct WinRtWindowHandle { |
61 | /// A WinRT `CoreWindow` handle. |
62 | pub core_window: *mut c_void, |
63 | } |
64 | |
65 | impl WinRtWindowHandle { |
66 | pub fn empty() -> Self { |
67 | Self { |
68 | core_window: ptr::null_mut(), |
69 | } |
70 | } |
71 | } |
72 | |