Commit 713348f7 authored by kevino@webkit.org's avatar kevino@webkit.org

Reviewed by Kevin Ollivier.

        
Allow events to specify the ID of the particular wxWebView they are to be sent to.
        
https://bugs.webkit.org/show_bug.cgi?id=18659


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32863 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 228802c2
2008-05-04 Robin Dunn <robin@alldunn.com>
Reviewed by Kevin Ollivier.
Allow events to specify the ID of the particular wxWebView they are to be sent to.
https://bugs.webkit.org/show_bug.cgi?id=18659
* WebFrame.cpp:
(wxWebFrame::wxWebFrame):
* WebView.cpp:
(wxWebViewLoadEvent::wxWebViewLoadEvent):
(wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent):
(wxWebViewNewWindowEvent::wxWebViewNewWindowEvent):
(wxWebViewRightClickEvent::wxWebViewRightClickEvent):
(wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent):
* WebView.h:
* bindings/python/webview.i:
2008-04-27 Robin Dunn <robin@alldunn.com>
Reviewed by Kevin Ollivier.
......
......@@ -62,7 +62,8 @@ enum {
ID_NEW_WINDOW = wxID_HIGHEST + 14,
ID_BROWSE = wxID_HIGHEST + 15,
ID_EDIT = wxID_HIGHEST + 16,
ID_RUN_SCRIPT = wxID_HIGHEST + 17
ID_RUN_SCRIPT = wxID_HIGHEST + 17,
ID_WEBVIEW = wxID_HIGHEST + 18
};
BEGIN_EVENT_TABLE(wxWebFrame, wxFrame)
......@@ -71,8 +72,8 @@ BEGIN_EVENT_TABLE(wxWebFrame, wxFrame)
EVT_MENU(ID_LOADFILE, wxWebFrame::OnLoadFile)
EVT_TEXT_ENTER(ID_TEXTCTRL, wxWebFrame::OnAddressBarEnter)
EVT_TEXT_ENTER(ID_SEARCHCTRL, wxWebFrame::OnSearchCtrlEnter)
EVT_WEBVIEW_LOAD(wxWebFrame::OnLoadEvent)
EVT_WEBVIEW_BEFORE_LOAD(wxWebFrame::OnBeforeLoad)
EVT_WEBVIEW_LOAD(ID_WEBVIEW, wxWebFrame::OnLoadEvent)
EVT_WEBVIEW_BEFORE_LOAD(ID_WEBVIEW, wxWebFrame::OnBeforeLoad)
EVT_MENU(ID_BACK, wxWebFrame::OnBack)
EVT_MENU(ID_FORWARD, wxWebFrame::OnForward)
EVT_MENU(ID_STOP, wxWebFrame::OnStop)
......@@ -153,7 +154,7 @@ wxWebFrame::wxWebFrame(const wxString& title) :
SetToolBar(toolbar);
// Create the wxWebView Window
webview = new wxWebView((wxWindow*)this, 1001, wxDefaultPosition, wxSize(200, 200));
webview = new wxWebView((wxWindow*)this, ID_WEBVIEW, wxDefaultPosition, wxSize(200, 200));
webview->SetBackgroundColour(*wxWHITE);
// create a status bar just for fun (by default with 1 pane only)
......
......@@ -97,6 +97,7 @@ wxWebViewLoadEvent::wxWebViewLoadEvent(wxWindow* win)
{
SetEventType( wxEVT_WEBVIEW_LOAD);
SetEventObject( win );
if (win)
SetId(win->GetId());
}
......@@ -109,6 +110,7 @@ wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent(wxWindow* win)
m_cancelled = false;
SetEventType(wxEVT_WEBVIEW_BEFORE_LOAD);
SetEventObject(win);
if (win)
SetId(win->GetId());
}
......@@ -120,6 +122,7 @@ wxWebViewNewWindowEvent::wxWebViewNewWindowEvent(wxWindow* win)
{
SetEventType(wxEVT_WEBVIEW_NEW_WINDOW);
SetEventObject(win);
if (win)
SetId(win->GetId());
}
......@@ -131,6 +134,7 @@ wxWebViewRightClickEvent::wxWebViewRightClickEvent(wxWindow* win)
{
SetEventType(wxEVT_WEBVIEW_RIGHT_CLICK);
SetEventObject(win);
if (win)
SetId(win->GetId());
}
......@@ -142,6 +146,7 @@ wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent(wxWindow* win)
{
SetEventType(wxEVT_WEBVIEW_CONSOLE_MESSAGE);
SetEventObject(win);
if (win)
SetId(win->GetId());
}
......
......@@ -317,41 +317,41 @@ BEGIN_DECLARE_EVENT_TYPES()
END_DECLARE_EVENT_TYPES()
#endif
#define EVT_WEBVIEW_LOAD(func) \
#define EVT_WEBVIEW_LOAD(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_LOAD, \
wxID_ANY, \
winid, \
wxID_ANY, \
(wxObjectEventFunction) \
(wxWebViewLoadEventFunction) & func, \
static_cast<wxObject*>(NULL)),
#define EVT_WEBVIEW_BEFORE_LOAD(func) \
#define EVT_WEBVIEW_BEFORE_LOAD(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_BEFORE_LOAD, \
wxID_ANY, \
winid, \
wxID_ANY, \
(wxObjectEventFunction) \
(wxWebViewBeforeLoadEventFunction) & func, \
static_cast<wxObject*>(NULL)),
#define EVT_WEBVIEW_NEW_WINDOW(func) \
#define EVT_WEBVIEW_NEW_WINDOW(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_NEW_WINDOW, \
wxID_ANY, \
winid, \
wxID_ANY, \
(wxObjectEventFunction) \
(wxWebViewNewWindowEventFunction) & func, \
static_cast<wxObject*>(NULL)),
#define EVT_WEBVIEW_RIGHT_CLICK(func) \
#define EVT_WEBVIEW_RIGHT_CLICK(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RIGHT_CLICK, \
wxID_ANY, \
winid, \
wxID_ANY, \
(wxObjectEventFunction) \
(wxWebViewRightClickEventFunction) & func, \
static_cast<wxObject*>(NULL)),
#define EVT_WEBVIEW_CONSOLE_MESSAGE(func) \
#define EVT_WEBVIEW_CONSOLE_MESSAGE(winid, func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_CONSOLE_MESSAGE, \
wxID_ANY, \
winid, \
wxID_ANY, \
(wxObjectEventFunction) \
(wxWebViewConsoleMessageEventFunction) & func, \
......
......@@ -47,10 +47,12 @@ MustHaveApp(wxWebFrame);
%constant wxEventType wxEVT_WEBVIEW_LOAD;
%constant wxEventType wxEVT_WEBVIEW_NEW_WINDOW;
%constant wxEventType wxEVT_WEBVIEW_RIGHT_CLICK;
%constant wxEventType wxEVT_WEBVIEW_CONSOLE_MESSAGE;
%pythoncode {
EVT_WEBVIEW_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_BEFORE_LOAD )
EVT_WEBVIEW_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_LOAD )
EVT_WEBVIEW_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBVIEW_NEW_WINDOW )
EVT_WEBVIEW_RIGHT_CLICK = wx.PyEventBinder( wxEVT_WEBVIEW_RIGHT_CLICK )
EVT_WEBVIEW_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_BEFORE_LOAD, 1 )
EVT_WEBVIEW_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_LOAD, 1 )
EVT_WEBVIEW_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBVIEW_NEW_WINDOW, 1 )
EVT_WEBVIEW_RIGHT_CLICK = wx.PyEventBinder( wxEVT_WEBVIEW_RIGHT_CLICK, 1 )
EVT_WEBVIEW_CONSOLE_MESSAGE = wx.PyEventBinder( wxEVT_WEBVIEW_CONSOLE_MESSAGE, 1 )
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment