X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ee5edc7997cc58d93e4d32be8177041eac19abc..0d19936d71032ba7658616faed3b63d4c930e5b4:/src/osx/carbon/utils.cpp diff --git a/src/osx/carbon/utils.cpp b/src/osx/carbon/utils.cpp index e22569821c..a878933818 100644 --- a/src/osx/carbon/utils.cpp +++ b/src/osx/carbon/utils.cpp @@ -144,8 +144,55 @@ wxString wxMacFindFolder( short vol, #endif // wxUSE_BASE + +// ============================================================================ +// GUI-only functions from now on +// ============================================================================ + #if wxUSE_GUI +// ---------------------------------------------------------------------------- +// Launch document with default app +// ---------------------------------------------------------------------------- + +bool wxLaunchDefaultApplication(const wxString& document, int flags) +{ + wxUnusedVar(flags); + + static const char * const OPEN_CMD = "/usr/bin/open"; + if ( wxFileExists(OPEN_CMD) && + wxExecute(wxString(OPEN_CMD) + " " + document) ) + return true; + + return false; +} + +// ---------------------------------------------------------------------------- +// Launch default browser +// ---------------------------------------------------------------------------- + +bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) +{ + wxUnusedVar(flags); + wxCFRef< CFURLRef > curl( CFURLCreateWithString( kCFAllocatorDefault, + wxCFStringRef( url ), NULL ) ); + OSStatus err = LSOpenCFURLRef( curl , NULL ); + + if (err == noErr) + { + return true; + } + else + { + wxLogDebug(wxT("Browser Launch error %d"), (int) err); + return false; + } +} + +// ---------------------------------------------------------------------------- +// Miscellaneous functions +// ---------------------------------------------------------------------------- + void wxGetMousePosition( int* x, int* y ) { Point pt; @@ -679,11 +726,10 @@ bool wxMacDataItem::IsLessThan(wxMacDataItemBrowserControl *WXUNUSED(owner) , const wxMacDataItem* rhs, DataBrowserPropertyID sortProperty) const { - const wxMacDataItem* otherItem = wx_const_cast(wxMacDataItem*,rhs); bool retval = false; if ( sortProperty == kNumericOrderColumnId ) - retval = m_order < otherItem->m_order; + retval = m_order < rhs->m_order; return retval; }