Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions webview.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ const (
HintMax = C.WEBVIEW_HINT_MAX
)

type NativeHandleKind = C.webview_native_handle_kind_t
const (
NativeHandleWindow NativeHandleKind = iota
NativeHandleWidget
NativeHandleBrowserController
)

type WebView interface {

// Run runs the main loop until it's terminated. After this function exits -
Expand All @@ -82,6 +89,9 @@ type WebView interface {
// NSWindow pointer, when using Win32 backend the pointer is HWND pointer.
Window() unsafe.Pointer

// NativeHandle returns a native handle based on the kind requested.
NativeHandle(NativeHandleKind) unsafe.Pointer

// SetTitle updates the title of the native window. Must be called from the UI
// thread.
SetTitle(title string)
Expand Down Expand Up @@ -158,6 +168,10 @@ func NewWindow(debug bool, window unsafe.Pointer) WebView {
return w
}

func (w *webview) NativeHandle(kind NativeHandleKind) unsafe.Pointer {
return C.webview_get_native_handle(w.w, kind)
}

func (w *webview) Destroy() {
C.webview_destroy(w.w)
}
Expand Down