Add the ability to enable / disable and check for the editable property of a rendering engine. Implement for all three backends and extend the sample, document and unit test.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-08 19:34:56 +00:00
parent 3ce14be7b9
commit c7cbe308f6
10 changed files with 86 additions and 8 deletions

View File

@@ -76,6 +76,7 @@ public:
void OnPaste(wxCommandEvent& evt);
void OnUndo(wxCommandEvent& evt);
void OnRedo(wxCommandEvent& evt);
void OnMode(wxCommandEvent& evt);
private:
wxTextCtrl* m_url;
@@ -102,6 +103,7 @@ private:
wxMenuItem* m_edit_paste;
wxMenuItem* m_edit_undo;
wxMenuItem* m_edit_redo;
wxMenuItem* m_edit_mode;
wxTimer* m_timer;
int m_animation_angle;
@@ -213,6 +215,8 @@ WebFrame::WebFrame() : wxFrame(NULL, wxID_ANY, "wxWebView Sample")
editmenu->AppendSeparator();
m_edit_undo = editmenu->Append(wxID_ANY, _("Undo"));
m_edit_redo = editmenu->Append(wxID_ANY, _("Redo"));
editmenu->AppendSeparator();
m_edit_mode = editmenu->AppendCheckItem(wxID_ANY, _("Edit Mode"));
m_tools_menu->AppendSeparator();
m_tools_menu->AppendSubMenu(editmenu, "Edit");
@@ -279,6 +283,8 @@ WebFrame::WebFrame() : wxFrame(NULL, wxID_ANY, "wxWebView Sample")
wxCommandEventHandler(WebFrame::OnUndo), NULL, this );
Connect(m_edit_redo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(WebFrame::OnRedo), NULL, this );
Connect(m_edit_mode->GetId(), wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(WebFrame::OnMode), NULL, this );
}
void WebFrame::OnAnimationTimer(wxTimerEvent& evt)
@@ -428,6 +434,12 @@ void WebFrame::OnRedo(wxCommandEvent& evt)
m_browser->Redo();
}
void WebFrame::OnMode(wxCommandEvent& evt)
{
m_browser->SetEditable(m_edit_mode->IsChecked());
}
/**
* Callback invoked when there is a request to load a new page (for instance
* when the user clicks a link)