From 6368d96506d9debd3db1a4b07db1f9dc91c6f1a4 Mon Sep 17 00:00:00 2001 From: Steve Lamerton Date: Fri, 5 Aug 2011 13:17:19 +0000 Subject: [PATCH] Add undo / redo support to OSX WebKit. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/webview_webkit.h | 8 ++++---- src/osx/webview_webkit.mm | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/include/wx/osx/webview_webkit.h b/include/wx/osx/webview_webkit.h index cf873771a7..047f6c7eb8 100644 --- a/include/wx/osx/webview_webkit.h +++ b/include/wx/osx/webview_webkit.h @@ -92,10 +92,10 @@ public: virtual void LoadHistoryItem(wxSharedPtr WXUNUSED(item)) {} //Undo / redo functionality - virtual bool CanUndo() { return false; } - virtual bool CanRedo() { return false; } - virtual void Undo() {} - virtual void Redo() {} + virtual bool CanUndo(); + virtual bool CanRedo(); + virtual void Undo(); + virtual void Redo(); //Clipboard functions virtual bool CanCut() { return false; } diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index 93e345dcc2..763c9097ca 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -961,6 +961,26 @@ void wxWebViewWebKit::EnableHistory(bool enable) [m_webView setMaintainsBackForwardList:enable]; } +bool wxWebViewWebKit::CanUndo() +{ + return [[m_webView undoManager] canUndo]; +} + +bool wxWebViewWebKit::CanRedo() +{ + return [[m_webView undoManager] canRedo]; +} + +void wxWebViewWebKit::Undo() +{ + [[m_webView undoManager] undo]; +} + +void wxWebViewWebKit::Redo() +{ + [[m_webView undoManager] redo]; +} + //------------------------------------------------------------ // Listener interfaces //------------------------------------------------------------ -- 2.45.2