remove dependency from former cocoa port
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76729 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,7 +23,9 @@
|
||||
#endif
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#if defined( __WXCOCOA__ )
|
||||
#include "wx/cocoa/string.h"
|
||||
#endif
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/filesys.h"
|
||||
|
||||
@@ -528,7 +530,7 @@ wxString wxWebViewWebKit::GetPageSource() const
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
return wxStringWithNSString( source );
|
||||
return wxCFStringRef::AsString( source );
|
||||
}
|
||||
|
||||
return wxEmptyString;
|
||||
@@ -659,7 +661,7 @@ void wxWebViewWebKit::SetScrollPos(int pos)
|
||||
wxString javascript;
|
||||
javascript.Printf(wxT("document.body.scrollTop = %d;"), pos);
|
||||
[[m_webView windowScriptObject] evaluateWebScript:
|
||||
(NSString*)wxNSStringWithWxString( javascript )];
|
||||
wxCFStringRef( javascript ).AsNSString()];
|
||||
}
|
||||
|
||||
wxString wxWebViewWebKit::GetSelectedText() const
|
||||
@@ -668,7 +670,7 @@ wxString wxWebViewWebKit::GetSelectedText() const
|
||||
if ( !dr )
|
||||
return wxString();
|
||||
|
||||
return wxStringWithNSString([dr toString]);
|
||||
return wxCFStringRef::AsString([dr toString]);
|
||||
}
|
||||
|
||||
void wxWebViewWebKit::RunScript(const wxString& javascript)
|
||||
@@ -677,7 +679,7 @@ void wxWebViewWebKit::RunScript(const wxString& javascript)
|
||||
return;
|
||||
|
||||
[[m_webView windowScriptObject] evaluateWebScript:
|
||||
(NSString*)wxNSStringWithWxString( javascript )];
|
||||
wxCFStringRef( javascript ).AsNSString()];
|
||||
}
|
||||
|
||||
void wxWebViewWebKit::OnSize(wxSizeEvent &event)
|
||||
@@ -772,17 +774,17 @@ void wxWebViewWebKit::MacVisibilityChanged(){
|
||||
void wxWebViewWebKit::LoadURL(const wxString& url)
|
||||
{
|
||||
[[m_webView mainFrame] loadRequest:[NSURLRequest requestWithURL:
|
||||
[NSURL URLWithString:wxNSStringWithWxString(url)]]];
|
||||
[NSURL URLWithString:wxCFStringRef(url).AsNSString()]]];
|
||||
}
|
||||
|
||||
wxString wxWebViewWebKit::GetCurrentURL() const
|
||||
{
|
||||
return wxStringWithNSString([m_webView mainFrameURL]);
|
||||
return wxCFStringRef::AsString([m_webView mainFrameURL]);
|
||||
}
|
||||
|
||||
wxString wxWebViewWebKit::GetCurrentTitle() const
|
||||
{
|
||||
return wxStringWithNSString([m_webView mainFrameTitle]);
|
||||
return wxCFStringRef::AsString([m_webView mainFrameTitle]);
|
||||
}
|
||||
|
||||
float wxWebViewWebKit::GetWebkitZoom() const
|
||||
@@ -862,9 +864,9 @@ void wxWebViewWebKit::DoSetPage(const wxString& src, const wxString& baseUrl)
|
||||
if ( !m_webView )
|
||||
return;
|
||||
|
||||
[[m_webView mainFrame] loadHTMLString:(NSString*)wxNSStringWithWxString(src)
|
||||
[[m_webView mainFrame] loadHTMLString:wxCFStringRef( src ).AsNSString()
|
||||
baseURL:[NSURL URLWithString:
|
||||
wxNSStringWithWxString( baseUrl )]];
|
||||
wxCFStringRef( baseUrl ).AsNSString()]];
|
||||
}
|
||||
|
||||
void wxWebViewWebKit::Cut()
|
||||
@@ -929,14 +931,14 @@ wxString wxWebViewWebKit::GetSelectedSource() const
|
||||
if ( !dr )
|
||||
return wxString();
|
||||
|
||||
return wxStringWithNSString([dr markupString]);
|
||||
return wxCFStringRef::AsString([dr markupString]);
|
||||
}
|
||||
|
||||
wxString wxWebViewWebKit::GetPageText() const
|
||||
{
|
||||
NSString *result = [m_webView stringByEvaluatingJavaScriptFromString:
|
||||
@"document.body.textContent"];
|
||||
return wxStringWithNSString(result);
|
||||
return wxCFStringRef::AsString(result);
|
||||
}
|
||||
|
||||
void wxWebViewWebKit::EnableHistory(bool enable)
|
||||
@@ -961,8 +963,8 @@ wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewWebKit::GetBackwardHistory
|
||||
for(int i = -count; i < 0; i++)
|
||||
{
|
||||
WebHistoryItem* item = [history itemAtIndex:i];
|
||||
wxString url = wxStringWithNSString([item URLString]);
|
||||
wxString title = wxStringWithNSString([item title]);
|
||||
wxString url = wxCFStringRef::AsString([item URLString]);
|
||||
wxString title = wxCFStringRef::AsString([item title]);
|
||||
wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem(url, title);
|
||||
wxitem->m_histItem = item;
|
||||
wxSharedPtr<wxWebViewHistoryItem> itemptr(wxitem);
|
||||
@@ -979,8 +981,8 @@ wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewWebKit::GetForwardHistory(
|
||||
for(int i = 1; i <= count; i++)
|
||||
{
|
||||
WebHistoryItem* item = [history itemAtIndex:i];
|
||||
wxString url = wxStringWithNSString([item URLString]);
|
||||
wxString title = wxStringWithNSString([item title]);
|
||||
wxString url = wxCFStringRef::AsString([item URLString]);
|
||||
wxString title = wxCFStringRef::AsString([item title]);
|
||||
wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem(url, title);
|
||||
wxitem->m_histItem = item;
|
||||
wxSharedPtr<wxWebViewHistoryItem> itemptr(wxitem);
|
||||
@@ -1052,10 +1054,10 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
|
||||
|
||||
if (webKitWindow && frame == [sender mainFrame]){
|
||||
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxString target = wxCFStringRef::AsString([frame name]);
|
||||
wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATED,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxCFStringRef::AsString( url ),
|
||||
target);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
@@ -1070,10 +1072,10 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
|
||||
if (webKitWindow && frame == [sender mainFrame]){
|
||||
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
|
||||
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxString target = wxCFStringRef::AsString([frame name]);
|
||||
wxWebViewEvent event(wxEVT_WEBVIEW_LOADED,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxCFStringRef::AsString( url ),
|
||||
target);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
@@ -1148,11 +1150,11 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
}
|
||||
}
|
||||
|
||||
wxString message = wxStringWithNSString([error localizedDescription]);
|
||||
wxString message = wxCFStringRef::AsString([error localizedDescription]);
|
||||
NSString* detail = [error localizedFailureReason];
|
||||
if (detail != NULL)
|
||||
{
|
||||
message = message + " (" + wxStringWithNSString(detail) + ")";
|
||||
message = message + " (" + wxCFStringRef::AsString(detail) + ")";
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@@ -1169,7 +1171,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
wxString description = nsErrorToWxHtmlError(error, &type);
|
||||
wxWebViewEvent event(wxEVT_WEBVIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxCFStringRef::AsString( url ),
|
||||
wxEmptyString);
|
||||
event.SetString(description);
|
||||
event.SetInt(type);
|
||||
@@ -1195,7 +1197,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
wxString description = nsErrorToWxHtmlError(error, &type);
|
||||
wxWebViewEvent event(wxEVT_WEBVIEW_ERROR,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ),
|
||||
wxCFStringRef::AsString( url ),
|
||||
wxEmptyString);
|
||||
event.SetString(description);
|
||||
event.SetInt(type);
|
||||
@@ -1208,13 +1210,13 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title
|
||||
forFrame:(WebFrame *)frame
|
||||
{
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxString target = wxCFStringRef::AsString([frame name]);
|
||||
wxWebViewEvent event(wxEVT_WEBVIEW_TITLE_CHANGED,
|
||||
webKitWindow->GetId(),
|
||||
webKitWindow->GetCurrentURL(),
|
||||
target);
|
||||
|
||||
event.SetString(wxStringWithNSString(title));
|
||||
event.SetString(wxCFStringRef::AsString(title));
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(event);
|
||||
@@ -1240,10 +1242,10 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
|
||||
webKitWindow->m_busy = true;
|
||||
NSString *url = [[request URL] absoluteString];
|
||||
wxString target = wxStringWithNSString([frame name]);
|
||||
wxString target = wxCFStringRef::AsString([frame name]);
|
||||
wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATING,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ), target);
|
||||
wxCFStringRef::AsString( url ), target);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(event);
|
||||
@@ -1270,7 +1272,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
NSString *url = [[request URL] absoluteString];
|
||||
wxWebViewEvent event(wxEVT_WEBVIEW_NEWWINDOW,
|
||||
webKitWindow->GetId(),
|
||||
wxStringWithNSString( url ), "");
|
||||
wxCFStringRef::AsString( url ), "");
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(event);
|
||||
@@ -1290,7 +1292,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
wxStringToWebHandlerMap::const_iterator it;
|
||||
for( it = g_stringHandlerMap.begin(); it != g_stringHandlerMap.end(); ++it )
|
||||
{
|
||||
if(it->first.IsSameAs(wxStringWithNSString(scheme)))
|
||||
if(it->first.IsSameAs(wxCFStringRef::AsString(scheme)))
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
@@ -1312,8 +1314,8 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
|
||||
id<NSURLProtocolClient> client = [self client];
|
||||
|
||||
wxString wxpath = wxStringWithNSString(path);
|
||||
wxString scheme = wxStringWithNSString([[request URL] scheme]);
|
||||
wxString wxpath = wxCFStringRef::AsString(path);
|
||||
wxString scheme = wxCFStringRef::AsString([[request URL] scheme]);
|
||||
wxFSFile* file = g_stringHandlerMap[scheme]->GetFile(wxpath);
|
||||
|
||||
if (!file)
|
||||
@@ -1331,7 +1333,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
||||
|
||||
|
||||
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[request URL]
|
||||
MIMEType:wxNSStringWithWxString(file->GetMimeType())
|
||||
MIMEType:wxCFStringRef(file->GetMimeType()).AsNSString()
|
||||
expectedContentLength:length
|
||||
textEncodingName:nil];
|
||||
|
||||
|
Reference in New Issue
Block a user