Reviewed by Kevin Ollivier.
authorkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 May 2008 20:57:52 +0000 (20:57 +0000)
committerkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 May 2008 20:57:52 +0000 (20:57 +0000)
This patch adds a new wx event type and code to send it when a new title is set by the page being loaded.

https://bugs.webkit.org/show_bug.cgi?id=19067

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34183 268f45cc-cd09-0410-ab3c-d52691b4dbfc

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

index d92bea29f2912110dd3f16896cc9dd320ffca18d..f2988abd847f722f73a3a9cd463c8e5838f48273 100644 (file)
@@ -1,3 +1,19 @@
+2008-05-28  Robin Dunn  <robin@alldunn.com>
+
+        Reviewed by Kevin Ollivier.
+
+        This patch adds a new wx event type and code to send it when a new title is set
+        by the page being loaded.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=19067
+
+        * WebKitSupport/FrameLoaderClientWx.cpp:
+        (WebCore::FrameLoaderClientWx::dispatchDidReceiveTitle):
+        * WebView.cpp:
+        (wxWebViewReceivedTitleEvent::wxWebViewReceivedTitleEvent):
+        * WebView.h:
+        * bindings/python/webview.i:
+
 2008-05-28  Robin Dunn  <robin@alldunn.com>
 
         Reviewed by Kevin Ollivier.
index 06120bbade52c766e72dc6576eba0bcc754a7c4c..221cabdb174207db01a16fdc001f26baba566d93 100644 (file)
@@ -310,8 +310,12 @@ void FrameLoaderClientWx::dispatchDidStartProvisionalLoad()
 
 void FrameLoaderClientWx::dispatchDidReceiveTitle(const String& title)
 {
-    if (m_webView)
+    if (m_webView) {
         m_webView->SetPageTitle(title);
+        wxWebViewReceivedTitleEvent wkEvent(m_webView);
+        wkEvent.SetTitle(title);
+        m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+    }
 }
 
 
index f79dc29dc56403211bde0c391f99a6eefa2c44e7..ae13cdc46faebfe45ead1134fdba6d8a14ca4a3a 100644 (file)
@@ -150,6 +150,18 @@ wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent(wxWindow* win)
         SetId(win->GetId());
 }
 
+IMPLEMENT_DYNAMIC_CLASS(wxWebViewReceivedTitleEvent, wxCommandEvent)
+
+DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_RECEIVED_TITLE)
+
+wxWebViewReceivedTitleEvent::wxWebViewReceivedTitleEvent(wxWindow* win)
+{
+    SetEventType(wxEVT_WEBVIEW_RECEIVED_TITLE);
+    SetEventObject(win);
+    if (win)
+        SetId(win->GetId());
+}
+
 //---------------------------------------------------------
 // DOM Element info data type
 //---------------------------------------------------------
index 0e8a881d95d928b501e9b7027b25ee5eb5f26802..c9e7c94c255e22a3697c8a4275e966ad10607c90 100644 (file)
@@ -323,11 +323,30 @@ private:
     wxString m_sourceID;
 };
 
+class WXDLLIMPEXP_WEBKIT wxWebViewReceivedTitleEvent : public wxCommandEvent
+{
+#ifndef SWIG
+    DECLARE_DYNAMIC_CLASS( wxWebViewReceivedTitleEvent )
+#endif
+
+public:
+    wxString GetTitle() const { return m_title; }
+    void SetTitle(const wxString& title) { m_title = title; }
+
+    wxWebViewReceivedTitleEvent( wxWindow* win = static_cast<wxWindow*>(NULL));
+    wxEvent *Clone(void) const { return new wxWebViewReceivedTitleEvent(*this); }
+
+private:
+    wxString m_title;
+};
+
+
 typedef void (wxEvtHandler::*wxWebViewLoadEventFunction)(wxWebViewLoadEvent&);
 typedef void (wxEvtHandler::*wxWebViewBeforeLoadEventFunction)(wxWebViewBeforeLoadEvent&);
 typedef void (wxEvtHandler::*wxWebViewNewWindowEventFunction)(wxWebViewNewWindowEvent&);
 typedef void (wxEvtHandler::*wxWebViewRightClickEventFunction)(wxWebViewRightClickEvent&);
 typedef void (wxEvtHandler::*wxWebViewConsoleMessageEventFunction)(wxWebViewConsoleMessageEvent&);
+typedef void (wxEvtHandler::*wxWebViewReceivedTitleEventFunction)(wxWebViewReceivedTitleEvent&);
 
 #ifndef SWIG
 BEGIN_DECLARE_EVENT_TYPES()
@@ -336,6 +355,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_NEW_WINDOW, wxID_ANY)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RIGHT_CLICK, wxID_ANY)
     DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONSOLE_MESSAGE, wxID_ANY)
+    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RECEIVED_TITLE, wxID_ANY)
 END_DECLARE_EVENT_TYPES()
 #endif
 
@@ -379,4 +399,12 @@ END_DECLARE_EVENT_TYPES()
                             (wxWebViewConsoleMessageEventFunction) & func, \
                             static_cast<wxObject*>(NULL)),
 
+#define EVT_WEBVIEW_RECEIVED_TITLE(winid, func)                       \
+            DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RECEIVED_TITLE, \
+                            winid, \
+                            wxID_ANY, \
+                            (wxObjectEventFunction)   \
+                            (wxWebViewReceivedTitleEventFunction) & func, \
+                            static_cast<wxObject*>(NULL)),
+
 #endif // ifndef WXWEBVIEW_H
index f5637f64e82ea0debc98c6e05e60ff70f360a961..e9926ad10483ea1af944bfa5da848561932b88ab 100644 (file)
@@ -48,6 +48,7 @@ MustHaveApp(wxWebBrowserShell);
 %constant wxEventType wxEVT_WEBVIEW_NEW_WINDOW;
 %constant wxEventType wxEVT_WEBVIEW_RIGHT_CLICK;
 %constant wxEventType wxEVT_WEBVIEW_CONSOLE_MESSAGE;
+%constant wxEventType wxEVT_WEBVIEW_RECEIVED_TITLE;
 
 %pythoncode {
 EVT_WEBVIEW_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_BEFORE_LOAD, 1 )
@@ -55,4 +56,5 @@ 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 )
+EVT_WEBVIEW_RECEIVED_TITLE = wx.PyEventBinder( wxEVT_WEBVIEW_RECEIVED_TITLE, 1 )    
 }