-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebview_dwebbrowserevents2.go
122 lines (97 loc) · 3.18 KB
/
webview_dwebbrowserevents2.go
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
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package walk
import (
"syscall"
"unsafe"
)
import (
"github.com/lxn/win"
)
var webViewDWebBrowserEvents2Vtbl *win.DWebBrowserEvents2Vtbl
func init() {
webViewDWebBrowserEvents2Vtbl = &win.DWebBrowserEvents2Vtbl{
syscall.NewCallback(webView_DWebBrowserEvents2_QueryInterface),
syscall.NewCallback(webView_DWebBrowserEvents2_AddRef),
syscall.NewCallback(webView_DWebBrowserEvents2_Release),
syscall.NewCallback(webView_DWebBrowserEvents2_GetTypeInfoCount),
syscall.NewCallback(webView_DWebBrowserEvents2_GetTypeInfo),
syscall.NewCallback(webView_DWebBrowserEvents2_GetIDsOfNames),
syscall.NewCallback(webView_DWebBrowserEvents2_Invoke),
}
}
type webViewDWebBrowserEvents2 struct {
win.DWebBrowserEvents2
}
func webView_DWebBrowserEvents2_QueryInterface(wbe2 *webViewDWebBrowserEvents2, riid win.REFIID, ppvObject *unsafe.Pointer) uintptr {
// Just reuse the QueryInterface implementation we have for IOleClientSite.
// We need to adjust object, which initially points at our
// webViewDWebBrowserEvents2, so it refers to the containing
// webViewIOleClientSite for the call.
var clientSite win.IOleClientSite
var webViewInPlaceSite webViewIOleInPlaceSite
var docHostUIHandler webViewIDocHostUIHandler
ptr := uintptr(unsafe.Pointer(wbe2)) -
uintptr(unsafe.Sizeof(clientSite)) -
uintptr(unsafe.Sizeof(webViewInPlaceSite)) -
uintptr(unsafe.Sizeof(docHostUIHandler))
return webView_IOleClientSite_QueryInterface((*webViewIOleClientSite)(unsafe.Pointer(ptr)), riid, ppvObject)
}
func webView_DWebBrowserEvents2_AddRef(args *uintptr) uintptr {
return 1
}
func webView_DWebBrowserEvents2_Release(args *uintptr) uintptr {
return 1
}
func webView_DWebBrowserEvents2_GetTypeInfoCount(args *uintptr) uintptr {
/* p := (*struct {
wbe2 *webViewDWebBrowserEvents2
pctinfo *uint
})(unsafe.Pointer(args))
*p.pctinfo = 0
return S_OK*/
return win.E_NOTIMPL
}
func webView_DWebBrowserEvents2_GetTypeInfo(args *uintptr) uintptr {
/* p := (*struct {
wbe2 *webViewDWebBrowserEvents2
})(unsafe.Pointer(args))
unsigned int iTInfo,
LCID lcid,
ITypeInfo FAR* FAR* ppTInfo*/
return win.E_NOTIMPL
}
func webView_DWebBrowserEvents2_GetIDsOfNames(args *uintptr) uintptr {
/* p := (*struct {
wbe2 *webViewDWebBrowserEvents2
riid REFIID
rgszNames **uint16
cNames uint32
lcid LCID
rgDispId *DISPID
})(unsafe.Pointer(args))*/
return win.E_NOTIMPL
}
func webView_DWebBrowserEvents2_Invoke(
wbe2 *webViewDWebBrowserEvents2,
dispIdMember win.DISPID,
riid win.REFIID,
lcid uint32, // LCID
wFlags uint16,
pDispParams *win.DISPPARAMS,
pVarResult *win.VARIANT,
pExcepInfo unsafe.Pointer, // *EXCEPINFO
puArgErr *uint32) uintptr {
var wb WidgetBase
var wvcs webViewIOleClientSite
wv := (*WebView)(unsafe.Pointer(uintptr(unsafe.Pointer(wbe2)) +
uintptr(unsafe.Sizeof(*wbe2)) -
uintptr(unsafe.Sizeof(wvcs)) -
uintptr(unsafe.Sizeof(wb))))
switch dispIdMember {
case win.DISPID_NAVIGATECOMPLETE2:
wv.urlChangedPublisher.Publish()
}
return win.DISP_E_MEMBERNOTFOUND
}