]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement HasSelection for the OSX WebKit backend.
authorSteve Lamerton <steve.lamerton@gmail.com>
Tue, 2 Aug 2011 09:44:07 +0000 (09:44 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Tue, 2 Aug 2011 09:44:07 +0000 (09:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68488 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/webview_webkit.h
src/osx/webview_webkit.mm

index ae985910a4a24f95aca47d491eb135793989ab6a..cf873771a731369b277ef5c16d1f6a7b93f173c9 100644 (file)
@@ -111,7 +111,7 @@ public:
     
     //Selection
     virtual void DeleteSelection();
-    virtual bool HasSelection() { return false; };
+    virtual bool HasSelection();
     virtual void SelectAll() {};
     virtual wxString GetSelectedText();
     virtual wxString GetSelectedSource() { return ""; }
index 52d7e7de47c9cff7888dda61ae5614d2c5424c9d..93e345dcc2bb5de50a6b47393ef18fde1d26af49 100644 (file)
@@ -940,11 +940,24 @@ void wxWebViewWebKit::DeleteSelection()
     [(WebView*)m_webView deleteSelection];
 }
 
+bool wxWebViewWebKit::HasSelection()
+{
+    DOMRange* range = [m_webView selectedDOMRange];
+    if(!range)
+    {
+        return false;
+    }
+    else
+    {
+        return true;
+    }
+}
+
 void wxWebViewWebKit::EnableHistory(bool enable)
 {
     if ( !m_webView )
         return;
-        
+
     [m_webView setMaintainsBackForwardList:enable];
 }