Provide wxLaunchDefaultBrowser implementation for wxCocoa.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45892 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,6 +27,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "wx/cocoa/string.h"
|
||||||
|
|
||||||
|
#import <Foundation/NSURL.h>
|
||||||
|
#import <AppKit/NSWorkspace.h>
|
||||||
|
|
||||||
void wxDisplaySize(int *width, int *height)
|
void wxDisplaySize(int *width, int *height)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
@@ -97,6 +102,13 @@ void wxBell()
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Private helper method for wxLaunchDefaultBrowser
|
||||||
|
bool wxCocoaLaunchDefaultBrowser(const wxString& url, int flags)
|
||||||
|
{
|
||||||
|
// NOTE: We ignore the flags
|
||||||
|
return [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:wxNSStringWithWxString(url)]] != NO;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
|
// DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
|
||||||
// them. If someone needs them, then they'll get a link error
|
// them. If someone needs them, then they'll get a link error
|
||||||
|
@@ -678,6 +678,11 @@ wxRegisterId (long id)
|
|||||||
// Launch default browser
|
// Launch default browser
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef __WXCOCOA__
|
||||||
|
// Private method in Objective-C++ source file.
|
||||||
|
bool wxCocoaLaunchDefaultBrowser(const wxString& url, int flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
|
bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
|
||||||
{
|
{
|
||||||
wxUnusedVar(flags);
|
wxUnusedVar(flags);
|
||||||
@@ -778,6 +783,10 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
|
|||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#elif defined(__WXCOCOA__)
|
||||||
|
// NOTE: We need to call the real implementation from src/cocoa/utils.mm
|
||||||
|
// because the code must use Objective-C features.
|
||||||
|
return wxCocoaLaunchDefaultBrowser(url, flags);
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
ICInstance inst;
|
ICInstance inst;
|
||||||
|
Reference in New Issue
Block a user