Reviewed by Kevin Ollivier.
authorkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 May 2008 05:30:44 +0000 (05:30 +0000)
committerkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 May 2008 05:30:44 +0000 (05:30 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@32863 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/wx/ChangeLog
WebKit/wx/WebFrame.cpp
WebKit/wx/WebView.cpp
WebKit/wx/WebView.h
WebKit/wx/bindings/python/webview.i

index 02e689f..6787990 100644 (file)
@@ -1,3 +1,22 @@
+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.
index cd46af6..ad0cfc8 100644 (file)
@@ -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)
index bae1655..e7a11cd 100644 (file)
@@ -97,7 +97,8 @@ wxWebViewLoadEvent::wxWebViewLoadEvent(wxWindow* win)
 {
     SetEventType( wxEVT_WEBVIEW_LOAD);
     SetEventObject( win );
-    SetId(win->GetId());
+    if (win)
+        SetId(win->GetId());
 }
 
 IMPLEMENT_DYNAMIC_CLASS(wxWebViewBeforeLoadEvent, wxCommandEvent)
@@ -109,7 +110,8 @@ wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent(wxWindow* win)
     m_cancelled = false;
     SetEventType(wxEVT_WEBVIEW_BEFORE_LOAD);
     SetEventObject(win);
-    SetId(win->GetId());
+    if (win)
+        SetId(win->GetId());
 }
 
 IMPLEMENT_DYNAMIC_CLASS(wxWebViewNewWindowEvent, wxCommandEvent)
@@ -120,7 +122,8 @@ wxWebViewNewWindowEvent::wxWebViewNewWindowEvent(wxWindow* win)
 {
     SetEventType(wxEVT_WEBVIEW_NEW_WINDOW);
     SetEventObject(win);
-    SetId(win->GetId());
+    if (win)
+        SetId(win->GetId());
 }
 
 IMPLEMENT_DYNAMIC_CLASS(wxWebViewRightClickEvent, wxCommandEvent)
@@ -131,7 +134,8 @@ wxWebViewRightClickEvent::wxWebViewRightClickEvent(wxWindow* win)
 {
     SetEventType(wxEVT_WEBVIEW_RIGHT_CLICK);
     SetEventObject(win);
-    SetId(win->GetId());
+    if (win)
+        SetId(win->GetId());
 }
 
 IMPLEMENT_DYNAMIC_CLASS(wxWebViewConsoleMessageEvent, wxCommandEvent)
@@ -142,7 +146,8 @@ wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent(wxWindow* win)
 {
     SetEventType(wxEVT_WEBVIEW_CONSOLE_MESSAGE);
     SetEventObject(win);
-    SetId(win->GetId());
+    if (win)
+        SetId(win->GetId());
 }
 
 //---------------------------------------------------------
index 7284d87..ba834d3 100644 (file)
@@ -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, \
index fae78d3..2aec8a6 100644 (file)
@@ -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 )
 }