-
-
Save abock/92a86b8cd36998db5a97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WebKitWebViewExtensions.cs | |
// | |
// Author: | |
// Aaron Bockover <abock@xamarin.com> | |
// | |
// Copyright 2015 Xamarin Inc. All rights reserved. | |
using System; | |
using System.Runtime.InteropServices; | |
using ObjCRuntime; | |
using AppKit; | |
namespace WebKit | |
{ | |
public static class WebKitWebViewExtensions | |
{ | |
static readonly IntPtr setSelectedDOMRangeSelector = Selector.GetHandle ("setSelectedDOMRange:affinity:"); | |
[DllImport (Constants.ObjectiveCLibrary, EntryPoint="objc_msgSend")] | |
static extern void void_objc_msgSend_IntPtr_IntPtr ( | |
IntPtr receiver, IntPtr selector, IntPtr arg1, IntPtr arg2); | |
public static void SetSelectedDomRange (this WebView webView, DomRange range, NSSelectionAffinity affinity) | |
{ | |
void_objc_msgSend_IntPtr_IntPtr (webView.Handle, setSelectedDOMRangeSelector, | |
range.Handle, new IntPtr ((int)affinity)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment