Applied patch #809019 (Adds embedded/plugin capabilities to wxMac).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24651 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -80,6 +80,7 @@ protected:
|
|||||||
// where overriden
|
// where overriden
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static bool sm_isEmbedded;
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual bool Initialize(int& argc, wxChar **argv);
|
virtual bool Initialize(int& argc, wxChar **argv);
|
||||||
virtual void CleanUp();
|
virtual void CleanUp();
|
||||||
@@ -142,6 +143,10 @@ public:
|
|||||||
void MacDoOneEvent() ;
|
void MacDoOneEvent() ;
|
||||||
WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
|
WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
|
||||||
void MacHandleOneEvent( WXEVENTREF ev ) ;
|
void MacHandleOneEvent( WXEVENTREF ev ) ;
|
||||||
|
|
||||||
|
// For embedded use. By default does nothing.
|
||||||
|
virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
virtual void MacHandleMenuSelect( int menuid , int menuitem ) ;
|
virtual void MacHandleMenuSelect( int menuid , int menuitem ) ;
|
||||||
virtual void MacHandleMouseUpEvent( WXEVENTREF ev ) ;
|
virtual void MacHandleMouseUpEvent( WXEVENTREF ev ) ;
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "wx/mac/private.h"
|
#include "wx/mac/private.h"
|
||||||
|
|
||||||
void UMAInitToolbox( UInt16 inMoreMastersCalls) ;
|
void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded) ;
|
||||||
void UMACleanupToolbox() ;
|
void UMACleanupToolbox() ;
|
||||||
long UMAGetSystemVersion() ;
|
long UMAGetSystemVersion() ;
|
||||||
bool UMAHasAppearance() ;
|
bool UMAHasAppearance() ;
|
||||||
|
@@ -110,6 +110,8 @@ long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
|
|||||||
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
||||||
wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
||||||
|
|
||||||
|
// Normally we're not a plugin
|
||||||
|
bool wxApp::sm_isEmbedded = false;
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Core Apple Event Support
|
// Core Apple Event Support
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -521,7 +523,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
|
|
||||||
// Mac-specific
|
// Mac-specific
|
||||||
|
|
||||||
UMAInitToolbox( 4 ) ;
|
UMAInitToolbox( 4, sm_isEmbedded ) ;
|
||||||
SetEventMask( everyEvent ) ;
|
SetEventMask( everyEvent ) ;
|
||||||
UMAShowWatchCursor() ;
|
UMAShowWatchCursor() ;
|
||||||
|
|
||||||
@@ -638,38 +640,44 @@ bool wxApp::OnInitGui()
|
|||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
||||||
|
|
||||||
InstallApplicationEventHandler(
|
if (!sm_isEmbedded)
|
||||||
GetwxAppEventHandlerUPP(),
|
{
|
||||||
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
|
InstallApplicationEventHandler(
|
||||||
|
GetwxAppEventHandlerUPP(),
|
||||||
|
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!sm_isEmbedded)
|
||||||
|
{
|
||||||
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
||||||
NewAEEventHandlerUPP(AEHandleODoc) ,
|
NewAEEventHandlerUPP(AEHandleODoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
||||||
NewAEEventHandlerUPP(AEHandleOApp) ,
|
NewAEEventHandlerUPP(AEHandleOApp) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
||||||
NewAEEventHandlerUPP(AEHandlePDoc) ,
|
NewAEEventHandlerUPP(AEHandlePDoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||||
NewAEEventHandlerUPP(AEHandleQuit) ,
|
NewAEEventHandlerUPP(AEHandleQuit) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
#else
|
#else
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
||||||
NewAEEventHandlerProc(AEHandleODoc) ,
|
NewAEEventHandlerProc(AEHandleODoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
||||||
NewAEEventHandlerProc(AEHandleOApp) ,
|
NewAEEventHandlerProc(AEHandleOApp) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
||||||
NewAEEventHandlerProc(AEHandlePDoc) ,
|
NewAEEventHandlerProc(AEHandlePDoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||||
NewAEEventHandlerProc(AEHandleQuit) ,
|
NewAEEventHandlerProc(AEHandleQuit) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -1274,7 +1282,7 @@ void wxApp::MacDoOneEvent()
|
|||||||
::IdleControls( window ) ;
|
::IdleControls( window ) ;
|
||||||
|
|
||||||
if ( wxTheApp->ProcessIdle() )
|
if ( wxTheApp->ProcessIdle() )
|
||||||
sleepTime = 0 ;
|
sleepTime = kEventDurationNoWait;
|
||||||
else
|
else
|
||||||
sleepTime = GetCaretTime() / 2 ;
|
sleepTime = GetCaretTime() / 2 ;
|
||||||
}
|
}
|
||||||
@@ -1287,13 +1295,22 @@ void wxApp::MacDoOneEvent()
|
|||||||
wxMacProcessNotifierAndPendingEvents() ;
|
wxMacProcessNotifierAndPendingEvents() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*virtual*/ void wxApp::MacHandleUnhandledEvent( WXEVENTREF evr )
|
||||||
|
{
|
||||||
|
// Override to process unhandled events as you please
|
||||||
|
}
|
||||||
|
|
||||||
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventTargetRef theTarget;
|
EventTargetRef theTarget;
|
||||||
theTarget = GetEventDispatcherTarget();
|
theTarget = GetEventDispatcherTarget();
|
||||||
m_macCurrentEvent = evr ;
|
m_macCurrentEvent = evr ;
|
||||||
SendEventToEventTarget ((EventRef) evr , theTarget);
|
OSStatus status = SendEventToEventTarget ((EventRef) evr , theTarget);
|
||||||
|
if(status == eventNotHandledErr)
|
||||||
|
{
|
||||||
|
MacHandleUnhandledEvent(evr);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
EventRecord* ev = (EventRecord*) evr ;
|
EventRecord* ev = (EventRecord*) evr ;
|
||||||
m_macCurrentEvent = ev ;
|
m_macCurrentEvent = ev ;
|
||||||
@@ -1325,6 +1342,10 @@ void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
|||||||
MacHandleActivateEvent( ev ) ;
|
MacHandleActivateEvent( ev ) ;
|
||||||
break;
|
break;
|
||||||
case updateEvt:
|
case updateEvt:
|
||||||
|
// In embedded mode we first let the UnhandledEvent function
|
||||||
|
// try to handle the update event. If we handle it ourselves
|
||||||
|
// first and then pass it on, the host's windows won't update.
|
||||||
|
MacHandleUnhandledEvent(ev);
|
||||||
MacHandleUpdateEvent( ev ) ;
|
MacHandleUpdateEvent( ev ) ;
|
||||||
break;
|
break;
|
||||||
case keyDown:
|
case keyDown:
|
||||||
|
@@ -110,6 +110,8 @@ long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
|
|||||||
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
|
||||||
wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
||||||
|
|
||||||
|
// Normally we're not a plugin
|
||||||
|
bool wxApp::sm_isEmbedded = false;
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Core Apple Event Support
|
// Core Apple Event Support
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -521,7 +523,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
|
|
||||||
// Mac-specific
|
// Mac-specific
|
||||||
|
|
||||||
UMAInitToolbox( 4 ) ;
|
UMAInitToolbox( 4, sm_isEmbedded ) ;
|
||||||
SetEventMask( everyEvent ) ;
|
SetEventMask( everyEvent ) ;
|
||||||
UMAShowWatchCursor() ;
|
UMAShowWatchCursor() ;
|
||||||
|
|
||||||
@@ -638,38 +640,44 @@ bool wxApp::OnInitGui()
|
|||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
||||||
|
|
||||||
InstallApplicationEventHandler(
|
if (!sm_isEmbedded)
|
||||||
GetwxAppEventHandlerUPP(),
|
{
|
||||||
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
|
InstallApplicationEventHandler(
|
||||||
|
GetwxAppEventHandlerUPP(),
|
||||||
|
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!sm_isEmbedded)
|
||||||
|
{
|
||||||
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
||||||
NewAEEventHandlerUPP(AEHandleODoc) ,
|
NewAEEventHandlerUPP(AEHandleODoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
||||||
NewAEEventHandlerUPP(AEHandleOApp) ,
|
NewAEEventHandlerUPP(AEHandleOApp) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
||||||
NewAEEventHandlerUPP(AEHandlePDoc) ,
|
NewAEEventHandlerUPP(AEHandlePDoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||||
NewAEEventHandlerUPP(AEHandleQuit) ,
|
NewAEEventHandlerUPP(AEHandleQuit) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
#else
|
#else
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
|
||||||
NewAEEventHandlerProc(AEHandleODoc) ,
|
NewAEEventHandlerProc(AEHandleODoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
|
||||||
NewAEEventHandlerProc(AEHandleOApp) ,
|
NewAEEventHandlerProc(AEHandleOApp) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
|
||||||
NewAEEventHandlerProc(AEHandlePDoc) ,
|
NewAEEventHandlerProc(AEHandlePDoc) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||||
NewAEEventHandlerProc(AEHandleQuit) ,
|
NewAEEventHandlerProc(AEHandleQuit) ,
|
||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -1274,7 +1282,7 @@ void wxApp::MacDoOneEvent()
|
|||||||
::IdleControls( window ) ;
|
::IdleControls( window ) ;
|
||||||
|
|
||||||
if ( wxTheApp->ProcessIdle() )
|
if ( wxTheApp->ProcessIdle() )
|
||||||
sleepTime = 0 ;
|
sleepTime = kEventDurationNoWait;
|
||||||
else
|
else
|
||||||
sleepTime = GetCaretTime() / 2 ;
|
sleepTime = GetCaretTime() / 2 ;
|
||||||
}
|
}
|
||||||
@@ -1287,13 +1295,22 @@ void wxApp::MacDoOneEvent()
|
|||||||
wxMacProcessNotifierAndPendingEvents() ;
|
wxMacProcessNotifierAndPendingEvents() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*virtual*/ void wxApp::MacHandleUnhandledEvent( WXEVENTREF evr )
|
||||||
|
{
|
||||||
|
// Override to process unhandled events as you please
|
||||||
|
}
|
||||||
|
|
||||||
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventTargetRef theTarget;
|
EventTargetRef theTarget;
|
||||||
theTarget = GetEventDispatcherTarget();
|
theTarget = GetEventDispatcherTarget();
|
||||||
m_macCurrentEvent = evr ;
|
m_macCurrentEvent = evr ;
|
||||||
SendEventToEventTarget ((EventRef) evr , theTarget);
|
OSStatus status = SendEventToEventTarget ((EventRef) evr , theTarget);
|
||||||
|
if(status == eventNotHandledErr)
|
||||||
|
{
|
||||||
|
MacHandleUnhandledEvent(evr);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
EventRecord* ev = (EventRecord*) evr ;
|
EventRecord* ev = (EventRecord*) evr ;
|
||||||
m_macCurrentEvent = ev ;
|
m_macCurrentEvent = ev ;
|
||||||
@@ -1325,6 +1342,10 @@ void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
|||||||
MacHandleActivateEvent( ev ) ;
|
MacHandleActivateEvent( ev ) ;
|
||||||
break;
|
break;
|
||||||
case updateEvt:
|
case updateEvt:
|
||||||
|
// In embedded mode we first let the UnhandledEvent function
|
||||||
|
// try to handle the update event. If we handle it ourselves
|
||||||
|
// first and then pass it on, the host's windows won't update.
|
||||||
|
MacHandleUnhandledEvent(ev);
|
||||||
MacHandleUpdateEvent( ev ) ;
|
MacHandleUpdateEvent( ev ) ;
|
||||||
break;
|
break;
|
||||||
case keyDown:
|
case keyDown:
|
||||||
|
@@ -45,6 +45,8 @@ static long sUMAAppearanceVersion = 0 ;
|
|||||||
static long sUMASystemVersion = 0 ;
|
static long sUMASystemVersion = 0 ;
|
||||||
static bool sUMAHasAquaLayout = false ;
|
static bool sUMAHasAquaLayout = false ;
|
||||||
|
|
||||||
|
static bool sUMAHasInittedAppearance = false;
|
||||||
|
|
||||||
extern int gAGABackgroundColor ;
|
extern int gAGABackgroundColor ;
|
||||||
bool UMAHasAppearance() { return sUMAHasAppearance ; }
|
bool UMAHasAppearance() { return sUMAHasAppearance ; }
|
||||||
long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; }
|
long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; }
|
||||||
@@ -60,7 +62,7 @@ bool UMAHasAquaLayout() { return sUMAHasAquaLayout ; }
|
|||||||
|
|
||||||
void UMACleanupToolbox()
|
void UMACleanupToolbox()
|
||||||
{
|
{
|
||||||
if ( sUMAHasAppearance )
|
if (sUMAHasInittedAppearance)
|
||||||
{
|
{
|
||||||
UnregisterAppearanceClient() ;
|
UnregisterAppearanceClient() ;
|
||||||
}
|
}
|
||||||
@@ -71,26 +73,29 @@ void UMACleanupToolbox()
|
|||||||
if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress )
|
if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress )
|
||||||
TXNTerminateTextension( ) ;
|
TXNTerminateTextension( ) ;
|
||||||
}
|
}
|
||||||
void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded )
|
||||||
{
|
{
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
::MaxApplZone();
|
::MaxApplZone();
|
||||||
for (long i = 1; i <= inMoreMastersCalls; i++)
|
for (long i = 1; i <= inMoreMastersCalls; i++)
|
||||||
::MoreMasters();
|
::MoreMasters();
|
||||||
|
|
||||||
::InitGraf(&qd.thePort);
|
if (!isEmbedded)
|
||||||
::InitFonts();
|
{
|
||||||
::InitMenus();
|
::InitGraf(&qd.thePort);
|
||||||
::TEInit();
|
::InitFonts();
|
||||||
::InitDialogs(0L);
|
::InitMenus();
|
||||||
::FlushEvents(everyEvent, 0);
|
::TEInit();
|
||||||
::InitCursor();
|
::InitDialogs(0L);
|
||||||
|
::FlushEvents(everyEvent, 0);
|
||||||
|
}
|
||||||
|
|
||||||
long total,contig;
|
long total,contig;
|
||||||
PurgeSpace(&total, &contig);
|
PurgeSpace(&total, &contig);
|
||||||
#else
|
|
||||||
InitCursor();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
::InitCursor();
|
||||||
|
|
||||||
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
||||||
sUMASystemVersion = 0x0000 ;
|
sUMASystemVersion = 0x0000 ;
|
||||||
|
|
||||||
@@ -98,7 +103,17 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
||||||
{
|
{
|
||||||
sUMAHasAppearance = true ;
|
sUMAHasAppearance = true ;
|
||||||
RegisterAppearanceClient();
|
OSStatus status = RegisterAppearanceClient();
|
||||||
|
// If status equals appearanceProcessRegisteredErr it means the
|
||||||
|
// appearance client already was registered (For example if we run
|
||||||
|
// embedded, the host might have registered it). In such a case
|
||||||
|
// we don't unregister it later on.
|
||||||
|
if (status != appearanceProcessRegisteredErr)
|
||||||
|
{
|
||||||
|
// Appearance client wasn't registered yet.
|
||||||
|
sUMAHasInittedAppearance = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
|
if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
|
||||||
{
|
{
|
||||||
sUMAAppearanceVersion = theAppearance ;
|
sUMAAppearanceVersion = theAppearance ;
|
||||||
@@ -116,10 +131,13 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
// Call currently implicitely done : InitFloatingWindows() ;
|
// Call currently implicitely done : InitFloatingWindows() ;
|
||||||
#else
|
#else
|
||||||
if ( sUMAHasWindowManager )
|
if (!isEmbedded)
|
||||||
InitFloatingWindows() ;
|
{
|
||||||
else
|
if ( sUMAHasWindowManager )
|
||||||
InitWindows();
|
InitFloatingWindows() ;
|
||||||
|
else
|
||||||
|
InitWindows();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( NavServicesAvailable() )
|
if ( NavServicesAvailable() )
|
||||||
@@ -143,7 +161,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
|
|
||||||
TXNMacOSPreferredFontDescription fontDescriptions[] =
|
TXNMacOSPreferredFontDescription fontDescriptions[] =
|
||||||
{
|
{
|
||||||
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } ,
|
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding }
|
||||||
} ;
|
} ;
|
||||||
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
||||||
#if 0 // TARGET_CARBON
|
#if 0 // TARGET_CARBON
|
||||||
|
@@ -45,6 +45,8 @@ static long sUMAAppearanceVersion = 0 ;
|
|||||||
static long sUMASystemVersion = 0 ;
|
static long sUMASystemVersion = 0 ;
|
||||||
static bool sUMAHasAquaLayout = false ;
|
static bool sUMAHasAquaLayout = false ;
|
||||||
|
|
||||||
|
static bool sUMAHasInittedAppearance = false;
|
||||||
|
|
||||||
extern int gAGABackgroundColor ;
|
extern int gAGABackgroundColor ;
|
||||||
bool UMAHasAppearance() { return sUMAHasAppearance ; }
|
bool UMAHasAppearance() { return sUMAHasAppearance ; }
|
||||||
long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; }
|
long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; }
|
||||||
@@ -60,7 +62,7 @@ bool UMAHasAquaLayout() { return sUMAHasAquaLayout ; }
|
|||||||
|
|
||||||
void UMACleanupToolbox()
|
void UMACleanupToolbox()
|
||||||
{
|
{
|
||||||
if ( sUMAHasAppearance )
|
if (sUMAHasInittedAppearance)
|
||||||
{
|
{
|
||||||
UnregisterAppearanceClient() ;
|
UnregisterAppearanceClient() ;
|
||||||
}
|
}
|
||||||
@@ -71,26 +73,29 @@ void UMACleanupToolbox()
|
|||||||
if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress )
|
if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress )
|
||||||
TXNTerminateTextension( ) ;
|
TXNTerminateTextension( ) ;
|
||||||
}
|
}
|
||||||
void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded )
|
||||||
{
|
{
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
::MaxApplZone();
|
::MaxApplZone();
|
||||||
for (long i = 1; i <= inMoreMastersCalls; i++)
|
for (long i = 1; i <= inMoreMastersCalls; i++)
|
||||||
::MoreMasters();
|
::MoreMasters();
|
||||||
|
|
||||||
::InitGraf(&qd.thePort);
|
if (!isEmbedded)
|
||||||
::InitFonts();
|
{
|
||||||
::InitMenus();
|
::InitGraf(&qd.thePort);
|
||||||
::TEInit();
|
::InitFonts();
|
||||||
::InitDialogs(0L);
|
::InitMenus();
|
||||||
::FlushEvents(everyEvent, 0);
|
::TEInit();
|
||||||
::InitCursor();
|
::InitDialogs(0L);
|
||||||
|
::FlushEvents(everyEvent, 0);
|
||||||
|
}
|
||||||
|
|
||||||
long total,contig;
|
long total,contig;
|
||||||
PurgeSpace(&total, &contig);
|
PurgeSpace(&total, &contig);
|
||||||
#else
|
|
||||||
InitCursor();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
::InitCursor();
|
||||||
|
|
||||||
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
|
||||||
sUMASystemVersion = 0x0000 ;
|
sUMASystemVersion = 0x0000 ;
|
||||||
|
|
||||||
@@ -98,7 +103,17 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
|
||||||
{
|
{
|
||||||
sUMAHasAppearance = true ;
|
sUMAHasAppearance = true ;
|
||||||
RegisterAppearanceClient();
|
OSStatus status = RegisterAppearanceClient();
|
||||||
|
// If status equals appearanceProcessRegisteredErr it means the
|
||||||
|
// appearance client already was registered (For example if we run
|
||||||
|
// embedded, the host might have registered it). In such a case
|
||||||
|
// we don't unregister it later on.
|
||||||
|
if (status != appearanceProcessRegisteredErr)
|
||||||
|
{
|
||||||
|
// Appearance client wasn't registered yet.
|
||||||
|
sUMAHasInittedAppearance = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
|
if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
|
||||||
{
|
{
|
||||||
sUMAAppearanceVersion = theAppearance ;
|
sUMAAppearanceVersion = theAppearance ;
|
||||||
@@ -116,10 +131,13 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
// Call currently implicitely done : InitFloatingWindows() ;
|
// Call currently implicitely done : InitFloatingWindows() ;
|
||||||
#else
|
#else
|
||||||
if ( sUMAHasWindowManager )
|
if (!isEmbedded)
|
||||||
InitFloatingWindows() ;
|
{
|
||||||
else
|
if ( sUMAHasWindowManager )
|
||||||
InitWindows();
|
InitFloatingWindows() ;
|
||||||
|
else
|
||||||
|
InitWindows();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( NavServicesAvailable() )
|
if ( NavServicesAvailable() )
|
||||||
@@ -143,7 +161,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
|
|||||||
|
|
||||||
TXNMacOSPreferredFontDescription fontDescriptions[] =
|
TXNMacOSPreferredFontDescription fontDescriptions[] =
|
||||||
{
|
{
|
||||||
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } ,
|
{ fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding }
|
||||||
} ;
|
} ;
|
||||||
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
|
||||||
#if 0 // TARGET_CARBON
|
#if 0 // TARGET_CARBON
|
||||||
|
Reference in New Issue
Block a user