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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// extern crate winapi;
// use std::os::raw::c_void;
// use winapi::shared::windef::HWND;
// use winapi::um::winuser::{IsIconic, IsZoomed};
// use winapi::um::winuser::{
// SetWindowPos,
// ShowWindow, //HWND_NOTOPMOST, HWND_TOPMOST,
// SWP_NOMOVE,
// // SWP_NOSIZE,
// SWP_NOZORDER, // SWP_SHOWWINDOW,
// SW_MAXIMIZE,
// SW_MINIMIZE,
// SW_RESTORE,
// };
// /// Maximize the given window -> Expand its borders to fit the screen
// pub fn maximize(window: &*mut c_void) {
// let hwnd = *window as HWND;
// unsafe {
// ShowWindow(hwnd, SW_MAXIMIZE);
// }
// }
// /// Hide away the given window
// pub fn minimize(window: &*mut c_void) {
// let hwnd = *window as HWND;
// unsafe {
// ShowWindow(hwnd, SW_MINIMIZE);
// }
// }
// /// Unhide un-away the given window
// pub fn restore(window: &*mut c_void) {
// let hwnd = *window as HWND;
// unsafe {
// ShowWindow(hwnd, SW_RESTORE);
// }
// }
// // pub fn always_on_top(window: &*mut c_void, always_on_top_bool: bool) {
// // if always_on_top_bool {
// // topmost(window);
// // } else {
// // not_topmost(window);
// // }
// // }
// // pub fn topmost(window: &*mut c_void) {
// // let hwnd = *window as HWND;
// // unsafe {
// // SetWindowPos(
// // hwnd,
// // HWND_TOPMOST,
// // 0,
// // 0,
// // 0,
// // 0,
// // SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW,
// // );
// // }
// // }
// // pub fn not_topmost(window: &*mut c_void) {
// // let hwnd = *window as HWND;
// // unsafe {
// // SetWindowPos(
// // hwnd,
// // HWND_NOTOPMOST,
// // 0,
// // 0,
// // 0,
// // 0,
// // SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW,
// // );
// // }
// // }
// /// Resize the current window to the specified size
// pub fn resize(window: &*mut c_void, size: &(i32, i32)) {
// let hwnd = *window as HWND;
// unsafe {
// // Resize the window to the given width and height
// SetWindowPos(
// hwnd,
// core::ptr::null_mut(), // No changes to the window's position
// 0,
// 0,
// size.0,
// size.1,
// SWP_NOZORDER | SWP_NOMOVE, // Keep the current position, just resize
// );
// }
// }
// /// Wether the window is minimized on windows
// pub fn is_window_minimized(window: &*mut c_void) -> bool {
// let hwnd = *window as HWND;
// unsafe { IsIconic(hwnd) != 0 }
// }
// /// Get the numerical value of a window
// pub const fn get_window_handle(window: &*mut c_void) -> HWND {
// *window as HWND
// }
// /// Wether a window is maximized on windows
// pub fn is_window_maximized(window: &*mut c_void) -> bool {
// let hwnd = *window as HWND;
// unsafe { IsZoomed(hwnd) != 0 }
// }