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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#![allow(non_camel_case_types, non_snake_case)]
use libc::{c_char, c_int, c_long, c_ulong, c_uint, c_ushort, c_void, intmax_t, size_t, wchar_t};
use uiControl;
#[repr(C)]
pub struct uiWindowsControl {
pub c: uiControl,
pub parent: *mut uiControl,
pub enabled: BOOL,
pub visible: BOOL,
pub SyncEnableState: extern "C" fn(*mut uiWindowsControl, c_int),
pub SetParentHWND: extern "C" fn(*mut uiWindowsControl, HWND),
pub MinimumSize: extern "C" fn(*mut uiWindowsControl, *mut intmax_t, *mut intmax_t),
pub MinimumSizeChanged: extern "C" fn(*mut uiWindowsControl),
pub LayoutRect: extern "C" fn(*mut uiWindowsControl, *mut RECT),
pub AssignControlIDZOrder: extern "C" fn(*mut uiWindowsControl, *mut LONG_PTR, *mut HWND),
}
extern {
pub fn uiWindowsControlSyncEnableState(control: *mut uiWindowsControl, state: c_int);
pub fn uiWindowsControlSetParentHWND(control: *mut uiWindowsControl, parent: HWND);
pub fn uiWindowsControlMinimumSize(control: *mut uiWindowsControl,
width: *mut intmax_t,
height: *mut intmax_t);
pub fn uiWindowsControlMinimumSizeChanged(control: *mut uiWindowsControl);
pub fn uiWindowsControlLayoutRect(control: *mut uiWindowsControl, rect: *mut RECT);
pub fn uiWindowsControlAssignControlIDZOrder(control: *mut uiWindowsControl,
controlID: *mut LONG_PTR,
insertAfter: *mut HWND);
pub fn uiWindowsAllocControl(n: size_t, typesig: u32, typenamestr: *const c_char)
-> *mut uiWindowsControl;
pub fn uiWindowsEnsureCreateControlHWND(dwExStyle: DWORD,
lpClassName: LPCWSTR,
lpWindowName: LPCWSTR,
dwStyle: DWORD,
hInstance: HINSTANCE,
lpParam: LPVOID,
useStandardControlFont: BOOL)
-> HWND;
pub fn uiWindowsEnsureDestroyWindow(hwnd: HWND);
pub fn uiWindowsEnsureSetParentHWND(hwnd: HWND, parent: HWND);
pub fn uiWindowsEnsureAssignControlIDZOrder(hwnd: HWND,
controlID: *mut LONG_PTR,
insertAfter: *mut HWND);
pub fn uiWindowsEnsureGetClientRect(hwnd: HWND, r: *mut RECT);
pub fn uiWindowsEnsureGetWindowRect(hwnd: HWND, r: *mut RECT);
pub fn uiWindowsWindowText(hwnd: HWND) -> *mut c_char;
pub fn uiWindowsSetWindowText(hwnd: HWND, text: *const c_char);
pub fn uiWindowsWindowTextWidth(hwnd: HWND) -> intmax_t;
pub fn uiWindowsEnsureMoveWindowDuringResize(hwnd: HWND,
x: intmax_t,
y: intmax_t,
width: intmax_t,
height: intmax_t);
pub fn uiWindowsRegisterWM_COMMANDHandler(hwnd: HWND,
handler: extern "C" fn(*mut uiControl,
HWND,
WORD,
*mut LRESULT)
-> BOOL,
c: *mut uiControl);
pub fn uiWindowsUnregisterWM_COMMANDHandler(hwnd: HWND);
pub fn uiWindowsRegisterWM_NOTIFYHandler(hwnd: HWND,
handler: extern "C" fn(*mut uiControl,
HWND,
*mut NMHDR,
*mut LRESULT)
-> BOOL,
c: *mut uiControl);
pub fn uiWindowsUnregisterWM_NOTIFYHandler(hwnd: HWND);
pub fn uiWindowsRegisterWM_HSCROLLHandler(hwnd: HWND,
handler: extern "C" fn(*mut uiControl,
HWND,
WORD,
*mut LRESULT)
-> BOOL,
c: *mut uiControl);
pub fn uiWindowsUnregisterWM_HSCROLLHandler(hwnd: HWND);
pub fn uiWindowsRegisterReceiveWM_WININICHANGE(hwnd: HWND);
pub fn uiWindowsUnregisterReceiveWM_WININICHANGE(hwnd: HWND);
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct uiWindowsSizing {
pub BaseX: c_int,
pub BaseY: c_int,
pub InternalLeading: LONG,
}
extern {
pub fn uiWindowsGetSizing(hwnd: HWND, sizing: *mut uiWindowsSizing);
pub fn uiWindowsSizingDlgUnitsToPixels(sizing: *mut uiWindowsSizing,
x: *mut c_int,
y: *mut c_int);
pub fn uiWindowsSizingStandardPadding(sizing: *mut uiWindowsSizing,
x: *mut c_int,
y: *mut c_int);
pub fn uiWindowsMakeContainer(c: *mut uiWindowsControl,
onResize: extern "C" fn(*mut uiWindowsControl) -> HWND)
-> HWND;
pub fn uiWindowsControlTooSmall(c: *mut uiWindowsControl) -> BOOL;
pub fn uiWindowsControlContinueMinimumSizeChanged(c: *mut uiWindowsControl);
pub fn uiWindowsControlAssignSoleControlIDZOrder(control: *mut uiWindowsControl);
pub fn uiWindowsShouldStopSyncEnableState(c: *mut uiWindowsControl, enabled: c_int) -> BOOL;
}
#[repr(C)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct NMHDR {
pub hwndFrom: HWND,
pub idFrom: UINT_PTR,
pub code: UINT,
}
#[repr(C)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct RECT {
pub left: LONG,
pub top: LONG,
pub right: LONG,
pub bottom: LONG,
}
pub type BOOL = c_int;
pub type DWORD = c_ulong;
pub type HANDLE = PVOID;
pub type HINSTANCE = HANDLE;
pub type HWND = HANDLE;
pub type LONG = c_long;
#[cfg(target_pointer_width = "64")]
pub type LONG_PTR = i64;
#[cfg(not(target_pointer_width = "64"))]
pub type LONG_PTR = c_long;
pub type LPCWSTR = *const WCHAR;
pub type LPVOID = *mut c_void;
pub type LRESULT = LONG_PTR;
pub type PVOID = *mut c_void;
pub type UINT = c_uint;
#[cfg(target_pointer_width = "64")]
pub type UINT_PTR = u64;
#[cfg(not(target_pointer_width = "64"))]
pub type UINT_PTR = c_uint;
pub type WCHAR = wchar_t;
pub type WORD = c_ushort;