From 0fc53016a968275306cd9acdbd4c57bd70803d8d Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 28 Feb 2018 21:08:27 +0100 Subject: [PATCH] making NSString conversion functions available in private.h --- include/wx/osx/cocoa/private.h | 5 +++++ src/html/htmlctrl/webkit/webkit.mm | 24 ------------------------ src/osx/carbon/utilscocoa.mm | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index 07402e06d16c..057ddc8debdf 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -500,6 +500,11 @@ extern ClassicCursor gMacCursors[]; extern NSLayoutManager* gNSLayoutManager; +// NSString<->wxString + +wxString wxStringWithNSString(NSString *nsstring); +NSString* wxNSStringWithWxString(const wxString &wxstring); + #endif // wxUSE_GUI #endif diff --git a/src/html/htmlctrl/webkit/webkit.mm b/src/html/htmlctrl/webkit/webkit.mm index 5f581671b0c1..e9a8742a4545 100644 --- a/src/html/htmlctrl/webkit/webkit.mm +++ b/src/html/htmlctrl/webkit/webkit.mm @@ -93,30 +93,6 @@ } } - - -//--------------------------------------------------------- -// helper functions for NSString<->wxString conversion -//--------------------------------------------------------- - -inline wxString wxStringWithNSString(NSString *nsstring) -{ -#if wxUSE_UNICODE - return wxString([nsstring UTF8String], wxConvUTF8); -#else - return wxString([nsstring lossyCString]); -#endif // wxUSE_UNICODE -} - -inline NSString* wxNSStringWithWxString(const wxString &wxstring) -{ -#if wxUSE_UNICODE - return [NSString stringWithUTF8String: wxstring.mb_str(wxConvUTF8)]; -#else - return [NSString stringWithCString: wxstring.c_str() length:wxstring.Len()]; -#endif // wxUSE_UNICODE -} - inline int wxNavTypeFromWebNavType(int type){ if (type == WebNavigationTypeLinkClicked) return wxWEBKIT_NAV_LINK_CLICKED; diff --git a/src/osx/carbon/utilscocoa.mm b/src/osx/carbon/utilscocoa.mm index 4c8b13dbbe1d..4bb4f8fc17b9 100644 --- a/src/osx/carbon/utilscocoa.mm +++ b/src/osx/carbon/utilscocoa.mm @@ -562,5 +562,27 @@ void wxMacCocoaShowCursor() [NSCursor unhide]; } +//--------------------------------------------------------- +// helper functions for NSString<->wxString conversion +//--------------------------------------------------------- + +wxString wxStringWithNSString(NSString *nsstring) +{ +#if wxUSE_UNICODE + return wxString([nsstring UTF8String], wxConvUTF8); +#else + return wxString([nsstring lossyCString]); +#endif // wxUSE_UNICODE +} + +NSString* wxNSStringWithWxString(const wxString &wxstring) +{ +#if wxUSE_UNICODE + return [NSString stringWithUTF8String: wxstring.mb_str(wxConvUTF8)]; +#else + return [NSString stringWithCString: wxstring.c_str() length:wxstring.Len()]; +#endif // wxUSE_UNICODE +} + #endif