Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 387cea8

Browse files
committed
Support: add a managed bursh
Sort the managed handles to make new ones easier to find. Add a new managed handle type for brushes. This Windows type is used for painting a region.
1 parent 1d56145 commit 387cea8

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

‎Sources/SwiftWin32/Support/WindowsHandle+UIExtensions.swift‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,27 @@
33

44
import WinSDK
55

6-
extension HFONT__: HandleValue {
7-
typealias HandleType = HFONT
8-
internal static func release(_ hFont: HandleType?) {
9-
if let hFont = hFont {
10-
DeleteObject(hFont)
6+
extension HBITMAP__: HandleValue {
7+
typealias HandleType = HBITMAP
8+
internal static func release(_ hBitmap: HandleType?) {
9+
if let hBitmap = hBitmap {
10+
DeleteObject(hBitmap)
1111
}
1212
}
1313
}
1414

15-
internal typealias FontHandle = ManagedHandle<HFONT__>
15+
internal typealias BitmapHandle = ManagedHandle<HBITMAP__>
16+
17+
extension HBRUSH__: HandleValue {
18+
typealias HandleType = HBRUSH
19+
internal static func release(_ hBrush: HandleType?) {
20+
if let hBrush = hBrush {
21+
DeleteObject(hBrush)
22+
}
23+
}
24+
}
25+
26+
internal typealias BrushHandle = ManagedHandle<HBRUSH__>
1627

1728
extension HDC__: HandleValue {
1829
typealias HandleType = HDC
@@ -25,15 +36,16 @@ extension HDC__: HandleValue {
2536

2637
internal typealias DeviceContextHandle = ManagedHandle<HDC__>
2738

28-
extension HBITMAP__: HandleValue {
29-
typealias HandleType = HBITMAP
30-
internal static func release(_ hBitmap: HandleType?) {
31-
if let hBitmap = hBitmap {
32-
DeleteObject(hBitmap)
39+
extension HFONT__: HandleValue {
40+
typealias HandleType = HFONT
41+
internal static func release(_ hFont: HandleType?) {
42+
if let hFont = hFont {
43+
DeleteObject(hFont)
3344
}
3445
}
3546
}
36-
internal typealias BitmapHandle = ManagedHandle<HBITMAP__>
47+
48+
internal typealias FontHandle = ManagedHandle<HFONT__>
3749

3850
extension HMENU: HandleValue {
3951
typealias HandleType = HMENU

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /