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:
parent
9f72fa7c2d
commit
04fa04d806
@ -53,7 +53,7 @@ enum wxWebViewZoomType
|
||||
};
|
||||
|
||||
/** Types of errors that can cause navigation to fail */
|
||||
enum wxWebNavigationError
|
||||
enum wxWebViewNavigationError
|
||||
{
|
||||
/** Connection error (timeout, etc.) */
|
||||
wxWEB_NAV_ERR_CONNECTION,
|
||||
@ -347,12 +347,12 @@ public:
|
||||
wxDECLARE_ABSTRACT_CLASS(wxWebView);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_WEB wxWebNavigationEvent : public wxCommandEvent
|
||||
class WXDLLIMPEXP_WEB wxWebViewEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxWebNavigationEvent() {}
|
||||
wxWebNavigationEvent(wxEventType type, int id, const wxString url,
|
||||
const wxString target, bool canVeto)
|
||||
wxWebViewEvent() {}
|
||||
wxWebViewEvent(wxEventType type, int id, const wxString url,
|
||||
const wxString target, bool canVeto)
|
||||
: wxCommandEvent(type, id)
|
||||
{
|
||||
m_url = url;
|
||||
@ -373,7 +373,7 @@ public:
|
||||
const wxString& GetTarget() const { return m_target; }
|
||||
|
||||
// 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
|
||||
* meaningful for events fired before navigation takes place.
|
||||
@ -396,45 +396,45 @@ private:
|
||||
bool m_canVeto;
|
||||
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_NAVIGATED, wxWebNavigationEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent );
|
||||
|
||||
typedef void (wxEvtHandler::*wxWebNavigationEventFunction)
|
||||
(wxWebNavigationEvent&);
|
||||
typedef void (wxEvtHandler::*wxWebViewEventFunction)
|
||||
(wxWebViewEvent&);
|
||||
|
||||
#define wxWebNavigationEventHandler(func) \
|
||||
wxEVENT_HANDLER_CAST(wxWebNavigationEventFunction, func)
|
||||
#define wxWebViewEventHandler(func) \
|
||||
wxEVENT_HANDLER_CAST(wxWebViewEventFunction, func)
|
||||
|
||||
#define EVT_WEB_VIEW_NAVIGATING(id, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, id, \
|
||||
wxHtmlNavigatingEventHandler(fn))
|
||||
wxWebViewEventHandler(fn))
|
||||
|
||||
#define EVT_WEB_VIEW_NAVIGATED(id, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, id, \
|
||||
wxHtmlNavigatingEventHandler(fn))
|
||||
wxWebViewEventHandler(fn))
|
||||
|
||||
#define EVT_WEB_VIEW_LOADED(id, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_LOADED, id, \
|
||||
wxHtmlNavigatingEventHandler(fn))
|
||||
wxWebViewEventHandler(fn))
|
||||
|
||||
#define EVT_WEB_VIEW_ERRROR(id, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_ERROR, id, \
|
||||
wxHtmlNavigatingEventHandler(fn))
|
||||
wxWebViewEventHandler(fn))
|
||||
|
||||
#define EVT_WEB_VIEW_NEWWINDOW(id, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, id, \
|
||||
wxHtmlNavigatingEventHandler(fn))
|
||||
wxWebViewEventHandler(fn))
|
||||
|
||||
#define EVT_WEB_VIEW_TITLE_CHANGED(id, fn) \
|
||||
wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, id, \
|
||||
wxHtmlNavigatingEventHandler(fn))
|
||||
wxWebViewEventHandler(fn))
|
||||
|
||||
#endif // wxUSE_WEB
|
||||
|
||||
|
@ -37,7 +37,7 @@ enum wxWebViewZoomType
|
||||
/**
|
||||
Types of errors that can cause navigation to fail
|
||||
*/
|
||||
enum wxWebNavigationError
|
||||
enum wxWebViewNavigationError
|
||||
{
|
||||
/** Connection error (timeout, etc.) */
|
||||
wxWEB_NAV_ERR_CONNECTION,
|
||||
@ -211,7 +211,7 @@ public:
|
||||
standard @c file syntax as well as paths to archives of the form
|
||||
@c file:///C:/exmaple/docs.zip;protocol=zip/main.htm
|
||||
|
||||
@beginEventEmissionTable{wxWebNavigationEvent}
|
||||
@beginEventEmissionTable{wxWebViewEvent}
|
||||
@event{EVT_WEB_VIEW_NAVIGATING(id, func)}
|
||||
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
|
||||
@ -243,7 +243,7 @@ public:
|
||||
|
||||
@library{wxweb}
|
||||
@category{ctrl,web}
|
||||
@see wxWebHandler, wxWebNavigationEvent
|
||||
@see wxWebHandler, wxWebViewEvent
|
||||
*/
|
||||
class wxWebView : public wxControl
|
||||
{
|
||||
@ -586,12 +586,12 @@ public:
|
||||
|
||||
|
||||
/**
|
||||
@class wxWebNavigationEvent
|
||||
@class wxWebViewEvent
|
||||
|
||||
A navigation event holds information about events associated with
|
||||
wxWebView objects.
|
||||
|
||||
@beginEventEmissionTable{wxWebNavigationEvent}
|
||||
@beginEventEmissionTable{wxWebViewEvent}
|
||||
@event{EVT_WEB_VIEW_NAVIGATING(id, func)}
|
||||
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
|
||||
@ -626,12 +626,12 @@ public:
|
||||
|
||||
@see wxWebView
|
||||
*/
|
||||
class wxWebNavigationEvent : public wxCommandEvent
|
||||
class wxWebViewEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxWebNavigationEvent();
|
||||
wxWebNavigationEvent(wxEventType type, int id, const wxString href,
|
||||
const wxString target, bool canVeto);
|
||||
wxWebViewEvent();
|
||||
wxWebViewEvent(wxEventType type, int id, const wxString href,
|
||||
const wxString target, bool canVeto);
|
||||
|
||||
/**
|
||||
Get the name of the target frame which the url of this event
|
||||
|
@ -73,15 +73,15 @@ public:
|
||||
void OnReload(wxCommandEvent& evt);
|
||||
void OnClearHistory(wxCommandEvent& evt);
|
||||
void OnEnableHistory(wxCommandEvent& evt);
|
||||
void OnNavigationRequest(wxWebNavigationEvent& evt);
|
||||
void OnNavigationComplete(wxWebNavigationEvent& evt);
|
||||
void OnDocumentLoaded(wxWebNavigationEvent& evt);
|
||||
void OnNewWindow(wxWebNavigationEvent& evt);
|
||||
void OnTitleChanged(wxWebNavigationEvent& evt);
|
||||
void OnNavigationRequest(wxWebViewEvent& evt);
|
||||
void OnNavigationComplete(wxWebViewEvent& evt);
|
||||
void OnDocumentLoaded(wxWebViewEvent& evt);
|
||||
void OnNewWindow(wxWebViewEvent& evt);
|
||||
void OnTitleChanged(wxWebViewEvent& evt);
|
||||
void OnViewSourceRequest(wxCommandEvent& evt);
|
||||
void OnToolsClicked(wxCommandEvent& evt);
|
||||
void OnSetZoom(wxCommandEvent& evt);
|
||||
void OnError(wxWebNavigationEvent& evt);
|
||||
void OnError(wxWebViewEvent& evt);
|
||||
void OnPrint(wxCommandEvent& evt);
|
||||
void OnCut(wxCommandEvent& evt);
|
||||
void OnCopy(wxCommandEvent& evt);
|
||||
@ -293,17 +293,17 @@ WebFrame::WebFrame() : wxFrame(NULL, wxID_ANY, "wxWebView Sample")
|
||||
|
||||
// Connect the webview events
|
||||
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,
|
||||
wxWebNavigationEventHandler(WebFrame::OnNavigationComplete), NULL, this);
|
||||
wxWebViewEventHandler(WebFrame::OnNavigationComplete), NULL, this);
|
||||
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,
|
||||
wxWebNavigationEventHandler(WebFrame::OnError), NULL, this);
|
||||
wxWebViewEventHandler(WebFrame::OnError), NULL, this);
|
||||
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,
|
||||
wxWebNavigationEventHandler(WebFrame::OnTitleChanged), NULL, this);
|
||||
wxWebViewEventHandler(WebFrame::OnTitleChanged), NULL, this);
|
||||
|
||||
// Connect the menu events
|
||||
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
|
||||
* when the user clicks a link)
|
||||
*/
|
||||
void WebFrame::OnNavigationRequest(wxWebNavigationEvent& evt)
|
||||
void WebFrame::OnNavigationRequest(wxWebViewEvent& evt)
|
||||
{
|
||||
if(m_info->IsShown())
|
||||
{
|
||||
@ -528,7 +528,7 @@ void WebFrame::OnNavigationRequest(wxWebNavigationEvent& evt)
|
||||
/**
|
||||
* 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() + "'");
|
||||
UpdateState();
|
||||
@ -537,7 +537,7 @@ void WebFrame::OnNavigationComplete(wxWebNavigationEvent& evt)
|
||||
/**
|
||||
* 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
|
||||
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
|
||||
*/
|
||||
void WebFrame::OnNewWindow(wxWebNavigationEvent& evt)
|
||||
void WebFrame::OnNewWindow(wxWebViewEvent& evt)
|
||||
{
|
||||
wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'");
|
||||
|
||||
@ -562,7 +562,7 @@ void WebFrame::OnNewWindow(wxWebNavigationEvent& evt)
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void WebFrame::OnTitleChanged(wxWebNavigationEvent& evt)
|
||||
void WebFrame::OnTitleChanged(wxWebViewEvent& evt)
|
||||
{
|
||||
wxLogMessage("%s", "Title changed; title='" + evt.GetString() + "'");
|
||||
UpdateState();
|
||||
@ -731,7 +731,7 @@ void WebFrame::OnSelectAll(wxCommandEvent& WXUNUSED(evt))
|
||||
/**
|
||||
* Callback invoked when a loading error occurs
|
||||
*/
|
||||
void WebFrame::OnError(wxWebNavigationEvent& evt)
|
||||
void WebFrame::OnError(wxWebViewEvent& evt)
|
||||
{
|
||||
wxString errorCategory;
|
||||
switch (evt.GetInt())
|
||||
|
@ -30,14 +30,14 @@ extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[] = "wxWebView";
|
||||
extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank";
|
||||
|
||||
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_NAVIGATED, wxWebNavigationEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebNavigationEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebViewEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebViewEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebViewEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebViewEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebViewEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED, wxWebViewEvent );
|
||||
|
||||
// static
|
||||
wxWebView* wxWebView::New(wxWebViewBackend backend)
|
||||
|
@ -44,22 +44,22 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget,
|
||||
if (status == WEBKIT_LOAD_FINISHED)
|
||||
{
|
||||
webKitCtrl->m_busy = false;
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED,
|
||||
webKitCtrl->GetId(),
|
||||
url, target, false);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED,
|
||||
webKitCtrl->GetId(),
|
||||
url, target, false);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
else if (status == WEBKIT_LOAD_COMMITTED)
|
||||
{
|
||||
webKitCtrl->m_busy = true;
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
webKitCtrl->GetId(),
|
||||
url, target, false);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
webKitCtrl->GetId(),
|
||||
url, target, false);
|
||||
|
||||
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);
|
||||
|
||||
wxString target = webkit_web_frame_get_name (frame);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
|
||||
webKitCtrl->GetId(),
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target,
|
||||
true);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
|
||||
webKitCtrl->GetId(),
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target,
|
||||
true);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
if (thisEvent.IsVetoed())
|
||||
if (event.IsVetoed())
|
||||
{
|
||||
webKitCtrl->m_busy = false;
|
||||
webkit_web_policy_decision_ignore(policy_decision);
|
||||
@ -141,7 +141,7 @@ wxgtk_webview_webkit_error(WebKitWebView*,
|
||||
wxWebViewWebKit* webKitWindow)
|
||||
{
|
||||
webKitWindow->m_busy = false;
|
||||
wxWebNavigationError type = wxWEB_NAV_ERR_OTHER;
|
||||
wxWebViewNavigationError type = wxWEB_NAV_ERR_OTHER;
|
||||
|
||||
GError* error = (GError*)web_error;
|
||||
wxString description(error->message, wxConvUTF8);
|
||||
@ -260,17 +260,15 @@ wxgtk_webview_webkit_error(WebKitWebView*,
|
||||
}
|
||||
*/
|
||||
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
uri,
|
||||
wxEmptyString,
|
||||
false);
|
||||
thisEvent.SetString(description);
|
||||
thisEvent.SetInt(type);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
uri, "", false);
|
||||
event.SetString(description);
|
||||
event.SetInt(type);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
{
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -287,14 +285,14 @@ wxgtk_webview_webkit_new_window(WebKitWebView*,
|
||||
const gchar* uri = webkit_network_request_get_uri(request);
|
||||
|
||||
wxString target = webkit_web_frame_get_name (frame);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
|
||||
webKitCtrl->GetId(),
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target,
|
||||
true);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
|
||||
webKitCtrl->GetId(),
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target,
|
||||
true);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
//We always want the user to handle this themselves
|
||||
webkit_web_policy_decision_ignore(policy_decision);
|
||||
@ -307,15 +305,14 @@ wxgtk_webview_webkit_title_changed(WebKitWebView*,
|
||||
gchar *title,
|
||||
wxWebViewWebKit *webKitCtrl)
|
||||
{
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
|
||||
webKitCtrl->GetId(),
|
||||
webKitCtrl->GetCurrentURL(),
|
||||
"",
|
||||
true);
|
||||
thisEvent.SetString(wxString(title, wxConvUTF8));
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
|
||||
webKitCtrl->GetId(),
|
||||
webKitCtrl->GetCurrentURL(),
|
||||
"", true);
|
||||
event.SetString(wxString(title, wxConvUTF8));
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,8 @@ void wxWebViewIE::SetPage(const wxString& html, const wxString& baseUrl)
|
||||
|
||||
//We send the events when we are done to mimic webkit
|
||||
//Navigated event
|
||||
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
GetId(), baseUrl, "", false);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
GetId(), baseUrl, "", false);
|
||||
event.SetEventObject(this);
|
||||
HandleWindowEvent(event);
|
||||
|
||||
@ -722,8 +722,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
wxString url = evt[1].GetString();
|
||||
wxString target = evt[3].GetString();
|
||||
|
||||
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
|
||||
GetId(), url, target, true);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
|
||||
GetId(), url, target, true);
|
||||
event.SetEventObject(this);
|
||||
HandleWindowEvent(event);
|
||||
|
||||
@ -748,8 +748,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
wxString url = evt[1].GetString();
|
||||
// TODO: set target parameter if possible
|
||||
wxString target = wxEmptyString;
|
||||
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
GetId(), url, target, false);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
GetId(), url, target, false);
|
||||
event.SetEventObject(this);
|
||||
HandleWindowEvent(event);
|
||||
break;
|
||||
@ -797,8 +797,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
m_historyLoadingFromList = false;
|
||||
// TODO: set target parameter if possible
|
||||
wxString target = wxEmptyString;
|
||||
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED, GetId(),
|
||||
url, target, false);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED, GetId(),
|
||||
url, target, false);
|
||||
event.SetEventObject(this);
|
||||
HandleWindowEvent(event);
|
||||
break;
|
||||
@ -813,8 +813,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
{
|
||||
wxString title = evt[0].GetString();
|
||||
|
||||
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
|
||||
GetId(), GetCurrentURL(), wxEmptyString, true);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
|
||||
GetId(), GetCurrentURL(), wxEmptyString, true);
|
||||
event.SetString(title);
|
||||
event.SetEventObject(this);
|
||||
HandleWindowEvent(event);
|
||||
@ -823,7 +823,7 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
|
||||
case DISPID_NAVIGATEERROR:
|
||||
{
|
||||
wxWebNavigationError errorType = wxWEB_NAV_ERR_OTHER;
|
||||
wxWebViewNavigationError errorType = wxWEB_NAV_ERR_OTHER;
|
||||
wxString errorCode = "?";
|
||||
switch (evt[3].GetLong())
|
||||
{
|
||||
@ -937,8 +937,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
|
||||
wxString url = evt[1].GetString();
|
||||
wxString target = evt[2].GetString();
|
||||
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR, GetId(),
|
||||
url, target, false);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR, GetId(),
|
||||
url, target, false);
|
||||
event.SetEventObject(this);
|
||||
event.SetInt(errorType);
|
||||
event.SetString(errorCode);
|
||||
@ -949,8 +949,8 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
|
||||
{
|
||||
wxString url = evt[4].GetString();
|
||||
|
||||
wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
|
||||
GetId(), url, wxEmptyString, true);
|
||||
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
|
||||
GetId(), url, wxEmptyString, true);
|
||||
event.SetEventObject(this);
|
||||
HandleWindowEvent(event);
|
||||
|
||||
|
@ -1018,10 +1018,10 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
|
||||
if (webKitWindow && frame == [sender mainFrame]){
|
||||
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
target, false);
|
||||
wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
target, false);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
@ -1036,17 +1036,17 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
|
||||
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
|
||||
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
target, false);
|
||||
wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
target, false);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
}
|
||||
}
|
||||
|
||||
wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
|
||||
wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
{
|
||||
*out = wxWEB_NAV_ERR_OTHER;
|
||||
|
||||
@ -1128,12 +1128,12 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
|
||||
if (webKitWindow && frame == [sender mainFrame]){
|
||||
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
|
||||
|
||||
wxWebNavigationError type;
|
||||
wxWebViewNavigationError type;
|
||||
wxString description = nsErrorToWxHtmlError(error, &type);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxEmptyString, false);
|
||||
wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxEmptyString, false);
|
||||
thisEvent.SetString(description);
|
||||
thisEvent.SetInt(type);
|
||||
|
||||
@ -1154,12 +1154,12 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
|
||||
NSString *url = [[[[frame provisionalDataSource] request] URL]
|
||||
absoluteString];
|
||||
|
||||
wxWebNavigationError type;
|
||||
wxWebViewNavigationError type;
|
||||
wxString description = nsErrorToWxHtmlError(error, &type);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxEmptyString, false);
|
||||
wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxEmptyString, false);
|
||||
thisEvent.SetString(description);
|
||||
thisEvent.SetInt(type);
|
||||
|
||||
@ -1172,10 +1172,10 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
|
||||
forFrame:(WebFrame *)frame
|
||||
{
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
|
||||
webKitWindow->GetId(),
|
||||
webKitWindow->GetCurrentURL(),
|
||||
target, true);
|
||||
wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
|
||||
webKitWindow->GetId(),
|
||||
webKitWindow->GetCurrentURL(),
|
||||
target, true);
|
||||
|
||||
thisEvent.SetString(wxStringWithNSString(title));
|
||||
|
||||
@ -1204,9 +1204,9 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
|
||||
webKitWindow->m_busy = true;
|
||||
NSString *url = [[request URL] absoluteString];
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ), target, true);
|
||||
wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ), target, true);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
@ -1231,9 +1231,9 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
|
||||
wxUnusedVar(actionInformation);
|
||||
|
||||
NSString *url = [[request URL] absoluteString];
|
||||
wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ), "", true);
|
||||
wxWebViewNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ), "", true);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
|
||||
|
Loading…
Reference in New Issue
Block a user