From 028894b4261c10abdf61e4d9b3d3bc71b493a826 Mon Sep 17 00:00:00 2001 From: Steve Lamerton Date: Wed, 6 Jul 2011 10:20:03 +0000 Subject: [PATCH] Implement cut / copy / paste in osx webkit and fix the function stubs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/webview_webkit.h | 16 ++++++++-------- src/osx/webview_webkit.mm | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/include/wx/osx/webview_webkit.h b/include/wx/osx/webview_webkit.h index 6c34a8bdf7..5a068d9b8f 100644 --- a/include/wx/osx/webview_webkit.h +++ b/include/wx/osx/webview_webkit.h @@ -85,18 +85,18 @@ public: virtual void LoadHistoryItem(wxSharedPtr item) {} //Undo / redo functionality - virtual bool CanUndo() {} - virtual bool CanRedo() {} + virtual bool CanUndo() { return false; } + virtual bool CanRedo() { return false; } virtual void Undo() {} virtual void Redo() {} //Clipboard functions - virtual bool CanCut() {} - virtual bool CanCopy() {} - virtual bool CanPaste() {} - virtual void Cut() {} - virtual void Copy() {} - virtual void Paste() {} + virtual bool CanCut() { return false; } + virtual bool CanCopy() { return false; } + virtual bool CanPaste() { return false; } + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); // ---- methods not from the parent (common) interface wxString GetSelectedText(); diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index e4f0c023cd..cfac4c777a 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -956,6 +956,30 @@ void wxWebViewWebKit::SetPage(const wxString& src, const wxString& baseUrl) wxNSStringWithWxString( baseUrl )]]; } +void wxWebViewWebKit::Cut() +{ + if ( !m_webView ) + return; + + [(WebView*)m_webView cut]; +} + +void wxWebViewWebKit::Copy() +{ + if ( !m_webView ) + return; + + [(WebView*)m_webView copy]; +} + +void wxWebViewWebKit::Paste() +{ + if ( !m_webView ) + return; + + [(WebView*)m_webView paste]; +} + //------------------------------------------------------------ // Listener interfaces //------------------------------------------------------------ -- 2.45.2