windows_gui 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/RELNOTES.md +4 -0
- data/examples/Command.rbw +5 -5
- data/examples/Layered.rbw +2 -2
- data/examples/LifeCycle.rbw +2 -2
- data/examples/LifeCycleNC.rbw +2 -2
- data/examples/Menu.rbw +5 -5
- data/examples/MenuContext.rbw +6 -6
- data/examples/MenuPARGB32.rbw +5 -5
- data/examples/MinMax.rbw +2 -2
- data/examples/Minimal.rbw +2 -2
- data/examples/Paint.rbw +6 -6
- data/examples/Region.rbw +2 -2
- data/examples/Scribble.rbw +9 -9
- data/examples/WndExtra.rbw +5 -5
- data/lib/windows_gui/common.rb +34 -36
- data/lib/windows_gui/gdi.rb +3 -3
- data/lib/windows_gui/kernel.rb +10 -2
- data/lib/windows_gui/libc.rb +1 -1
- data/lib/windows_gui/user.rb +23 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e0e923bcf857c772ac3991211447a2cd855220f
|
4
|
+
data.tar.gz: 70570896e71622bcc9910319c22b8573ad0c1de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d41d0b0068942cd263a688fc0b464690fc9ec15de71183b825c95e49f3f94693150d50fb64e2d01f4618df0fe7d8a26a6c5bc33f4f58a95ce44327e33952332
|
7
|
+
data.tar.gz: 10ef1d3624ebdfe89505ee90f009214d120ded80ad8d58de864ce2cde81515f6539ae3586aa862d7dbd73f3f20589485523e7933dee1bc2c5a9de8b76122562a
|
data/RELNOTES.md
CHANGED
data/examples/Command.rbw
CHANGED
@@ -10,7 +10,7 @@ WndExtra = Struct.new(
|
|
10
10
|
def OnCreate(hwnd,
|
11
11
|
cs
|
12
12
|
)
|
13
|
-
xtra =
|
13
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
14
14
|
|
15
15
|
hsys = GetSystemMenu(hwnd, 0)
|
16
16
|
InsertMenu(hsys, SC_CLOSE, MF_STRING, SYSCMD[:ITEM1], L("Item&1\tAlt+S"))
|
@@ -63,7 +63,7 @@ def OnCreate(hwnd,
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def OnDestroy(hwnd)
|
66
|
-
xtra =
|
66
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
67
67
|
|
68
68
|
DestroyAcceleratorTable(xtra[:haccel])
|
69
69
|
DeleteObject(xtra[:hmf])
|
@@ -189,7 +189,7 @@ rescue SystemExit => ex
|
|
189
189
|
PostQuitMessage(ex.status)
|
190
190
|
rescue
|
191
191
|
case MessageBox(hwnd,
|
192
|
-
L(
|
192
|
+
L(FormatException($!)),
|
193
193
|
APPNAME,
|
194
194
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
195
195
|
)
|
@@ -202,7 +202,7 @@ end
|
|
202
202
|
}
|
203
203
|
|
204
204
|
def WinMain
|
205
|
-
|
205
|
+
Id2RefTrack(xtra = WndExtra.new)
|
206
206
|
|
207
207
|
WNDCLASSEX.new { |wc|
|
208
208
|
wc[:cbSize] = wc.size
|
@@ -252,7 +252,7 @@ def WinMain
|
|
252
252
|
}
|
253
253
|
rescue
|
254
254
|
MessageBox(hwnd,
|
255
|
-
L(
|
255
|
+
L(FormatException($!)),
|
256
256
|
APPNAME,
|
257
257
|
MB_ICONERROR
|
258
258
|
); exit(1)
|
data/examples/Layered.rbw
CHANGED
@@ -31,7 +31,7 @@ rescue SystemExit => ex
|
|
31
31
|
PostQuitMessage(ex.status)
|
32
32
|
rescue
|
33
33
|
case MessageBox(hwnd,
|
34
|
-
L(
|
34
|
+
L(FormatException($!)),
|
35
35
|
APPNAME,
|
36
36
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
37
37
|
)
|
@@ -87,7 +87,7 @@ def WinMain
|
|
87
87
|
}
|
88
88
|
rescue
|
89
89
|
MessageBox(hwnd,
|
90
|
-
L(
|
90
|
+
L(FormatException($!)),
|
91
91
|
APPNAME,
|
92
92
|
MB_ICONERROR
|
93
93
|
); exit(1)
|
data/examples/LifeCycle.rbw
CHANGED
@@ -58,7 +58,7 @@ rescue SystemExit => ex
|
|
58
58
|
PostQuitMessage(ex.status)
|
59
59
|
rescue
|
60
60
|
case MessageBox(hwnd,
|
61
|
-
L(
|
61
|
+
L(FormatException($!)),
|
62
62
|
APPNAME,
|
63
63
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
64
64
|
)
|
@@ -114,7 +114,7 @@ def WinMain
|
|
114
114
|
}
|
115
115
|
rescue
|
116
116
|
MessageBox(hwnd,
|
117
|
-
L(
|
117
|
+
L(FormatException($!)),
|
118
118
|
APPNAME,
|
119
119
|
MB_ICONERROR
|
120
120
|
); exit(1)
|
data/examples/LifeCycleNC.rbw
CHANGED
@@ -88,7 +88,7 @@ rescue SystemExit => ex
|
|
88
88
|
PostQuitMessage(ex.status)
|
89
89
|
rescue
|
90
90
|
case MessageBox(hwnd,
|
91
|
-
L(
|
91
|
+
L(FormatException($!)),
|
92
92
|
APPNAME,
|
93
93
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
94
94
|
)
|
@@ -144,7 +144,7 @@ def WinMain
|
|
144
144
|
}
|
145
145
|
rescue
|
146
146
|
MessageBox(hwnd,
|
147
|
-
L(
|
147
|
+
L(FormatException($!)),
|
148
148
|
APPNAME,
|
149
149
|
MB_ICONERROR
|
150
150
|
); exit(1)
|
data/examples/Menu.rbw
CHANGED
@@ -9,7 +9,7 @@ WndExtra = Struct.new(
|
|
9
9
|
def OnCreate(hwnd,
|
10
10
|
cs
|
11
11
|
)
|
12
|
-
xtra =
|
12
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
13
13
|
|
14
14
|
hbar = CreateMenu()
|
15
15
|
hmenu1 = CreatePopupMenu()
|
@@ -45,7 +45,7 @@ def OnCreate(hwnd,
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def OnDestroy(hwnd)
|
48
|
-
xtra =
|
48
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
49
49
|
|
50
50
|
PostQuitMessage(0); 0
|
51
51
|
end
|
@@ -206,7 +206,7 @@ rescue SystemExit => ex
|
|
206
206
|
PostQuitMessage(ex.status)
|
207
207
|
rescue
|
208
208
|
case MessageBox(hwnd,
|
209
|
-
L(
|
209
|
+
L(FormatException($!)),
|
210
210
|
APPNAME,
|
211
211
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
212
212
|
)
|
@@ -219,7 +219,7 @@ end
|
|
219
219
|
}
|
220
220
|
|
221
221
|
def WinMain
|
222
|
-
|
222
|
+
Id2RefTrack(xtra = WndExtra.new)
|
223
223
|
|
224
224
|
WNDCLASSEX.new { |wc|
|
225
225
|
wc[:cbSize] = wc.size
|
@@ -265,7 +265,7 @@ def WinMain
|
|
265
265
|
}
|
266
266
|
rescue
|
267
267
|
MessageBox(hwnd,
|
268
|
-
L(
|
268
|
+
L(FormatException($!)),
|
269
269
|
APPNAME,
|
270
270
|
MB_ICONERROR
|
271
271
|
); exit(1)
|
data/examples/MenuContext.rbw
CHANGED
@@ -9,7 +9,7 @@ WndExtra = Struct.new(
|
|
9
9
|
def OnCreate(hwnd,
|
10
10
|
cs
|
11
11
|
)
|
12
|
-
xtra =
|
12
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
13
13
|
|
14
14
|
xtra[:hcm] = CreatePopupMenu()
|
15
15
|
AppendMenu(xtra[:hcm], MF_STRING, CMD[:ITEM1], L('Item&1'))
|
@@ -18,7 +18,7 @@ def OnCreate(hwnd,
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def OnDestroy(hwnd)
|
21
|
-
xtra =
|
21
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
22
22
|
|
23
23
|
DestroyMenu(xtra[:hcm])
|
24
24
|
|
@@ -28,7 +28,7 @@ end
|
|
28
28
|
def OnContextMenu(hwnd,
|
29
29
|
x, y
|
30
30
|
)
|
31
|
-
xtra =
|
31
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
32
32
|
|
33
33
|
POINT.new { |point|
|
34
34
|
GetCursorPos(point)
|
@@ -90,7 +90,7 @@ rescue SystemExit => ex
|
|
90
90
|
PostQuitMessage(ex.status)
|
91
91
|
rescue
|
92
92
|
case MessageBox(hwnd,
|
93
|
-
L(
|
93
|
+
L(FormatException($!)),
|
94
94
|
APPNAME,
|
95
95
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
96
96
|
)
|
@@ -103,7 +103,7 @@ end
|
|
103
103
|
}
|
104
104
|
|
105
105
|
def WinMain
|
106
|
-
|
106
|
+
Id2RefTrack(xtra = WndExtra.new)
|
107
107
|
|
108
108
|
WNDCLASSEX.new { |wc|
|
109
109
|
wc[:cbSize] = wc.size
|
@@ -149,7 +149,7 @@ def WinMain
|
|
149
149
|
}
|
150
150
|
rescue
|
151
151
|
MessageBox(hwnd,
|
152
|
-
L(
|
152
|
+
L(FormatException($!)),
|
153
153
|
APPNAME,
|
154
154
|
MB_ICONERROR
|
155
155
|
); exit(1)
|
data/examples/MenuPARGB32.rbw
CHANGED
@@ -13,7 +13,7 @@ WndExtra = Struct.new(
|
|
13
13
|
def OnCreate(hwnd,
|
14
14
|
cs
|
15
15
|
)
|
16
|
-
xtra =
|
16
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
17
17
|
|
18
18
|
xtra[:hbmp] = DetonateLastError(FFI::Pointer::NULL, :LoadImage,
|
19
19
|
nil,
|
@@ -77,7 +77,7 @@ ensure
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def OnDestroy(hwnd)
|
80
|
-
xtra =
|
80
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
81
81
|
|
82
82
|
DeleteObject(xtra[:hbmp])
|
83
83
|
|
@@ -240,7 +240,7 @@ rescue SystemExit => ex
|
|
240
240
|
PostQuitMessage(ex.status)
|
241
241
|
rescue
|
242
242
|
case MessageBox(hwnd,
|
243
|
-
L(
|
243
|
+
L(FormatException($!)),
|
244
244
|
APPNAME,
|
245
245
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
246
246
|
)
|
@@ -253,7 +253,7 @@ end
|
|
253
253
|
}
|
254
254
|
|
255
255
|
def WinMain
|
256
|
-
|
256
|
+
Id2RefTrack(xtra = WndExtra.new)
|
257
257
|
|
258
258
|
WNDCLASSEX.new { |wc|
|
259
259
|
wc[:cbSize] = wc.size
|
@@ -299,7 +299,7 @@ def WinMain
|
|
299
299
|
}
|
300
300
|
rescue
|
301
301
|
MessageBox(hwnd,
|
302
|
-
L(
|
302
|
+
L(FormatException($!)),
|
303
303
|
APPNAME,
|
304
304
|
MB_ICONERROR
|
305
305
|
); exit(1)
|
data/examples/MinMax.rbw
CHANGED
@@ -33,7 +33,7 @@ rescue SystemExit => ex
|
|
33
33
|
PostQuitMessage(ex.status)
|
34
34
|
rescue
|
35
35
|
case MessageBox(hwnd,
|
36
|
-
L(
|
36
|
+
L(FormatException($!)),
|
37
37
|
APPNAME,
|
38
38
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
39
39
|
)
|
@@ -89,7 +89,7 @@ def WinMain
|
|
89
89
|
}
|
90
90
|
rescue
|
91
91
|
MessageBox(hwnd,
|
92
|
-
L(
|
92
|
+
L(FormatException($!)),
|
93
93
|
APPNAME,
|
94
94
|
MB_ICONERROR
|
95
95
|
); exit(1)
|
data/examples/Minimal.rbw
CHANGED
@@ -21,7 +21,7 @@ rescue SystemExit => ex
|
|
21
21
|
PostQuitMessage(ex.status)
|
22
22
|
rescue
|
23
23
|
case MessageBox(hwnd,
|
24
|
-
L(
|
24
|
+
L(FormatException($!)),
|
25
25
|
APPNAME,
|
26
26
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
27
27
|
)
|
@@ -77,7 +77,7 @@ def WinMain
|
|
77
77
|
}
|
78
78
|
rescue
|
79
79
|
MessageBox(hwnd,
|
80
|
-
L(
|
80
|
+
L(FormatException($!)),
|
81
81
|
APPNAME,
|
82
82
|
MB_ICONERROR
|
83
83
|
); exit(1)
|
data/examples/Paint.rbw
CHANGED
@@ -9,7 +9,7 @@ WndExtra = Struct.new(
|
|
9
9
|
def OnCreate(hwnd,
|
10
10
|
cs
|
11
11
|
)
|
12
|
-
xtra =
|
12
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
13
13
|
|
14
14
|
LOGFONT.new { |lf|
|
15
15
|
lf[:lfHeight] = DPIAwareFontHeight(16)
|
@@ -23,7 +23,7 @@ def OnCreate(hwnd,
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def OnDestroy(hwnd)
|
26
|
-
xtra =
|
26
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
27
27
|
|
28
28
|
DeleteObject(xtra[:hfont])
|
29
29
|
|
@@ -33,7 +33,7 @@ end
|
|
33
33
|
def OnPaint(hwnd,
|
34
34
|
ps
|
35
35
|
)
|
36
|
-
xtra =
|
36
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
37
37
|
|
38
38
|
SetBkColor(ps[:hdc], RGB(255, 0, 0))
|
39
39
|
SetTextColor(ps[:hdc], RGB(255, 255, 255))
|
@@ -83,7 +83,7 @@ rescue SystemExit => ex
|
|
83
83
|
PostQuitMessage(ex.status)
|
84
84
|
rescue
|
85
85
|
case MessageBox(hwnd,
|
86
|
-
L(
|
86
|
+
L(FormatException($!)),
|
87
87
|
APPNAME,
|
88
88
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
89
89
|
)
|
@@ -96,7 +96,7 @@ end
|
|
96
96
|
}
|
97
97
|
|
98
98
|
def WinMain
|
99
|
-
|
99
|
+
Id2RefTrack(xtra = WndExtra.new)
|
100
100
|
|
101
101
|
WNDCLASSEX.new { |wc|
|
102
102
|
wc[:cbSize] = wc.size
|
@@ -142,7 +142,7 @@ def WinMain
|
|
142
142
|
}
|
143
143
|
rescue
|
144
144
|
MessageBox(hwnd,
|
145
|
-
L(
|
145
|
+
L(FormatException($!)),
|
146
146
|
APPNAME,
|
147
147
|
MB_ICONERROR
|
148
148
|
); exit(1)
|
data/examples/Region.rbw
CHANGED
@@ -34,7 +34,7 @@ rescue SystemExit => ex
|
|
34
34
|
PostQuitMessage(ex.status)
|
35
35
|
rescue
|
36
36
|
case MessageBox(hwnd,
|
37
|
-
L(
|
37
|
+
L(FormatException($!)),
|
38
38
|
APPNAME,
|
39
39
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
40
40
|
)
|
@@ -90,7 +90,7 @@ def WinMain
|
|
90
90
|
}
|
91
91
|
rescue
|
92
92
|
MessageBox(hwnd,
|
93
|
-
L(
|
93
|
+
L(FormatException($!)),
|
94
94
|
APPNAME,
|
95
95
|
MB_ICONERROR
|
96
96
|
); exit(1)
|
data/examples/Scribble.rbw
CHANGED
@@ -11,7 +11,7 @@ WndExtra = Struct.new(
|
|
11
11
|
def OnCreate(hwnd,
|
12
12
|
cs
|
13
13
|
)
|
14
|
-
xtra =
|
14
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
15
15
|
|
16
16
|
LOGPEN.new { |lp|
|
17
17
|
lp[:lopnWidth][:x] = DPIAwareX(10)
|
@@ -26,7 +26,7 @@ def OnCreate(hwnd,
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def OnDestroy(hwnd)
|
29
|
-
xtra =
|
29
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
30
30
|
|
31
31
|
DeleteObject(xtra[:hpen])
|
32
32
|
|
@@ -36,7 +36,7 @@ end
|
|
36
36
|
def OnPaint(hwnd,
|
37
37
|
ps
|
38
38
|
)
|
39
|
-
xtra =
|
39
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
40
40
|
|
41
41
|
UseObjects(ps[:hdc], xtra[:hpen]) {
|
42
42
|
xtra[:scribbles].each { |scribble|
|
@@ -56,7 +56,7 @@ def OnLButtonDown(hwnd,
|
|
56
56
|
)
|
57
57
|
SetCapture(hwnd)
|
58
58
|
|
59
|
-
xtra =
|
59
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
60
60
|
|
61
61
|
xtra[:curpos] = [x, y]
|
62
62
|
xtra[:scribbles] << [[x, y]]
|
@@ -83,7 +83,7 @@ def OnMouseMove(hwnd,
|
|
83
83
|
)
|
84
84
|
return 0 if GetCapture() != hwnd
|
85
85
|
|
86
|
-
xtra =
|
86
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
87
87
|
|
88
88
|
xtra[:scribbles].last << [x, y]
|
89
89
|
|
@@ -104,7 +104,7 @@ def OnRButtonDown(hwnd,
|
|
104
104
|
)
|
105
105
|
return 0 if GetCapture() == hwnd
|
106
106
|
|
107
|
-
xtra =
|
107
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
108
108
|
|
109
109
|
xtra[:scribbles].clear
|
110
110
|
|
@@ -152,7 +152,7 @@ rescue SystemExit => ex
|
|
152
152
|
PostQuitMessage(ex.status)
|
153
153
|
rescue
|
154
154
|
case MessageBox(hwnd,
|
155
|
-
L(
|
155
|
+
L(FormatException($!)),
|
156
156
|
APPNAME,
|
157
157
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
158
158
|
)
|
@@ -165,7 +165,7 @@ end
|
|
165
165
|
}
|
166
166
|
|
167
167
|
def WinMain
|
168
|
-
|
168
|
+
Id2RefTrack(xtra = WndExtra.new)
|
169
169
|
|
170
170
|
WNDCLASSEX.new { |wc|
|
171
171
|
wc[:cbSize] = wc.size
|
@@ -211,7 +211,7 @@ def WinMain
|
|
211
211
|
}
|
212
212
|
rescue
|
213
213
|
MessageBox(hwnd,
|
214
|
-
L(
|
214
|
+
L(FormatException($!)),
|
215
215
|
APPNAME,
|
216
216
|
MB_ICONERROR
|
217
217
|
); exit(1)
|
data/examples/WndExtra.rbw
CHANGED
@@ -9,7 +9,7 @@ WndExtra = Struct.new(
|
|
9
9
|
def OnCreate(hwnd,
|
10
10
|
cs
|
11
11
|
)
|
12
|
-
xtra =
|
12
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
13
13
|
|
14
14
|
xtra[:foo] = L('Foo')
|
15
15
|
|
@@ -17,7 +17,7 @@ def OnCreate(hwnd,
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def OnDestroy(hwnd)
|
20
|
-
xtra =
|
20
|
+
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
21
21
|
|
22
22
|
MessageBox(nil,
|
23
23
|
xtra[:foo],
|
@@ -54,7 +54,7 @@ rescue SystemExit => ex
|
|
54
54
|
PostQuitMessage(ex.status)
|
55
55
|
rescue
|
56
56
|
case MessageBox(hwnd,
|
57
|
-
L(
|
57
|
+
L(FormatException($!)),
|
58
58
|
APPNAME,
|
59
59
|
MB_ABORTRETRYIGNORE | MB_ICONERROR
|
60
60
|
)
|
@@ -67,7 +67,7 @@ end
|
|
67
67
|
}
|
68
68
|
|
69
69
|
def WinMain
|
70
|
-
|
70
|
+
Id2RefTrack(xtra = WndExtra.new)
|
71
71
|
|
72
72
|
WNDCLASSEX.new { |wc|
|
73
73
|
wc[:cbSize] = wc.size
|
@@ -113,7 +113,7 @@ def WinMain
|
|
113
113
|
}
|
114
114
|
rescue
|
115
115
|
MessageBox(hwnd,
|
116
|
-
L(
|
116
|
+
L(FormatException($!)),
|
117
117
|
APPNAME,
|
118
118
|
MB_ICONERROR
|
119
119
|
); exit(1)
|
data/lib/windows_gui/common.rb
CHANGED
@@ -1,60 +1,58 @@
|
|
1
1
|
require 'weakref'
|
2
2
|
require 'ffi'
|
3
3
|
|
4
|
+
WINDOWS_GUI_VERSION = '3.0.0'
|
5
|
+
|
4
6
|
WINDOWS_GUI_VISUAL_STYLES = true unless defined?(WINDOWS_GUI_VISUAL_STYLES)
|
5
7
|
WINDOWS_GUI_DPI_AWARE = true unless defined?(WINDOWS_GUI_DPI_AWARE)
|
6
8
|
|
7
9
|
module WindowsGUI
|
8
10
|
extend FFI::Library
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
module Util
|
13
|
-
def FormatException(ex)
|
14
|
-
str, trace = ex.to_s, ex.backtrace
|
12
|
+
def FormatException(ex)
|
13
|
+
str, trace = ex.to_s, ex.backtrace
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
str
|
19
|
-
end
|
15
|
+
str << "\n\n-- backtrace --\n\n" << trace.join("\n") if trace
|
20
16
|
|
21
|
-
|
17
|
+
str
|
18
|
+
end
|
22
19
|
|
23
|
-
|
20
|
+
module_function :FormatException
|
24
21
|
|
25
|
-
|
26
|
-
Id2Ref[object.object_id] = WeakRef.new(object)
|
22
|
+
Id2Ref = {}
|
27
23
|
|
28
|
-
|
24
|
+
def Id2RefTrack(object)
|
25
|
+
Id2Ref[object.object_id] = WeakRef.new(object)
|
29
26
|
|
30
|
-
|
31
|
-
Id2Ref.delete(id)
|
27
|
+
p "Object id #{object.object_id} of #{object} stored in Id2Ref track hash" if $DEBUG
|
32
28
|
|
33
|
-
|
34
|
-
|
35
|
-
end
|
29
|
+
ObjectSpace.define_finalizer(object, -> id {
|
30
|
+
Id2Ref.delete(id)
|
36
31
|
|
37
|
-
|
32
|
+
p "Object id #{id} deleted from Id2Ref track hash" if $DEBUG
|
33
|
+
})
|
34
|
+
end
|
38
35
|
|
39
|
-
|
40
|
-
def new(*args)
|
41
|
-
raise ArgumentError, 'Cannot accept both arguments and a block' if
|
42
|
-
args.length > 0 && block_given?
|
36
|
+
module_function :Id2RefTrack
|
43
37
|
|
44
|
-
|
38
|
+
module AutoFFIStructClassSupport
|
39
|
+
def new(*args)
|
40
|
+
raise ArgumentError, 'Cannot accept both arguments and a block' if
|
41
|
+
args.length > 0 && block_given?
|
45
42
|
|
46
|
-
|
43
|
+
struct = super
|
47
44
|
|
48
|
-
|
49
|
-
yield struct
|
50
|
-
ensure
|
51
|
-
struct.pointer.free
|
45
|
+
return struct unless block_given?
|
52
46
|
|
53
|
-
|
54
|
-
|
47
|
+
begin
|
48
|
+
yield struct
|
49
|
+
ensure
|
50
|
+
struct.pointer.free
|
55
51
|
|
56
|
-
|
52
|
+
p "Native memory for #{struct} freed" if $DEBUG
|
57
53
|
end
|
54
|
+
|
55
|
+
nil
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
@@ -125,7 +123,7 @@ module WindowsGUI
|
|
125
123
|
APPNAME = L(File.basename($0, '.rbw'))
|
126
124
|
|
127
125
|
class POINT < FFI::Struct
|
128
|
-
extend
|
126
|
+
extend AutoFFIStructClassSupport
|
129
127
|
|
130
128
|
layout \
|
131
129
|
:x, :long,
|
@@ -133,7 +131,7 @@ module WindowsGUI
|
|
133
131
|
end
|
134
132
|
|
135
133
|
class SIZE < FFI::Struct
|
136
|
-
extend
|
134
|
+
extend AutoFFIStructClassSupport
|
137
135
|
|
138
136
|
layout \
|
139
137
|
:cx, :long,
|
@@ -141,7 +139,7 @@ module WindowsGUI
|
|
141
139
|
end
|
142
140
|
|
143
141
|
class RECT < FFI::Struct
|
144
|
-
extend
|
142
|
+
extend AutoFFIStructClassSupport
|
145
143
|
|
146
144
|
layout \
|
147
145
|
:left, :long,
|
data/lib/windows_gui/gdi.rb
CHANGED
@@ -102,7 +102,7 @@ module WindowsGUI
|
|
102
102
|
FF_DECORATIVE = 5 << 4
|
103
103
|
|
104
104
|
class LOGFONT < FFI::Struct
|
105
|
-
extend
|
105
|
+
extend AutoFFIStructClassSupport
|
106
106
|
|
107
107
|
layout \
|
108
108
|
:lfHeight, :long,
|
@@ -143,7 +143,7 @@ module WindowsGUI
|
|
143
143
|
HS_DIAGCROSS = 5
|
144
144
|
|
145
145
|
class LOGBRUSH < FFI::Struct
|
146
|
-
extend
|
146
|
+
extend AutoFFIStructClassSupport
|
147
147
|
|
148
148
|
layout \
|
149
149
|
:lbStyle, :uint,
|
@@ -177,7 +177,7 @@ module WindowsGUI
|
|
177
177
|
PS_JOIN_ROUND = 0x0000_0000
|
178
178
|
|
179
179
|
class LOGPEN < FFI::Struct
|
180
|
-
extend
|
180
|
+
extend AutoFFIStructClassSupport
|
181
181
|
|
182
182
|
layout \
|
183
183
|
:lopnStyle, :uint,
|
data/lib/windows_gui/kernel.rb
CHANGED
@@ -33,7 +33,7 @@ module WindowsGUI
|
|
33
33
|
module_function :Detonate, :DetonateLastError
|
34
34
|
|
35
35
|
class OSVERSIONINFOEX < FFI::Struct
|
36
|
-
extend
|
36
|
+
extend AutoFFIStructClassSupport
|
37
37
|
|
38
38
|
layout \
|
39
39
|
:dwOSVersionInfoSize, :ulong,
|
@@ -138,7 +138,7 @@ module WindowsGUI
|
|
138
138
|
|
139
139
|
if WINVER >= WINXP
|
140
140
|
class ACTCTX < FFI::Struct
|
141
|
-
extend
|
141
|
+
extend AutoFFIStructClassSupport
|
142
142
|
|
143
143
|
layout \
|
144
144
|
:cbSize, :ulong,
|
@@ -184,6 +184,12 @@ module WindowsGUI
|
|
184
184
|
COMMON_CONTROLS_ACTCTX[:handle] == INVALID_HANDLE_VALUE
|
185
185
|
|
186
186
|
COMMON_CONTROLS_ACTCTX[:cookie].free
|
187
|
+
|
188
|
+
COMMON_CONTROLS_ACTCTX[:handle] = INVALID_HANDLE_VALUE
|
189
|
+
COMMON_CONTROLS_ACTCTX[:cookie] = 0
|
190
|
+
COMMON_CONTROLS_ACTCTX[:activated] = false
|
191
|
+
|
192
|
+
p "Visual styles cleanup, COMMON_CONTROLS_ACTCTX is #{COMMON_CONTROLS_ACTCTX}" if $DEBUG
|
187
193
|
}
|
188
194
|
end
|
189
195
|
|
@@ -238,6 +244,8 @@ module WindowsGUI
|
|
238
244
|
}
|
239
245
|
|
240
246
|
COMMON_CONTROLS_ACTCTX[:activated] = true
|
247
|
+
|
248
|
+
p "Visual styles init, COMMON_CONTROLS_ACTCTX is #{COMMON_CONTROLS_ACTCTX}" if $DEBUG
|
241
249
|
end
|
242
250
|
|
243
251
|
module_function :EnableVisualStyles
|
data/lib/windows_gui/libc.rb
CHANGED
data/lib/windows_gui/user.rb
CHANGED
@@ -206,7 +206,7 @@ module WindowsGUI
|
|
206
206
|
], :int
|
207
207
|
|
208
208
|
class NONCLIENTMETRICS < FFI::Struct
|
209
|
-
extend
|
209
|
+
extend AutoFFIStructClassSupport
|
210
210
|
|
211
211
|
layout(*[
|
212
212
|
:cbSize, :uint,
|
@@ -461,7 +461,7 @@ module WindowsGUI
|
|
461
461
|
COLOR_MENU = 4
|
462
462
|
|
463
463
|
class WNDCLASSEX < FFI::Struct
|
464
|
-
extend
|
464
|
+
extend AutoFFIStructClassSupport
|
465
465
|
|
466
466
|
layout \
|
467
467
|
:cbSize, :uint,
|
@@ -625,7 +625,7 @@ module WindowsGUI
|
|
625
625
|
], :pointer
|
626
626
|
|
627
627
|
class DLGTEMPLATE < FFI::Struct
|
628
|
-
extend
|
628
|
+
extend AutoFFIStructClassSupport
|
629
629
|
|
630
630
|
layout \
|
631
631
|
:style, :ulong,
|
@@ -921,7 +921,7 @@ module WindowsGUI
|
|
921
921
|
SIF_DISABLENOSCROLL = 0x0008
|
922
922
|
|
923
923
|
class SCROLLINFO < FFI::Struct
|
924
|
-
extend
|
924
|
+
extend AutoFFIStructClassSupport
|
925
925
|
|
926
926
|
layout \
|
927
927
|
:cbSize, :uint,
|
@@ -1029,7 +1029,7 @@ module WindowsGUI
|
|
1029
1029
|
], :int
|
1030
1030
|
|
1031
1031
|
class PAINTSTRUCT < FFI::Struct
|
1032
|
-
extend
|
1032
|
+
extend AutoFFIStructClassSupport
|
1033
1033
|
|
1034
1034
|
layout \
|
1035
1035
|
:hdc, :pointer,
|
@@ -1136,7 +1136,7 @@ module WindowsGUI
|
|
1136
1136
|
MOUSEEVENTF_VIRTUALDESK = 0x4000
|
1137
1137
|
|
1138
1138
|
class MOUSEINPUT < FFI::Struct
|
1139
|
-
extend
|
1139
|
+
extend AutoFFIStructClassSupport
|
1140
1140
|
|
1141
1141
|
layout \
|
1142
1142
|
:dx, :long,
|
@@ -1153,7 +1153,7 @@ module WindowsGUI
|
|
1153
1153
|
KEYEVENTF_UNICODE = 0x0004
|
1154
1154
|
|
1155
1155
|
class KEYBDINPUT < FFI::Struct
|
1156
|
-
extend
|
1156
|
+
extend AutoFFIStructClassSupport
|
1157
1157
|
|
1158
1158
|
layout \
|
1159
1159
|
:wVk, :ushort,
|
@@ -1164,7 +1164,7 @@ module WindowsGUI
|
|
1164
1164
|
end
|
1165
1165
|
|
1166
1166
|
class HARDWAREINPUT < FFI::Struct
|
1167
|
-
extend
|
1167
|
+
extend AutoFFIStructClassSupport
|
1168
1168
|
|
1169
1169
|
layout \
|
1170
1170
|
:uMsg, :ulong,
|
@@ -1173,7 +1173,7 @@ module WindowsGUI
|
|
1173
1173
|
end
|
1174
1174
|
|
1175
1175
|
class INPUT < FFI::Struct
|
1176
|
-
extend
|
1176
|
+
extend AutoFFIStructClassSupport
|
1177
1177
|
|
1178
1178
|
layout \
|
1179
1179
|
:type, :ulong,
|
@@ -1234,7 +1234,7 @@ module WindowsGUI
|
|
1234
1234
|
HWND_BROADCAST = FFI::Pointer.new(0xffff)
|
1235
1235
|
|
1236
1236
|
class CREATESTRUCT < FFI::Struct
|
1237
|
-
extend
|
1237
|
+
extend AutoFFIStructClassSupport
|
1238
1238
|
|
1239
1239
|
layout \
|
1240
1240
|
:lpCreateParams, :pointer,
|
@@ -1270,7 +1270,7 @@ module WindowsGUI
|
|
1270
1270
|
WM_ENDSESSION = 0x0016
|
1271
1271
|
|
1272
1272
|
class STYLESTRUCT < FFI::Struct
|
1273
|
-
extend
|
1273
|
+
extend AutoFFIStructClassSupport
|
1274
1274
|
|
1275
1275
|
layout \
|
1276
1276
|
:styleOld, :ulong,
|
@@ -1299,7 +1299,7 @@ module WindowsGUI
|
|
1299
1299
|
WM_SHOWWINDOW = 0x0018
|
1300
1300
|
|
1301
1301
|
class MINMAXINFO < FFI::Struct
|
1302
|
-
extend
|
1302
|
+
extend AutoFFIStructClassSupport
|
1303
1303
|
|
1304
1304
|
layout \
|
1305
1305
|
:ptReserved, POINT,
|
@@ -1312,7 +1312,7 @@ module WindowsGUI
|
|
1312
1312
|
WM_GETMINMAXINFO = 0x0024
|
1313
1313
|
|
1314
1314
|
class WINDOWPOS < FFI::Struct
|
1315
|
-
extend
|
1315
|
+
extend AutoFFIStructClassSupport
|
1316
1316
|
|
1317
1317
|
layout \
|
1318
1318
|
:hwnd, :pointer,
|
@@ -1518,7 +1518,7 @@ module WindowsGUI
|
|
1518
1518
|
WM_COMMAND = 0x0111
|
1519
1519
|
|
1520
1520
|
class NMHDR < FFI::Struct
|
1521
|
-
extend
|
1521
|
+
extend AutoFFIStructClassSupport
|
1522
1522
|
|
1523
1523
|
layout \
|
1524
1524
|
:hwndFrom, :pointer,
|
@@ -1540,7 +1540,7 @@ module WindowsGUI
|
|
1540
1540
|
WM_CHARTOITEM = 0x002f
|
1541
1541
|
|
1542
1542
|
class DELETEITEMSTRUCT < FFI::Struct
|
1543
|
-
extend
|
1543
|
+
extend AutoFFIStructClassSupport
|
1544
1544
|
|
1545
1545
|
layout \
|
1546
1546
|
:CtlType, :uint,
|
@@ -1553,7 +1553,7 @@ module WindowsGUI
|
|
1553
1553
|
WM_DELETEITEM = 0x002d
|
1554
1554
|
|
1555
1555
|
class COMPAREITEMSTRUCT < FFI::Struct
|
1556
|
-
extend
|
1556
|
+
extend AutoFFIStructClassSupport
|
1557
1557
|
|
1558
1558
|
layout \
|
1559
1559
|
:CtlType, :uint,
|
@@ -1577,7 +1577,7 @@ module WindowsGUI
|
|
1577
1577
|
ODT_COMBOBOX = 3
|
1578
1578
|
|
1579
1579
|
class MEASUREITEMSTRUCT < FFI::Struct
|
1580
|
-
extend
|
1580
|
+
extend AutoFFIStructClassSupport
|
1581
1581
|
|
1582
1582
|
layout \
|
1583
1583
|
:CtlType, :uint,
|
@@ -1610,7 +1610,7 @@ module WindowsGUI
|
|
1610
1610
|
ODS_COMBOBOXEDIT = 0x1000
|
1611
1611
|
|
1612
1612
|
class DRAWITEMSTRUCT < FFI::Struct
|
1613
|
-
extend
|
1613
|
+
extend AutoFFIStructClassSupport
|
1614
1614
|
|
1615
1615
|
layout \
|
1616
1616
|
:CtlType, :uint,
|
@@ -1672,7 +1672,7 @@ module WindowsGUI
|
|
1672
1672
|
], :void
|
1673
1673
|
|
1674
1674
|
class MSG < FFI::Struct
|
1675
|
-
extend
|
1675
|
+
extend AutoFFIStructClassSupport
|
1676
1676
|
|
1677
1677
|
layout \
|
1678
1678
|
:hwnd, :pointer,
|
@@ -1862,7 +1862,7 @@ module WindowsGUI
|
|
1862
1862
|
MIIM_BITMAP = 0x0000_0080
|
1863
1863
|
|
1864
1864
|
class MENUITEMINFO < FFI::Struct
|
1865
|
-
extend
|
1865
|
+
extend AutoFFIStructClassSupport
|
1866
1866
|
|
1867
1867
|
layout \
|
1868
1868
|
:cbSize, :uint,
|
@@ -2022,7 +2022,7 @@ module WindowsGUI
|
|
2022
2022
|
VK_VOLUME_DOWN = 0xae
|
2023
2023
|
|
2024
2024
|
class ACCEL < FFI::Struct
|
2025
|
-
extend
|
2025
|
+
extend AutoFFIStructClassSupport
|
2026
2026
|
|
2027
2027
|
layout \
|
2028
2028
|
:fVirt, :uchar,
|
@@ -2401,7 +2401,7 @@ module WindowsGUI
|
|
2401
2401
|
CBS_NOINTEGRALHEIGHT = 0x0400
|
2402
2402
|
|
2403
2403
|
class COMBOBOXINFO < FFI::Struct
|
2404
|
-
extend
|
2404
|
+
extend AutoFFIStructClassSupport
|
2405
2405
|
|
2406
2406
|
layout \
|
2407
2407
|
:cbSize, :ulong,
|
@@ -2530,7 +2530,7 @@ module WindowsGUI
|
|
2530
2530
|
OBJID_CLIENT = 0xffff_fffc - 0x1_0000_0000
|
2531
2531
|
|
2532
2532
|
class SCROLLBARINFO < FFI::Struct
|
2533
|
-
extend
|
2533
|
+
extend AutoFFIStructClassSupport
|
2534
2534
|
|
2535
2535
|
layout \
|
2536
2536
|
:cbSize, :ulong,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: windows_gui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radoslav Peev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|