git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68135
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void Copy();
virtual void Paste();
virtual void Copy();
virtual void Paste();
+ //Undo / redo functionality
+ virtual bool CanUndo();
+ virtual bool CanRedo();
+ virtual void Undo();
+ virtual void Redo();
+
/** FIXME: hack to work around signals being received too early */
bool m_ready;
/** FIXME: hack to work around signals being received too early */
bool m_ready;
virtual void Copy();
virtual void Paste();
virtual void Copy();
virtual void Paste();
+ //Undo / redo functionality
+ virtual bool CanUndo();
+ virtual bool CanRedo();
+ virtual void Undo();
+ virtual void Redo();
+
// ---- IE-specific methods
// FIXME: I seem to be able to access remote webpages even in offline mode...
// ---- IE-specific methods
// FIXME: I seem to be able to access remote webpages even in offline mode...
virtual void Cut() = 0;
virtual void Copy() = 0;
virtual void Paste() = 0;
virtual void Cut() = 0;
virtual void Copy() = 0;
virtual void Paste() = 0;
+
+ //Undo / redo functionality
+ virtual bool CanUndo() = 0;
+ virtual bool CanRedo() = 0;
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
};
class WXDLLIMPEXP_WEB wxWebNavigationEvent : public wxCommandEvent
};
class WXDLLIMPEXP_WEB wxWebNavigationEvent : public wxCommandEvent
void OnCut(wxCommandEvent& evt);
void OnCopy(wxCommandEvent& evt);
void OnPaste(wxCommandEvent& evt);
void OnCut(wxCommandEvent& evt);
void OnCopy(wxCommandEvent& evt);
void OnPaste(wxCommandEvent& evt);
+ void OnUndo(wxCommandEvent& evt);
+ void OnRedo(wxCommandEvent& evt);
private:
wxTextCtrl* m_url;
private:
wxTextCtrl* m_url;
wxMenuItem* m_edit_cut;
wxMenuItem* m_edit_copy;
wxMenuItem* m_edit_paste;
wxMenuItem* m_edit_cut;
wxMenuItem* m_edit_copy;
wxMenuItem* m_edit_paste;
+ wxMenuItem* m_edit_undo;
+ wxMenuItem* m_edit_redo;
wxTimer* m_timer;
int m_animation_angle;
wxTimer* m_timer;
int m_animation_angle;
m_edit_cut = editmenu->Append(wxID_ANY, _("Cut"));
m_edit_copy = editmenu->Append(wxID_ANY, _("Copy"));
m_edit_paste = editmenu->Append(wxID_ANY, _("Paste"));
m_edit_cut = editmenu->Append(wxID_ANY, _("Cut"));
m_edit_copy = editmenu->Append(wxID_ANY, _("Copy"));
m_edit_paste = editmenu->Append(wxID_ANY, _("Paste"));
+ editmenu->AppendSeparator();
+ m_edit_undo = editmenu->Append(wxID_ANY, _("Undo"));
+ m_edit_redo = editmenu->Append(wxID_ANY, _("Redo"));
m_tools_menu->AppendSeparator();
m_tools_menu->AppendSubMenu(editmenu, "Edit");
m_tools_menu->AppendSeparator();
m_tools_menu->AppendSubMenu(editmenu, "Edit");
wxCommandEventHandler(WebFrame::OnCopy), NULL, this );
Connect(m_edit_paste->GetId(), wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(WebFrame::OnPaste), NULL, this );
wxCommandEventHandler(WebFrame::OnCopy), NULL, this );
Connect(m_edit_paste->GetId(), wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(WebFrame::OnPaste), NULL, this );
+ Connect(m_edit_undo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(WebFrame::OnUndo), NULL, this );
+ Connect(m_edit_redo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(WebFrame::OnRedo), NULL, this );
}
void WebFrame::OnAnimationTimer(wxTimerEvent& evt)
}
void WebFrame::OnAnimationTimer(wxTimerEvent& evt)
+void WebFrame::OnUndo(wxCommandEvent& evt)
+{
+ m_browser->Undo();
+}
+
+void WebFrame::OnRedo(wxCommandEvent& evt)
+{
+ m_browser->Redo();
+}
+
/**
* Callback invoked when there is a request to load a new page (for instance
* when the user clicks a link)
/**
* Callback invoked when there is a request to load a new page (for instance
* when the user clicks a link)
m_edit_cut->Enable(m_browser->CanCut());
m_edit_copy->Enable(m_browser->CanCopy());
m_edit_paste->Enable(m_browser->CanPaste());
m_edit_cut->Enable(m_browser->CanCut());
m_edit_copy->Enable(m_browser->CanCopy());
m_edit_paste->Enable(m_browser->CanPaste());
+
+ m_edit_undo->Enable(m_browser->CanUndo());
+ m_edit_redo->Enable(m_browser->CanRedo());
wxPoint position = ScreenToClient( wxGetMousePosition() );
PopupMenu(m_tools_menu, position.x, position.y);
wxPoint position = ScreenToClient( wxGetMousePosition() );
PopupMenu(m_tools_menu, position.x, position.y);
webkit_web_view_paste_clipboard(WEBKIT_WEB_VIEW(web_view));
}
webkit_web_view_paste_clipboard(WEBKIT_WEB_VIEW(web_view));
}
+bool wxWebViewWebKit::CanUndo()
+{
+ return webkit_web_view_can_undo(WEBKIT_WEB_VIEW(web_view));
+}
+
+bool wxWebViewWebKit::CanRedo()
+{
+ return webkit_web_view_can_redo(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Undo()
+{
+ webkit_web_view_undo(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Redo()
+{
+ webkit_web_view_redo(WEBKIT_WEB_VIEW(web_view));
+}
+
wxString wxWebViewWebKit::GetCurrentURL()
{
// FIXME: check which encoding the web kit control uses instead of
wxString wxWebViewWebKit::GetCurrentURL()
{
// FIXME: check which encoding the web kit control uses instead of
+bool wxWebViewIE::CanUndo()
+{
+ return CanExecCommand("Undo");
+}
+bool wxWebViewIE::CanRedo()
+{
+ return CanExecCommand("Redo");
+}
+
+void wxWebViewIE::Undo()
+{
+ ExecCommand("Undo");
+}
+
+void wxWebViewIE::Redo()
+{
+ ExecCommand("Redo");
+}
+
bool wxWebViewIE::CanExecCommand(wxString command)
{
wxVariant documentVariant = m_ie.GetProperty("Document");
bool wxWebViewIE::CanExecCommand(wxString command)
{
wxVariant documentVariant = m_ie.GetProperty("Document");