Rename wxWebNavigationError to wxWebViewNavigationError and wxWebNavigationEvent to wxWebViewEvent. This makes the names more consistent with other parts of wxWidgets.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-08-15 11:03:26 +00:00
parent 9f72fa7c2d
commit 04fa04d806
7 changed files with 135 additions and 138 deletions

View File

@@ -53,7 +53,7 @@ enum wxWebViewZoomType
}; };
/** Types of errors that can cause navigation to fail */ /** Types of errors that can cause navigation to fail */
enum wxWebNavigationError enum wxWebViewNavigationError
{ {
/** Connection error (timeout, etc.) */ /** Connection error (timeout, etc.) */
wxWEB_NAV_ERR_CONNECTION, wxWEB_NAV_ERR_CONNECTION,
@@ -347,12 +347,12 @@ public:
wxDECLARE_ABSTRACT_CLASS(wxWebView); wxDECLARE_ABSTRACT_CLASS(wxWebView);
}; };
class WXDLLIMPEXP_WEB wxWebNavigationEvent : public wxCommandEvent class WXDLLIMPEXP_WEB wxWebViewEvent : public wxCommandEvent
{ {
public: public:
wxWebNavigationEvent() {} wxWebViewEvent() {}
wxWebNavigationEvent(wxEventType type, int id, const wxString url, wxWebViewEvent(wxEventType type, int id, const wxString url,
const wxString target, bool canVeto) const wxString target, bool canVeto)
: wxCommandEvent(type, id) : wxCommandEvent(type, id)
{ {
m_url = url; m_url = url;
@@ -373,7 +373,7 @@ public:
const wxString& GetTarget() const { return m_target; } const wxString& GetTarget() const { return m_target; }
// default copy ctor, assignment operator and dtor are ok // default copy ctor, assignment operator and dtor are ok
virtual wxEvent* Clone() const { return new wxWebNavigationEvent(*this); } virtual wxEvent* Clone() const { return new wxWebViewEvent(*this); }
/** Get whether this event may be vetoed (stopped/prevented). Only /** Get whether this event may be vetoed (stopped/prevented). Only
* meaningful for events fired before navigation takes place. * meaningful for events fired before navigation takes place.
@@ -396,45 +396,45 @@ private:
bool m_canVeto; bool m_canVeto;
bool m_vetoed; bool m_vetoed;
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebNavigationEvent); wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebViewEvent);
}; };
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent );
typedef void (wxEvtHandler::*wxWebNavigationEventFunction) typedef void (wxEvtHandler::*wxWebViewEventFunction)
(wxWebNavigationEvent&); (wxWebViewEvent&);
#define wxWebNavigationEventHandler(func) \ #define wxWebViewEventHandler(func) \
wxEVENT_HANDLER_CAST(wxWebNavigationEventFunction, func) wxEVENT_HANDLER_CAST(wxWebViewEventFunction, func)
#define EVT_WEB_VIEW_NAVIGATING(id, fn) \ #define EVT_WEB_VIEW_NAVIGATING(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, id, \ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, id, \
wxHtmlNavigatingEventHandler(fn)) wxWebViewEventHandler(fn))
#define EVT_WEB_VIEW_NAVIGATED(id, fn) \ #define EVT_WEB_VIEW_NAVIGATED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, id, \ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, id, \
wxHtmlNavigatingEventHandler(fn)) wxWebViewEventHandler(fn))
#define EVT_WEB_VIEW_LOADED(id, fn) \ #define EVT_WEB_VIEW_LOADED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_LOADED, id, \ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_LOADED, id, \
wxHtmlNavigatingEventHandler(fn)) wxWebViewEventHandler(fn))
#define EVT_WEB_VIEW_ERRROR(id, fn) \ #define EVT_WEB_VIEW_ERRROR(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_ERROR, id, \ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_ERROR, id, \
wxHtmlNavigatingEventHandler(fn)) wxWebViewEventHandler(fn))
#define EVT_WEB_VIEW_NEWWINDOW(id, fn) \ #define EVT_WEB_VIEW_NEWWINDOW(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, id, \ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, id, \
wxHtmlNavigatingEventHandler(fn)) wxWebViewEventHandler(fn))
#define EVT_WEB_VIEW_TITLE_CHANGED(id, fn) \ #define EVT_WEB_VIEW_TITLE_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, id, \ wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, id, \
wxHtmlNavigatingEventHandler(fn)) wxWebViewEventHandler(fn))
#endif // wxUSE_WEB #endif // wxUSE_WEB

View File

@@ -37,7 +37,7 @@ enum wxWebViewZoomType
/** /**
Types of errors that can cause navigation to fail Types of errors that can cause navigation to fail
*/ */
enum wxWebNavigationError enum wxWebViewNavigationError
{ {
/** Connection error (timeout, etc.) */ /** Connection error (timeout, etc.) */
wxWEB_NAV_ERR_CONNECTION, wxWEB_NAV_ERR_CONNECTION,
@@ -211,7 +211,7 @@ public:
standard @c file syntax as well as paths to archives of the form standard @c file syntax as well as paths to archives of the form
@c file:///C:/exmaple/docs.zip;protocol=zip/main.htm @c file:///C:/exmaple/docs.zip;protocol=zip/main.htm
@beginEventEmissionTable{wxWebNavigationEvent} @beginEventEmissionTable{wxWebViewEvent}
@event{EVT_WEB_VIEW_NAVIGATING(id, func)} @event{EVT_WEB_VIEW_NAVIGATING(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATING event, generated before trying Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATING event, generated before trying
to get a resource. This event may be vetoed to prevent navigating to this to get a resource. This event may be vetoed to prevent navigating to this
@@ -243,7 +243,7 @@ public:
@library{wxweb} @library{wxweb}
@category{ctrl,web} @category{ctrl,web}
@see wxWebHandler, wxWebNavigationEvent @see wxWebHandler, wxWebViewEvent
*/ */
class wxWebView : public wxControl class wxWebView : public wxControl
{ {
@@ -586,12 +586,12 @@ public:
/** /**
@class wxWebNavigationEvent @class wxWebViewEvent
A navigation event holds information about events associated with A navigation event holds information about events associated with
wxWebView objects. wxWebView objects.
@beginEventEmissionTable{wxWebNavigationEvent} @beginEventEmissionTable{wxWebViewEvent}
@event{EVT_WEB_VIEW_NAVIGATING(id, func)} @event{EVT_WEB_VIEW_NAVIGATING(id, func)}
Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATING event, generated before trying Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATING event, generated before trying
to get a resource. This event may be vetoed to prevent navigating to this to get a resource. This event may be vetoed to prevent navigating to this
@@ -626,12 +626,12 @@ public:
@see wxWebView @see wxWebView
*/ */
class wxWebNavigationEvent : public wxCommandEvent class wxWebViewEvent : public wxCommandEvent
{ {
public: public:
wxWebNavigationEvent(); wxWebViewEvent();
wxWebNavigationEvent(wxEventType type, int id, const wxString href, wxWebViewEvent(wxEventType type, int id, const wxString href,
const wxString target, bool canVeto); const wxString target, bool canVeto);
/** /**
Get the name of the target frame which the url of this event Get the name of the target frame which the url of this event

View File

@@ -73,15 +73,15 @@ public:
void OnReload(wxCommandEvent& evt); void OnReload(wxCommandEvent& evt);
void OnClearHistory(wxCommandEvent& evt); void OnClearHistory(wxCommandEvent& evt);
void OnEnableHistory(wxCommandEvent& evt); void OnEnableHistory(wxCommandEvent& evt);
void OnNavigationRequest(wxWebNavigationEvent& evt); void OnNavigationRequest(wxWebViewEvent& evt);
void OnNavigationComplete(wxWebNavigationEvent& evt); void OnNavigationComplete(wxWebViewEvent& evt);
void OnDocumentLoaded(wxWebNavigationEvent& evt); void OnDocumentLoaded(wxWebViewEvent& evt);
void OnNewWindow(wxWebNavigationEvent& evt); void OnNewWindow(wxWebViewEvent& evt);
void OnTitleChanged(wxWebNavigationEvent& evt); void OnTitleChanged(wxWebViewEvent& evt);
void OnViewSourceRequest(wxCommandEvent& evt); void OnViewSourceRequest(wxCommandEvent& evt);
void OnToolsClicked(wxCommandEvent& evt); void OnToolsClicked(wxCommandEvent& evt);
void OnSetZoom(wxCommandEvent& evt); void OnSetZoom(wxCommandEvent& evt);
void OnError(wxWebNavigationEvent& evt); void OnError(wxWebViewEvent& evt);
void OnPrint(wxCommandEvent& evt); void OnPrint(wxCommandEvent& evt);
void OnCut(wxCommandEvent& evt); void OnCut(wxCommandEvent& evt);
void OnCopy(wxCommandEvent& evt); void OnCopy(wxCommandEvent& evt);
@@ -293,17 +293,17 @@ WebFrame::WebFrame() : wxFrame(NULL, wxID_ANY, "wxWebView Sample")
// Connect the webview events // Connect the webview events
Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATING, Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
wxWebNavigationEventHandler(WebFrame::OnNavigationRequest), NULL, this); wxWebViewEventHandler(WebFrame::OnNavigationRequest), NULL, this);
Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATED, Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
wxWebNavigationEventHandler(WebFrame::OnNavigationComplete), NULL, this); wxWebViewEventHandler(WebFrame::OnNavigationComplete), NULL, this);
Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_LOADED, Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_LOADED,
wxWebNavigationEventHandler(WebFrame::OnDocumentLoaded), NULL, this); wxWebViewEventHandler(WebFrame::OnDocumentLoaded), NULL, this);
Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_ERROR, Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_ERROR,
wxWebNavigationEventHandler(WebFrame::OnError), NULL, this); wxWebViewEventHandler(WebFrame::OnError), NULL, this);
Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
wxWebNavigationEventHandler(WebFrame::OnNewWindow), NULL, this); wxWebViewEventHandler(WebFrame::OnNewWindow), NULL, this);
Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
wxWebNavigationEventHandler(WebFrame::OnTitleChanged), NULL, this); wxWebViewEventHandler(WebFrame::OnTitleChanged), NULL, this);
// Connect the menu events // Connect the menu events
Connect(viewSource->GetId(), wxEVT_COMMAND_MENU_SELECTED, Connect(viewSource->GetId(), wxEVT_COMMAND_MENU_SELECTED,
@@ -505,7 +505,7 @@ void WebFrame::OnMode(wxCommandEvent& WXUNUSED(evt))
* Callback invoked when there is a request to load a new page (for instance * Callback invoked when there is a request to load a new page (for instance
* when the user clicks a link) * when the user clicks a link)
*/ */
void WebFrame::OnNavigationRequest(wxWebNavigationEvent& evt) void WebFrame::OnNavigationRequest(wxWebViewEvent& evt)
{ {
if(m_info->IsShown()) if(m_info->IsShown())
{ {
@@ -528,7 +528,7 @@ void WebFrame::OnNavigationRequest(wxWebNavigationEvent& evt)
/** /**
* Callback invoked when a navigation request was accepted * Callback invoked when a navigation request was accepted
*/ */
void WebFrame::OnNavigationComplete(wxWebNavigationEvent& evt) void WebFrame::OnNavigationComplete(wxWebViewEvent& evt)
{ {
wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'"); wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
UpdateState(); UpdateState();
@@ -537,7 +537,7 @@ void WebFrame::OnNavigationComplete(wxWebNavigationEvent& evt)
/** /**
* Callback invoked when a page is finished loading * Callback invoked when a page is finished loading
*/ */
void WebFrame::OnDocumentLoaded(wxWebNavigationEvent& evt) void WebFrame::OnDocumentLoaded(wxWebViewEvent& evt)
{ {
//Only notify if the document is the main frame, not a subframe //Only notify if the document is the main frame, not a subframe
if(evt.GetURL() == m_browser->GetCurrentURL()) if(evt.GetURL() == m_browser->GetCurrentURL())
@@ -550,7 +550,7 @@ void WebFrame::OnDocumentLoaded(wxWebNavigationEvent& evt)
/** /**
* On new window, we veto to stop extra windows appearing * On new window, we veto to stop extra windows appearing
*/ */
void WebFrame::OnNewWindow(wxWebNavigationEvent& evt) void WebFrame::OnNewWindow(wxWebViewEvent& evt)
{ {
wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'"); wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'");
@@ -562,7 +562,7 @@ void WebFrame::OnNewWindow(wxWebNavigationEvent& evt)
UpdateState(); UpdateState();
} }
void WebFrame::OnTitleChanged(wxWebNavigationEvent& evt) void WebFrame::OnTitleChanged(wxWebViewEvent& evt)
{ {
wxLogMessage("%s", "Title changed; title='" + evt.GetString() + "'"); wxLogMessage("%s", "Title changed; title='" + evt.GetString() + "'");
UpdateState(); UpdateState();
@@ -731,7 +731,7 @@ void WebFrame::OnSelectAll(wxCommandEvent& WXUNUSED(evt))
/** /**
* Callback invoked when a loading error occurs * Callback invoked when a loading error occurs
*/ */
void WebFrame::OnError(wxWebNavigationEvent& evt) void WebFrame::OnError(wxWebViewEvent& evt)
{ {
wxString errorCategory; wxString errorCategory;
switch (evt.GetInt()) switch (evt.GetInt())

View File

@@ -30,14 +30,14 @@ extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[] = "wxWebView";
extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank"; extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank";
wxIMPLEMENT_ABSTRACT_CLASS(wxWebView, wxControl); wxIMPLEMENT_ABSTRACT_CLASS(wxWebView, wxControl);
wxIMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent); wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewEvent, wxCommandEvent);
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent ); wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent ); wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent ); wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent ); wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent ); wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent );
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent ); wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent );
// static // static
wxWebView* wxWebView::New(wxWebViewBackend backend) wxWebView* wxWebView::New(wxWebViewBackend backend)

View File

@@ -44,22 +44,22 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget,
if (status == WEBKIT_LOAD_FINISHED) if (status == WEBKIT_LOAD_FINISHED)
{ {
webKitCtrl->m_busy = false; webKitCtrl->m_busy = false;
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED,
webKitCtrl->GetId(), webKitCtrl->GetId(),
url, target, false); url, target, false);
if (webKitCtrl && webKitCtrl->GetEventHandler()) if (webKitCtrl && webKitCtrl->GetEventHandler())
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent); webKitCtrl->GetEventHandler()->ProcessEvent(event);
} }
else if (status == WEBKIT_LOAD_COMMITTED) else if (status == WEBKIT_LOAD_COMMITTED)
{ {
webKitCtrl->m_busy = true; webKitCtrl->m_busy = true;
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
webKitCtrl->GetId(), webKitCtrl->GetId(),
url, target, false); url, target, false);
if (webKitCtrl && webKitCtrl->GetEventHandler()) if (webKitCtrl && webKitCtrl->GetEventHandler())
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent); webKitCtrl->GetEventHandler()->ProcessEvent(event);
} }
} }
@@ -86,16 +86,16 @@ wxgtk_webview_webkit_navigation(WebKitWebView *,
const gchar* uri = webkit_network_request_get_uri(request); const gchar* uri = webkit_network_request_get_uri(request);
wxString target = webkit_web_frame_get_name (frame); wxString target = webkit_web_frame_get_name (frame);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
webKitCtrl->GetId(), webKitCtrl->GetId(),
wxString( uri, wxConvUTF8 ), wxString( uri, wxConvUTF8 ),
target, target,
true); true);
if (webKitCtrl && webKitCtrl->GetEventHandler()) if (webKitCtrl && webKitCtrl->GetEventHandler())
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent); webKitCtrl->GetEventHandler()->ProcessEvent(event);
if (thisEvent.IsVetoed()) if (event.IsVetoed())
{ {
webKitCtrl->m_busy = false; webKitCtrl->m_busy = false;
webkit_web_policy_decision_ignore(policy_decision); webkit_web_policy_decision_ignore(policy_decision);
@@ -141,7 +141,7 @@ wxgtk_webview_webkit_error(WebKitWebView*,
wxWebViewWebKit* webKitWindow) wxWebViewWebKit* webKitWindow)
{ {
webKitWindow->m_busy = false; webKitWindow->m_busy = false;
wxWebNavigationError type = wxWEB_NAV_ERR_OTHER; wxWebViewNavigationError type = wxWEB_NAV_ERR_OTHER;
GError* error = (GError*)web_error; GError* error = (GError*)web_error;
wxString description(error->message, wxConvUTF8); wxString description(error->message, wxConvUTF8);
@@ -260,17 +260,15 @@ wxgtk_webview_webkit_error(WebKitWebView*,
} }
*/ */
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR,
webKitWindow->GetId(), webKitWindow->GetId(),
uri, uri, "", false);
wxEmptyString, event.SetString(description);
false); event.SetInt(type);
thisEvent.SetString(description);
thisEvent.SetInt(type);
if (webKitWindow && webKitWindow->GetEventHandler()) if (webKitWindow && webKitWindow->GetEventHandler())
{ {
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent); webKitWindow->GetEventHandler()->ProcessEvent(event);
} }
return FALSE; return FALSE;
@@ -287,14 +285,14 @@ wxgtk_webview_webkit_new_window(WebKitWebView*,
const gchar* uri = webkit_network_request_get_uri(request); const gchar* uri = webkit_network_request_get_uri(request);
wxString target = webkit_web_frame_get_name (frame); wxString target = webkit_web_frame_get_name (frame);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
webKitCtrl->GetId(), webKitCtrl->GetId(),
wxString( uri, wxConvUTF8 ), wxString( uri, wxConvUTF8 ),
target, target,
true); true);
if (webKitCtrl && webKitCtrl->GetEventHandler()) if (webKitCtrl && webKitCtrl->GetEventHandler())
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent); webKitCtrl->GetEventHandler()->ProcessEvent(event);
//We always want the user to handle this themselves //We always want the user to handle this themselves
webkit_web_policy_decision_ignore(policy_decision); webkit_web_policy_decision_ignore(policy_decision);
@@ -307,15 +305,14 @@ wxgtk_webview_webkit_title_changed(WebKitWebView*,
gchar *title, gchar *title,
wxWebViewWebKit *webKitCtrl) wxWebViewWebKit *webKitCtrl)
{ {
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
webKitCtrl->GetId(), webKitCtrl->GetId(),
webKitCtrl->GetCurrentURL(), webKitCtrl->GetCurrentURL(),
"", "", true);
true); event.SetString(wxString(title, wxConvUTF8));
thisEvent.SetString(wxString(title, wxConvUTF8));
if (webKitCtrl && webKitCtrl->GetEventHandler()) if (webKitCtrl && webKitCtrl->GetEventHandler())
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent); webKitCtrl->GetEventHandler()->ProcessEvent(event);
} }

