返回 DeepSeek-Reasonix
ICoreWebView2AcceleratorKeyPressedEventArgs.go
根目录 / desktop / third_party / go-webview2 / pkg / edge / ICoreWebView2AcceleratorKeyPressedEventArgs.go
1 //go:build windows
2
3 package edge
4
5 import (
6 "unsafe"
7
8 "golang.org/x/sys/windows"
9 )
10
11 type _ICoreWebView2AcceleratorKeyPressedEventArgsVtbl struct {
12 _IUnknownVtbl
13 GetKeyEventKind ComProc
14 GetVirtualKey ComProc
15 GetKeyEventLParam ComProc
16 GetPhysicalKeyStatus ComProc
17 GetHandled ComProc
18 PutHandled ComProc
19 }
20
21 type ICoreWebView2AcceleratorKeyPressedEventArgs struct {
22 vtbl *_ICoreWebView2AcceleratorKeyPressedEventArgsVtbl
23 }
24
25 func (i *ICoreWebView2AcceleratorKeyPressedEventArgs) AddRef() uint32 {
26 ret, _, _ := i.vtbl.AddRef.Call(uintptr(unsafe.Pointer(i)))
27
28 return uint32(ret)
29 }
30
31 func (i *ICoreWebView2AcceleratorKeyPressedEventArgs) Release() uint32 {
32 ret, _, _ := i.vtbl.Release.Call(uintptr(unsafe.Pointer(i)))
33
34 return uint32(ret)
35 }
36
37 func (i *ICoreWebView2AcceleratorKeyPressedEventArgs) GetKeyEventKind() (COREWEBVIEW2_KEY_EVENT_KIND, error) {
38 var keyEventKind COREWEBVIEW2_KEY_EVENT_KIND
39 hr, _, _ := i.vtbl.GetKeyEventKind.Call(
40 uintptr(unsafe.Pointer(i)),
41 uintptr(unsafe.Pointer(&keyEventKind)),
42 )
43 if windows.Handle(hr) != windows.S_OK {
44 return 0, windows.Errno(hr)
45 }
46 return keyEventKind, nil
47 }
48
49 func (i *ICoreWebView2AcceleratorKeyPressedEventArgs) GetVirtualKey() (uint, error) {
50 var virtualKey uint
51 hr, _, _ := i.vtbl.GetVirtualKey.Call(
52 uintptr(unsafe.Pointer(i)),
53 uintptr(unsafe.Pointer(&virtualKey)),
54 )
55 if windows.Handle(hr) != windows.S_OK {
56 return 0, windows.Errno(hr)
57 }
58 return virtualKey, nil
59 }
60
61 func (i *ICoreWebView2AcceleratorKeyPressedEventArgs) GetPhysicalKeyStatus() (COREWEBVIEW2_PHYSICAL_KEY_STATUS, error) {
62 var physicalKeyStatus internal_COREWEBVIEW2_PHYSICAL_KEY_STATUS
63 hr, _, _ := i.vtbl.GetPhysicalKeyStatus.Call(
64 uintptr(unsafe.Pointer(i)),
65 uintptr(unsafe.Pointer(&physicalKeyStatus)),
66 )
67 if windows.Handle(hr) != windows.S_OK {
68 return COREWEBVIEW2_PHYSICAL_KEY_STATUS{}, windows.Errno(hr)
69 }
70 return COREWEBVIEW2_PHYSICAL_KEY_STATUS{
71 RepeatCount: physicalKeyStatus.RepeatCount,
72 ScanCode: physicalKeyStatus.ScanCode,
73 IsExtendedKey: physicalKeyStatus.IsExtendedKey != 0,
74 IsMenuKeyDown: physicalKeyStatus.IsMenuKeyDown != 0,
75 WasKeyDown: physicalKeyStatus.WasKeyDown != 0,
76 IsKeyReleased: physicalKeyStatus.IsKeyReleased != 0,
77 }, nil
78 }
79
80 func (i *ICoreWebView2AcceleratorKeyPressedEventArgs) PutHandled(handled bool) error {
81 hr, _, _ := i.vtbl.PutHandled.Call(
82 uintptr(unsafe.Pointer(i)),
83 uintptr(boolToInt(handled)),
84 )
85 if windows.Handle(hr) != windows.S_OK {
86 return windows.Errno(hr)
87 }
88
89 return nil
90 }
91
91 lines GO