cleanup mac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#if defined(__MWERKS__) && wxUSE_UNICODE
|
#if defined(__MWERKS__) && wxUSE_UNICODE
|
||||||
#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
|
#if __MWERKS__ < 0x4100
|
||||||
#include <wtime.h>
|
#include <wtime.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2234,8 +2234,6 @@ void wxDC::Clear(void)
|
|||||||
wxFAIL_MSG( wxT("There shouldn't be theme backgrounds under Quartz") ) ;
|
wxFAIL_MSG( wxT("There shouldn't be theme backgrounds under Quartz") ) ;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
{
|
|
||||||
HIThemeBackgroundDrawInfo drawInfo ;
|
HIThemeBackgroundDrawInfo drawInfo ;
|
||||||
drawInfo.version = 0 ;
|
drawInfo.version = 0 ;
|
||||||
drawInfo.state = kThemeStateActive ;
|
drawInfo.state = kThemeStateActive ;
|
||||||
@@ -2245,7 +2243,6 @@ void wxDC::Clear(void)
|
|||||||
HIThemeDrawBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
|
HIThemeDrawBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
|
||||||
HIThemeApplyBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
|
HIThemeApplyBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
@@ -613,8 +613,7 @@ static pascal void ListBoxDrawProc(
|
|||||||
// TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor
|
// TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor
|
||||||
// is incorporated Panther DB starts using kThemeBrushSecondaryHighlightColor
|
// is incorporated Panther DB starts using kThemeBrushSecondaryHighlightColor
|
||||||
// for inactive browser highlighting
|
// for inactive browser highlighting
|
||||||
Gestalt( gestaltSystemVersion, &systemVersion );
|
if ( !IsControlActive( browser ) )
|
||||||
if ( (systemVersion >= 0x00001030) && !IsControlActive( browser ) )
|
|
||||||
colorBrushID = kThemeBrushSecondaryHighlightColor;
|
colorBrushID = kThemeBrushSecondaryHighlightColor;
|
||||||
else
|
else
|
||||||
colorBrushID = kThemeBrushPrimaryHighlightColor;
|
colorBrushID = kThemeBrushPrimaryHighlightColor;
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
#include <QuickTime/QuickTimeComponents.h>
|
#include <QuickTime/QuickTimeComponents.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__DARWIN__) || !defined(__LP64__)
|
#if !defined(__LP64__)
|
||||||
#define USE_QUICKTIME 1
|
#define USE_QUICKTIME 1
|
||||||
#else
|
#else
|
||||||
#define USE_QUICKTIME 0
|
#define USE_QUICKTIME 0
|
||||||
|
@@ -469,9 +469,8 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu )
|
|||||||
// shown in the application menu anyhow -- it doesn't make
|
// shown in the application menu anyhow -- it doesn't make
|
||||||
// sense to show them in their normal place as well
|
// sense to show them in their normal place as well
|
||||||
if ( item->GetId() == wxApp::s_macAboutMenuItemId ||
|
if ( item->GetId() == wxApp::s_macAboutMenuItemId ||
|
||||||
( UMAGetSystemVersion() >= 0x1000 && (
|
|
||||||
item->GetId() == wxApp::s_macPreferencesMenuItemId ||
|
item->GetId() == wxApp::s_macPreferencesMenuItemId ||
|
||||||
item->GetId() == wxApp::s_macExitMenuItemId ) ) )
|
item->GetId() == wxApp::s_macExitMenuItemId )
|
||||||
|
|
||||||
{
|
{
|
||||||
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ),
|
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ),
|
||||||
@@ -749,7 +748,7 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
helpMenuHandle = NULL ;
|
helpMenuHandle = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
|
if ( wxApp::s_macPreferencesMenuItemId)
|
||||||
{
|
{
|
||||||
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
|
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
|
||||||
if ( item == NULL || !(item->IsEnabled()) )
|
if ( item == NULL || !(item->IsEnabled()) )
|
||||||
@@ -762,7 +761,7 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
// enabled unless it is added by the application and then disabled, otherwise
|
// enabled unless it is added by the application and then disabled, otherwise
|
||||||
// a program would be required to add an item with wxID_EXIT in order to get the
|
// a program would be required to add an item with wxID_EXIT in order to get the
|
||||||
// Quit menu item to be enabled, which seems a bit burdensome.
|
// Quit menu item to be enabled, which seems a bit burdensome.
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macExitMenuItemId)
|
if ( wxApp::s_macExitMenuItemId)
|
||||||
{
|
{
|
||||||
wxMenuItem *item = FindItem( wxApp::s_macExitMenuItemId , NULL ) ;
|
wxMenuItem *item = FindItem( wxApp::s_macExitMenuItemId , NULL ) ;
|
||||||
if ( item != NULL && !(item->IsEnabled()) )
|
if ( item != NULL && !(item->IsEnabled()) )
|
||||||
|
@@ -100,7 +100,7 @@ void wxMenuItem::UpdateItemStatus()
|
|||||||
if ( IsSeparator() )
|
if ( IsSeparator() )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
|
if ( GetId() == wxApp::s_macPreferencesMenuItemId)
|
||||||
{
|
{
|
||||||
if ( !IsEnabled() )
|
if ( !IsEnabled() )
|
||||||
DisableMenuCommand( NULL , kHICommandPreferences ) ;
|
DisableMenuCommand( NULL , kHICommandPreferences ) ;
|
||||||
@@ -108,7 +108,7 @@ void wxMenuItem::UpdateItemStatus()
|
|||||||
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macExitMenuItemId)
|
if ( GetId() == wxApp::s_macExitMenuItemId)
|
||||||
{
|
{
|
||||||
if ( !IsEnabled() )
|
if ( !IsEnabled() )
|
||||||
DisableMenuCommand( NULL , kHICommandQuit ) ;
|
DisableMenuCommand( NULL , kHICommandQuit ) ;
|
||||||
|
@@ -398,9 +398,8 @@ wxFileTypeImpl::GetPrintCommand(
|
|||||||
// we need to go straight to launch services
|
// we need to go straight to launch services
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(__DARWIN__)
|
|
||||||
|
|
||||||
//on darwin, use launch services
|
//on darwin, use launch services
|
||||||
|
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
||||||
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
|
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
|
||||||
@@ -457,74 +456,6 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else //carbon/classic implementation
|
|
||||||
|
|
||||||
|
|
||||||
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
|
|
||||||
{
|
|
||||||
wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
|
|
||||||
|
|
||||||
if (verb == wxT("open"))
|
|
||||||
{
|
|
||||||
ICMapEntry entry;
|
|
||||||
ICGetMapEntry( (ICInstance) m_manager->m_hIC,
|
|
||||||
(Handle) m_manager->m_hDatabase,
|
|
||||||
m_lIndex, &entry);
|
|
||||||
|
|
||||||
//The entry in the mimetype database only contains the app
|
|
||||||
//that's registered - it may not exist... we need to remap the creator
|
|
||||||
//type and find the right application
|
|
||||||
|
|
||||||
// THIS IS REALLY COMPLICATED :\.
|
|
||||||
// There are a lot of conversions going on here.
|
|
||||||
Str255 outName;
|
|
||||||
FSSpec outSpec;
|
|
||||||
OSErr err = FindApplication( entry.fileCreator, false, outName, &outSpec );
|
|
||||||
if (err != noErr)
|
|
||||||
return wxEmptyString;
|
|
||||||
|
|
||||||
Handle outPathHandle;
|
|
||||||
short outPathSize;
|
|
||||||
err = FSpGetFullPath( &outSpec, &outPathSize, &outPathHandle );
|
|
||||||
if (err == noErr)
|
|
||||||
{
|
|
||||||
char* szPath = *outPathHandle;
|
|
||||||
wxString sClassicPath(szPath, wxConvLocal, outPathSize);
|
|
||||||
|
|
||||||
#if defined(__DARWIN__)
|
|
||||||
// Classic Path --> Unix (OSX) Path
|
|
||||||
CFURLRef finalURL = CFURLCreateWithFileSystemPath(
|
|
||||||
kCFAllocatorDefault,
|
|
||||||
wxMacCFStringHolder(sClassicPath, wxLocale::GetSystemEncoding()),
|
|
||||||
kCFURLHFSPathStyle,
|
|
||||||
false ); //false == not a directory
|
|
||||||
|
|
||||||
//clean up memory from the classic path handle
|
|
||||||
DisposeHandle( outPathHandle );
|
|
||||||
|
|
||||||
if (finalURL)
|
|
||||||
{
|
|
||||||
CFStringRef cfsUnixPath = CFURLCopyFileSystemPath(finalURL, kCFURLPOSIXPathStyle);
|
|
||||||
CFRelease(finalURL);
|
|
||||||
|
|
||||||
// PHEW! Success!
|
|
||||||
if (cfsUnixPath)
|
|
||||||
return wxMacCFStringHolder(cfsUnixPath).AsString(wxLocale::GetSystemEncoding());
|
|
||||||
}
|
|
||||||
#else //classic HFS path acceptable
|
|
||||||
return sClassicPath;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxLogMimeDebug(wxT("FSpGetFullPath failed."), (OSStatus)err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxEmptyString;
|
|
||||||
}
|
|
||||||
#endif //!DARWIN
|
|
||||||
|
|
||||||
bool wxFileTypeImpl::GetDescription(wxString *desc) const
|
bool wxFileTypeImpl::GetDescription(wxString *desc) const
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
|
wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
|
||||||
@@ -1681,10 +1612,8 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
|
|||||||
wxLogDebug(wxT("No main bundle"));
|
wxLogDebug(wxT("No main bundle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__DARWIN__)
|
|
||||||
if (!bInfoSuccess)
|
if (!bInfoSuccess)
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
// on mac you have to embed it into the mac's file reference resource ('FREF' I believe)
|
// on mac you have to embed it into the mac's file reference resource ('FREF' I believe)
|
||||||
// or, alternately, you could just add an entry to m_hDatabase, but you'd need to get
|
// or, alternately, you could just add an entry to m_hDatabase, but you'd need to get
|
||||||
@@ -1991,10 +1920,8 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
|
|||||||
wxLogDebug(wxT("No main bundle"));
|
wxLogDebug(wxT("No main bundle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__DARWIN__)
|
|
||||||
if (!bInfoSuccess)
|
if (!bInfoSuccess)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
|
|
||||||
// this should be as easy as removing the entry from the database
|
// this should be as easy as removing the entry from the database
|
||||||
// and then saving the database
|
// and then saving the database
|
||||||
|
@@ -405,7 +405,7 @@ void wxNotebook::MacSetupTabs()
|
|||||||
info.name = cflabel ;
|
info.name = cflabel ;
|
||||||
m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;
|
m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;
|
||||||
|
|
||||||
if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
|
if ( GetImageList() && GetPageImage(ii) >= 0 )
|
||||||
{
|
{
|
||||||
const wxBitmap bmap = GetImageList()->GetBitmap( GetPageImage( ii ) ) ;
|
const wxBitmap bmap = GetImageList()->GetBitmap( GetPageImage( ii ) ) ;
|
||||||
if ( bmap.Ok() )
|
if ( bmap.Ok() )
|
||||||
|
@@ -509,8 +509,6 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 )
|
|
||||||
{
|
|
||||||
#if !wxMAC_USE_CORE_GRAPHICS
|
#if !wxMAC_USE_CORE_GRAPHICS
|
||||||
GrafPtr thePort ;
|
GrafPtr thePort ;
|
||||||
GetPort( &thePort ) ;
|
GetPort( &thePort ) ;
|
||||||
@@ -519,7 +517,6 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
#if !wxMAC_USE_CORE_GRAPHICS
|
#if !wxMAC_USE_CORE_GRAPHICS
|
||||||
SetPort( thePort ) ;
|
SetPort( thePort ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
dc->StartPage();
|
dc->StartPage();
|
||||||
keepGoing = printout->OnPrintPage(pn);
|
keepGoing = printout->OnPrintPage(pn);
|
||||||
dc->EndPage();
|
dc->EndPage();
|
||||||
|
@@ -71,7 +71,7 @@
|
|||||||
static wxTimer* lastSoundTimer=NULL;
|
static wxTimer* lastSoundTimer=NULL;
|
||||||
static bool lastSoundIsPlaying=false;
|
static bool lastSoundIsPlaying=false;
|
||||||
|
|
||||||
#if !defined(__DARWIN__) || !defined(__LP64__)
|
#if !defined(__LP64__)
|
||||||
#define USE_QUICKTIME 1
|
#define USE_QUICKTIME 1
|
||||||
#else
|
#else
|
||||||
#define USE_QUICKTIME 0
|
#define USE_QUICKTIME 0
|
||||||
|
@@ -1222,9 +1222,6 @@ void wxTopLevelWindowMac::DoMacCreateRealWindow(
|
|||||||
if ( HasFlag( wxCLOSE_BOX) )
|
if ( HasFlag( wxCLOSE_BOX) )
|
||||||
attr |= kWindowCloseBoxAttribute ;
|
attr |= kWindowCloseBoxAttribute ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn on live resizing (OS X only)
|
|
||||||
if (UMAGetSystemVersion() >= 0x1000)
|
|
||||||
attr |= kWindowLiveResizeAttribute;
|
attr |= kWindowLiveResizeAttribute;
|
||||||
|
|
||||||
if ( HasFlag(wxSTAY_ON_TOP) )
|
if ( HasFlag(wxSTAY_ON_TOP) )
|
||||||
@@ -1399,11 +1396,9 @@ bool wxTopLevelWindowMac::Show(bool show)
|
|||||||
if ( !wxTopLevelWindowBase::Show(show) )
|
if ( !wxTopLevelWindowBase::Show(show) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool plainTransition = false;
|
bool plainTransition = true;
|
||||||
|
|
||||||
#if wxUSE_SYSTEM_OPTIONS
|
#if wxUSE_SYSTEM_OPTIONS
|
||||||
// code contributed by Ryan Wilcox December 18, 2003
|
|
||||||
plainTransition = UMAGetSystemVersion() >= 0x1000 ;
|
|
||||||
if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) )
|
if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) )
|
||||||
plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ;
|
plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
#include "wx/mac/private.h"
|
#include "wx/mac/private.h"
|
||||||
|
|
||||||
#if defined(__MWERKS__) && wxUSE_UNICODE
|
#if defined(__MWERKS__) && wxUSE_UNICODE
|
||||||
#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
|
#if __MWERKS__ < 0x4100
|
||||||
#include <wtime.h>
|
#include <wtime.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -91,281 +91,12 @@ wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// debugging support
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if defined(__WXDEBUG__) && defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400)
|
|
||||||
|
|
||||||
// MetroNub stuff doesn't seem to work in CodeWarrior 5.3 Carbon builds...
|
|
||||||
|
|
||||||
#ifndef __MetroNubUtils__
|
|
||||||
#include "MetroNubUtils.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __GESTALT__
|
|
||||||
#include <Gestalt.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TARGET_API_MAC_CARBON
|
|
||||||
|
|
||||||
#include <CodeFragments.h>
|
|
||||||
|
|
||||||
extern "C" long CallUniversalProc(UniversalProcPtr theProcPtr, ProcInfoType procInfo, ...);
|
|
||||||
|
|
||||||
ProcPtr gCallUniversalProc_Proc = NULL;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static MetroNubUserEntryBlock* gMetroNubEntry = NULL;
|
|
||||||
|
|
||||||
static long fRunOnce = false;
|
|
||||||
|
|
||||||
|
|
||||||
Boolean IsMetroNubInstalled()
|
|
||||||
{
|
|
||||||
if (!fRunOnce)
|
|
||||||
{
|
|
||||||
long result, value;
|
|
||||||
|
|
||||||
fRunOnce = true;
|
|
||||||
gMetroNubEntry = NULL;
|
|
||||||
|
|
||||||
if (Gestalt(gestaltSystemVersion, &value) == noErr && value < 0x1000)
|
|
||||||
{
|
|
||||||
// look for MetroNub's Gestalt selector
|
|
||||||
if (Gestalt(kMetroNubUserSignature, &result) == noErr)
|
|
||||||
{
|
|
||||||
#if TARGET_API_MAC_CARBON
|
|
||||||
if (gCallUniversalProc_Proc == NULL)
|
|
||||||
{
|
|
||||||
CFragConnectionID connectionID;
|
|
||||||
Ptr mainAddress;
|
|
||||||
Str255 errorString;
|
|
||||||
ProcPtr symbolAddress;
|
|
||||||
OSErr err;
|
|
||||||
CFragSymbolClass symbolClass;
|
|
||||||
|
|
||||||
symbolAddress = NULL;
|
|
||||||
err = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kFindCFrag,
|
|
||||||
&connectionID, &mainAddress, errorString);
|
|
||||||
|
|
||||||
if (err != noErr)
|
|
||||||
{
|
|
||||||
gCallUniversalProc_Proc = NULL;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = FindSymbol(connectionID, "\pCallUniversalProc",
|
|
||||||
(Ptr *) &gCallUniversalProc_Proc, &symbolClass);
|
|
||||||
|
|
||||||
if (err != noErr)
|
|
||||||
{
|
|
||||||
gCallUniversalProc_Proc = NULL;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
|
||||||
MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
|
|
||||||
|
|
||||||
// make sure the version of the API is compatible
|
|
||||||
if (block->apiLowVersion <= kMetroNubUserAPIVersion &&
|
|
||||||
kMetroNubUserAPIVersion <= block->apiHiVersion)
|
|
||||||
{
|
|
||||||
// success!
|
|
||||||
gMetroNubEntry = block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
|
||||||
|
|
||||||
#if TARGET_API_MAC_CARBON
|
|
||||||
return (gMetroNubEntry != NULL && gCallUniversalProc_Proc != NULL);
|
|
||||||
#else
|
|
||||||
return (gMetroNubEntry != NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean IsMWDebuggerRunning()
|
|
||||||
{
|
|
||||||
if (IsMetroNubInstalled())
|
|
||||||
return CallIsDebuggerRunningProc(gMetroNubEntry->isDebuggerRunning);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean AmIBeingMWDebugged()
|
|
||||||
{
|
|
||||||
if (IsMetroNubInstalled())
|
|
||||||
return CallAmIBeingDebuggedProc(gMetroNubEntry->amIBeingDebugged);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern bool WXDLLEXPORT wxIsDebuggerRunning()
|
|
||||||
{
|
|
||||||
return IsMWDebuggerRunning() && AmIBeingMWDebugged();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
extern bool WXDLLEXPORT wxIsDebuggerRunning()
|
extern bool WXDLLEXPORT wxIsDebuggerRunning()
|
||||||
{
|
{
|
||||||
|
// TODO : try to find out ...
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ >= 0x2400)
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
// defined in unix/utilsunx.cpp for Mac OS X
|
|
||||||
|
|
||||||
// get full hostname (with domain name if possible)
|
|
||||||
bool wxGetFullHostName(wxChar *buf, int maxSize)
|
|
||||||
{
|
|
||||||
return wxGetHostName(buf, maxSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get user ID e.g. jacs
|
|
||||||
bool wxGetUserId(wxChar *buf, int maxSize)
|
|
||||||
{
|
|
||||||
return wxGetUserName( buf , maxSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
const wxChar* wxGetHomeDir(wxString *pstr)
|
|
||||||
{
|
|
||||||
*pstr = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder );
|
|
||||||
return pstr->c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get hostname only (without domain name)
|
|
||||||
bool wxGetHostName(wxChar *buf, int maxSize)
|
|
||||||
{
|
|
||||||
// Gets Chooser name of user by examining a System resource.
|
|
||||||
buf[0] = 0;
|
|
||||||
|
|
||||||
const short kComputerNameID = -16413;
|
|
||||||
|
|
||||||
short oldResFile = CurResFile();
|
|
||||||
UseResFile(0);
|
|
||||||
StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
|
|
||||||
UseResFile(oldResFile);
|
|
||||||
|
|
||||||
if (chooserName && *chooserName)
|
|
||||||
{
|
|
||||||
HLock( (Handle) chooserName );
|
|
||||||
wxString name = wxMacMakeStringFromPascal( *chooserName );
|
|
||||||
HUnlock( (Handle) chooserName );
|
|
||||||
ReleaseResource( (Handle) chooserName );
|
|
||||||
wxStrncpy( buf , name , maxSize - 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get user name e.g. Stefan Csomor
|
|
||||||
bool wxGetUserName(wxChar *buf, int maxSize)
|
|
||||||
{
|
|
||||||
// Gets Chooser name of user by examining a System resource.
|
|
||||||
buf[0] = 0;
|
|
||||||
|
|
||||||
const short kChooserNameID = -16096;
|
|
||||||
|
|
||||||
short oldResFile = CurResFile();
|
|
||||||
UseResFile(0);
|
|
||||||
StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
|
|
||||||
UseResFile(oldResFile);
|
|
||||||
|
|
||||||
if (chooserName && *chooserName)
|
|
||||||
{
|
|
||||||
HLock( (Handle) chooserName );
|
|
||||||
wxString name = wxMacMakeStringFromPascal( *chooserName );
|
|
||||||
HUnlock( (Handle) chooserName );
|
|
||||||
ReleaseResource( (Handle) chooserName );
|
|
||||||
wxStrncpy( buf , name , maxSize - 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
|
|
||||||
{
|
|
||||||
// TODO : under classic there is no environement support, under X yes
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the env var name to the given value, return true on success
|
|
||||||
WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxString& value)
|
|
||||||
{
|
|
||||||
// TODO : under classic there is no environement support, under X yes
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WXDLLEXPORT bool wxUnsetEnv(const wxString& var)
|
|
||||||
{
|
|
||||||
// TODO : under classic there is no environement support, under X yes
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute a program in an Interactive Shell
|
|
||||||
bool wxShell(const wxString& command)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shutdown or reboot the PC
|
|
||||||
bool wxShutdown(wxShutdownFlags wFlags)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
|
|
||||||
wxMemorySize wxGetFreeMemory()
|
|
||||||
{
|
|
||||||
return (wxMemorySize)FreeMem();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
|
|
||||||
void wxMicroSleep(unsigned long microseconds)
|
|
||||||
{
|
|
||||||
AbsoluteTime wakeup = AddDurationToAbsolute( microseconds * durationMicrosecond , UpTime());
|
|
||||||
MPDelayUntil( & wakeup);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMilliSleep(unsigned long milliseconds)
|
|
||||||
{
|
|
||||||
AbsoluteTime wakeup = AddDurationToAbsolute( milliseconds, UpTime());
|
|
||||||
MPDelayUntil( & wakeup);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSleep(int nSecs)
|
|
||||||
{
|
|
||||||
wxMilliSleep(1000*nSecs);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Consume all events until no more left
|
|
||||||
void wxFlushEvents()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // !__DARWIN__
|
|
||||||
|
|
||||||
// Emit a beeeeeep
|
// Emit a beeeeeep
|
||||||
void wxBell()
|
void wxBell()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user