Set up scrollbars correctly for wxWebView in wxGTK.
This allows Scroll{Lines,Pages}() methods inherited from wxWindow to work with it. Add a test of using them to the sample. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -127,6 +127,10 @@ public:
|
|||||||
void OnMode(wxCommandEvent& evt);
|
void OnMode(wxCommandEvent& evt);
|
||||||
void OnZoomLayout(wxCommandEvent& evt);
|
void OnZoomLayout(wxCommandEvent& evt);
|
||||||
void OnHistory(wxCommandEvent& evt);
|
void OnHistory(wxCommandEvent& evt);
|
||||||
|
void OnScrollLineUp(wxCommandEvent&) { m_browser->LineUp(); }
|
||||||
|
void OnScrollLineDown(wxCommandEvent&) { m_browser->LineDown(); }
|
||||||
|
void OnScrollPageUp(wxCommandEvent&) { m_browser->PageUp(); }
|
||||||
|
void OnScrollPageDown(wxCommandEvent&) { m_browser->PageDown(); }
|
||||||
void OnRunScript(wxCommandEvent& evt);
|
void OnRunScript(wxCommandEvent& evt);
|
||||||
void OnClearSelection(wxCommandEvent& evt);
|
void OnClearSelection(wxCommandEvent& evt);
|
||||||
void OnDeleteSelection(wxCommandEvent& evt);
|
void OnDeleteSelection(wxCommandEvent& evt);
|
||||||
@@ -161,6 +165,10 @@ private:
|
|||||||
wxMenuItem* m_edit_undo;
|
wxMenuItem* m_edit_undo;
|
||||||
wxMenuItem* m_edit_redo;
|
wxMenuItem* m_edit_redo;
|
||||||
wxMenuItem* m_edit_mode;
|
wxMenuItem* m_edit_mode;
|
||||||
|
wxMenuItem* m_scroll_line_up;
|
||||||
|
wxMenuItem* m_scroll_line_down;
|
||||||
|
wxMenuItem* m_scroll_page_up;
|
||||||
|
wxMenuItem* m_scroll_page_down;
|
||||||
wxMenuItem* m_selection_clear;
|
wxMenuItem* m_selection_clear;
|
||||||
wxMenuItem* m_selection_delete;
|
wxMenuItem* m_selection_delete;
|
||||||
|
|
||||||
@@ -289,6 +297,13 @@ WebFrame::WebFrame(const wxString& url) :
|
|||||||
m_tools_menu->AppendSeparator();
|
m_tools_menu->AppendSeparator();
|
||||||
m_tools_menu->AppendSubMenu(editmenu, "Edit");
|
m_tools_menu->AppendSubMenu(editmenu, "Edit");
|
||||||
|
|
||||||
|
wxMenu* scroll_menu = new wxMenu;
|
||||||
|
m_scroll_line_up = scroll_menu->Append(wxID_ANY, "Line &up");
|
||||||
|
m_scroll_line_down = scroll_menu->Append(wxID_ANY, "Line &down");
|
||||||
|
m_scroll_page_up = scroll_menu->Append(wxID_ANY, "Page u&p");
|
||||||
|
m_scroll_page_down = scroll_menu->Append(wxID_ANY, "Page d&own");
|
||||||
|
m_tools_menu->AppendSubMenu(scroll_menu, "Scroll");
|
||||||
|
|
||||||
wxMenuItem* script = m_tools_menu->Append(wxID_ANY, _("Run Script"));
|
wxMenuItem* script = m_tools_menu->Append(wxID_ANY, _("Run Script"));
|
||||||
|
|
||||||
//Selection menu
|
//Selection menu
|
||||||
@@ -371,6 +386,14 @@ WebFrame::WebFrame(const wxString& url) :
|
|||||||
wxCommandEventHandler(WebFrame::OnRedo), NULL, this );
|
wxCommandEventHandler(WebFrame::OnRedo), NULL, this );
|
||||||
Connect(m_edit_mode->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
Connect(m_edit_mode->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||||
wxCommandEventHandler(WebFrame::OnMode), NULL, this );
|
wxCommandEventHandler(WebFrame::OnMode), NULL, this );
|
||||||
|
Connect(m_scroll_line_up->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
wxCommandEventHandler(WebFrame::OnScrollLineUp), NULL, this );
|
||||||
|
Connect(m_scroll_line_down->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
wxCommandEventHandler(WebFrame::OnScrollLineDown), NULL, this );
|
||||||
|
Connect(m_scroll_page_up->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
wxCommandEventHandler(WebFrame::OnScrollPageUp), NULL, this );
|
||||||
|
Connect(m_scroll_page_down->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
wxCommandEventHandler(WebFrame::OnScrollPageDown), NULL, this );
|
||||||
Connect(script->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
Connect(script->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||||
wxCommandEventHandler(WebFrame::OnRunScript), NULL, this );
|
wxCommandEventHandler(WebFrame::OnRunScript), NULL, this );
|
||||||
Connect(m_selection_clear->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
Connect(m_selection_clear->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
@@ -401,6 +401,10 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
|
|||||||
m_busy = false;
|
m_busy = false;
|
||||||
m_guard = false;
|
m_guard = false;
|
||||||
|
|
||||||
|
// We currently unconditionally impose scrolling in both directions as it's
|
||||||
|
// necessary to show arbitrary pages.
|
||||||
|
style |= wxHSCROLL | wxVSCROLL;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, size ) ||
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
{
|
{
|
||||||
@@ -408,13 +412,9 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_widget = gtk_scrolled_window_new(NULL, NULL);
|
|
||||||
g_object_ref(m_widget);
|
|
||||||
m_web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
|
m_web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
|
||||||
|
GTKCreateScrolledWindowWith(GTK_WIDGET(m_web_view));
|
||||||
/* Place the WebKitWebView in the GtkScrolledWindow */
|
g_object_ref(m_widget);
|
||||||
gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_web_view));
|
|
||||||
gtk_widget_show(GTK_WIDGET(m_web_view));
|
|
||||||
|
|
||||||
g_signal_connect_after(m_web_view, "navigation-policy-decision-requested",
|
g_signal_connect_after(m_web_view, "navigation-policy-decision-requested",
|
||||||
G_CALLBACK(wxgtk_webview_webkit_navigation),
|
G_CALLBACK(wxgtk_webview_webkit_navigation),
|
||||||
|
Reference in New Issue
Block a user