windows_gui 4.0.0 → 4.0.1
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/Scribble.rbw +8 -8
- data/lib/windows_gui/common.rb +1 -1
- data/lib/windows_gui/user.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e252645f441188b5153bc976d7f207dda3229df
|
4
|
+
data.tar.gz: 455f36ab22546e9f48f4de1d3fcdbfbed06d0fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a42a9d6d3b6c3f8fa00195a0762801ec1c41837d6c91ede5c88aa42383683515c6410ccf68e28fe3f7c25509168f183bac6691600e5573efa098a78f3478a2a1
|
7
|
+
data.tar.gz: ed34353ffe28a1cf53451084ce27369471462a11020e3e23c383857fead66d4cd60330f7fdc02be60395c5713e76933919554c4da2dd9fb6d8f8dbe06bf3c63c
|
data/RELNOTES.md
CHANGED
data/examples/Scribble.rbw
CHANGED
@@ -13,7 +13,7 @@ def OnCreate(hwnd,
|
|
13
13
|
)
|
14
14
|
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
15
15
|
|
16
|
-
LOGPEN.new { |lp|
|
16
|
+
UsingFFIStructs(LOGPEN.new) { |lp|
|
17
17
|
lp[:lopnWidth][:x] = DPIAwareX(10)
|
18
18
|
lp[:lopnColor] = RGB(255, 0, 0)
|
19
19
|
|
@@ -38,7 +38,7 @@ def OnPaint(hwnd,
|
|
38
38
|
)
|
39
39
|
xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
|
40
40
|
|
41
|
-
|
41
|
+
UsingGDIObjects(ps[:hdc], xtra[:hpen]) {
|
42
42
|
xtra[:scribbles].each { |scribble|
|
43
43
|
MoveToEx(ps[:hdc], *scribble[0], nil)
|
44
44
|
|
@@ -61,7 +61,7 @@ def OnLButtonDown(hwnd,
|
|
61
61
|
xtra[:curpos] = [x, y]
|
62
62
|
xtra[:scribbles] << [[x, y]]
|
63
63
|
|
64
|
-
RECT.new { |rect|
|
64
|
+
UsingFFIStructs(RECT.new) { |rect|
|
65
65
|
SetRect(rect, x, y, x, y)
|
66
66
|
InflateRect(rect, *DPIAwareXY(5, 5))
|
67
67
|
InvalidateRect(hwnd, rect, 1)
|
@@ -87,8 +87,8 @@ def OnMouseMove(hwnd,
|
|
87
87
|
|
88
88
|
xtra[:scribbles].last << [x, y]
|
89
89
|
|
90
|
-
|
91
|
-
|
90
|
+
UsingDC(hwnd) { |hdc|
|
91
|
+
UsingGDIObjects(hdc, xtra[:hpen]) {
|
92
92
|
MoveToEx(hdc, *xtra[:curpos], nil)
|
93
93
|
LineTo(hdc, x, y)
|
94
94
|
|
@@ -167,7 +167,7 @@ end
|
|
167
167
|
def WinMain
|
168
168
|
Id2RefTrack(xtra = WndExtra.new)
|
169
169
|
|
170
|
-
WNDCLASSEX.new { |wc|
|
170
|
+
UsingFFIStructs(WNDCLASSEX.new) { |wc|
|
171
171
|
wc[:cbSize] = wc.size
|
172
172
|
wc[:lpfnWndProc] = WindowProc
|
173
173
|
wc[:cbWndExtra] = FFI::Type::Builtin::POINTER.size
|
@@ -176,7 +176,7 @@ def WinMain
|
|
176
176
|
wc[:hCursor] = LoadCursor(nil, IDC_CROSS)
|
177
177
|
wc[:hbrBackground] = FFI::Pointer.new(COLOR_WINDOW + 1)
|
178
178
|
|
179
|
-
PWSTR(APPNAME) { |className|
|
179
|
+
UsingFFIMemoryPointers(PWSTR(APPNAME)) { |className|
|
180
180
|
wc[:lpszClassName] = className
|
181
181
|
|
182
182
|
DetonateLastError(0, :RegisterClassEx,
|
@@ -199,7 +199,7 @@ def WinMain
|
|
199
199
|
ShowWindow(hwnd, SW_SHOWNORMAL)
|
200
200
|
UpdateWindow(hwnd)
|
201
201
|
|
202
|
-
MSG.new { |msg|
|
202
|
+
UsingFFIStructs(MSG.new) { |msg|
|
203
203
|
until DetonateLastError(-1, :GetMessage,
|
204
204
|
msg, nil, 0, 0
|
205
205
|
) == 0
|
data/lib/windows_gui/common.rb
CHANGED
data/lib/windows_gui/user.rb
CHANGED