View File

@@ -109,8 +109,8 @@ void wxWebViewIE::SetPage(const wxString& html, const wxString& baseUrl)
//We send the events when we are done to mimic webkit //We send the events when we are done to mimic webkit
//Navigated event //Navigated event
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
GetId(), baseUrl, "", false); GetId(), baseUrl, "", false);
event.SetEventObject(this); event.SetEventObject(this);
HandleWindowEvent(event); HandleWindowEvent(event);
@@ -722,8 +722,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
wxString url = evt[1].GetString(); wxString url = evt[1].GetString();
wxString target = evt[3].GetString(); wxString target = evt[3].GetString();
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
GetId(), url, target, true); GetId(), url, target, true);
event.SetEventObject(this); event.SetEventObject(this);
HandleWindowEvent(event); HandleWindowEvent(event);
@@ -748,8 +748,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
wxString url = evt[1].GetString(); wxString url = evt[1].GetString();
// TODO: set target parameter if possible // TODO: set target parameter if possible
wxString target = wxEmptyString; wxString target = wxEmptyString;
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
GetId(), url, target, false); GetId(), url, target, false);
event.SetEventObject(this); event.SetEventObject(this);
HandleWindowEvent(event); HandleWindowEvent(event);
break; break;
@@ -797,8 +797,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
m_historyLoadingFromList = false; m_historyLoadingFromList = false;
// TODO: set target parameter if possible // TODO: set target parameter if possible
wxString target = wxEmptyString; wxString target = wxEmptyString;
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED, GetId(), wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED, GetId(),
url, target, false); url, target, false);
event.SetEventObject(this); event.SetEventObject(this);
HandleWindowEvent(event); HandleWindowEvent(event);
break; break;
@@ -813,8 +813,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
{ {
wxString title = evt[0].GetString(); wxString title = evt[0].GetString();
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
GetId(), GetCurrentURL(), wxEmptyString, true); GetId(), GetCurrentURL(), wxEmptyString, true);
event.SetString(title); event.SetString(title);
event.SetEventObject(this); event.SetEventObject(this);
HandleWindowEvent(event); HandleWindowEvent(event);
@@ -823,7 +823,7 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
case DISPID_NAVIGATEERROR: case DISPID_NAVIGATEERROR:
{ {
wxWebNavigationError errorType = wxWEB_NAV_ERR_OTHER; wxWebViewNavigationError errorType = wxWEB_NAV_ERR_OTHER;
wxString errorCode = "?"; wxString errorCode = "?";
switch (evt[3].GetLong()) switch (evt[3].GetLong())
{ {
@@ -937,8 +937,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
wxString url = evt[1].GetString(); wxString url = evt[1].GetString();
wxString target = evt[2].GetString(); wxString target = evt[2].GetString();
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR, GetId(), wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR, GetId(),
url, target, false); url, target, false);
event.SetEventObject(this); event.SetEventObject(this);
event.SetInt(errorType); event.SetInt(errorType);
event.SetString(errorCode); event.SetString(errorCode);
@@ -949,8 +949,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
{ {
wxString url = evt[4].GetString(); wxString url = evt[4].GetString();
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
GetId(), url, wxEmptyString, true); GetId(), url, wxEmptyString, true);
event.SetEventObject(this); event.SetEventObject(this);
HandleWindowEvent(event); HandleWindowEvent(event);

View File

@@ -1018,10 +1018,10 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
if (webKitWindow && frame == [sender mainFrame]){ if (webKitWindow && frame == [sender mainFrame]){
NSString *url = [[[[frame dataSource] request] URL] absoluteString]; NSString *url = [[[[frame dataSource] request] URL] absoluteString];
wxString target = wxStringWithNSString([frame name]); wxString target = wxStringWithNSString([frame name]);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
webKitWindow->GetId(), webKitWindow->GetId(),
wxStringWithNSString( url ), wxStringWithNSString( url ),
target, false); target, false);
if (webKitWindow && webKitWindow->GetEventHandler()) if (webKitWindow && webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent); webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
@@ -1036,17 +1036,17 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
NSString *url = [[[[frame dataSource] request] URL] absoluteString]; NSString *url = [[[[frame dataSource] request] URL] absoluteString];
wxString target = wxStringWithNSString([frame name]); wxString target = wxStringWithNSString([frame name]);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED,
webKitWindow->GetId(), webKitWindow->GetId(),
wxStringWithNSString( url ), wxStringWithNSString( url ),
target, false); target, false);
if (webKitWindow && webKitWindow->GetEventHandler()) if (webKitWindow && webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent); webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
} }
} }
wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out) wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
{ {
*out = wxWEB_NAV_ERR_OTHER; *out = wxWEB_NAV_ERR_OTHER;
@@ -1128,12 +1128,12 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
if (webKitWindow && frame == [sender mainFrame]){ if (webKitWindow && frame == [sender mainFrame]){
NSString *url = [[[[frame dataSource] request] URL] absoluteString]; NSString *url = [[[[frame dataSource] request] URL] absoluteString];
wxWebNavigationError type; wxWebViewNavigationError type;
wxString description = nsErrorToWxHtmlError(error, &type); wxString description = nsErrorToWxHtmlError(error, &type);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
webKitWindow->GetId(), webKitWindow->GetId(),
wxStringWithNSString( url ), wxStringWithNSString( url ),
wxEmptyString, false); wxEmptyString, false);
thisEvent.SetString(description); thisEvent.SetString(description);
thisEvent.SetInt(type); thisEvent.SetInt(type);
@@ -1154,12 +1154,12 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
NSString *url = [[[[frame provisionalDataSource] request] URL] NSString *url = [[[[frame provisionalDataSource] request] URL]
absoluteString]; absoluteString];
wxWebNavigationError type; wxWebViewNavigationError type;
wxString description = nsErrorToWxHtmlError(error, &type); wxString description = nsErrorToWxHtmlError(error, &type);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
webKitWindow->GetId(), webKitWindow->GetId(),
wxStringWithNSString( url ), wxStringWithNSString( url ),
wxEmptyString, false); wxEmptyString, false);
thisEvent.SetString(description); thisEvent.SetString(description);
thisEvent.SetInt(type); thisEvent.SetInt(type);
@@ -1172,10 +1172,10 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
forFrame:(WebFrame *)frame forFrame:(WebFrame *)frame
{ {
wxString target = wxStringWithNSString([frame name]); wxString target = wxStringWithNSString([frame name]);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
webKitWindow->GetId(), webKitWindow->GetId(),
webKitWindow->GetCurrentURL(), webKitWindow->GetCurrentURL(),
target, true); target, true);
thisEvent.SetString(wxStringWithNSString(title)); thisEvent.SetString(wxStringWithNSString(title));
@@ -1204,9 +1204,9 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
webKitWindow->m_busy = true; webKitWindow->m_busy = true;
NSString *url = [[request URL] absoluteString]; NSString *url = [[request URL] absoluteString];
wxString target = wxStringWithNSString([frame name]); wxString target = wxStringWithNSString([frame name]);
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
webKitWindow->GetId(), webKitWindow->GetId(),
wxStringWithNSString( url ), target, true); wxStringWithNSString( url ), target, true);
if (webKitWindow && webKitWindow->GetEventHandler()) if (webKitWindow && webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent); webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
@@ -1231,9 +1231,9 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
wxUnusedVar(actionInformation); wxUnusedVar(actionInformation);
NSString *url = [[request URL] absoluteString]; NSString *url = [[request URL] absoluteString];
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
webKitWindow->GetId(), webKitWindow->GetId(),
wxStringWithNSString( url ), "", true); wxStringWithNSString( url ), "", true);
if (webKitWindow && webKitWindow->GetEventHandler()) if (webKitWindow && webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent); webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);