/////////////////////////////////////////////////////////////////////////////
#include "wx/defs.h"
+
+#if wxUSE_GUI
+
#include "wx/dc.h"
#include <MacTextEditor.h>
#endif
#include "wx/mac/uma.h"
+
// since we have decided that we only support 8.6 upwards we are
// checking for these minimum requirements in the startup code of
// the application so all wxWindows code can safely assume that appearance 1.1
static long sUMAAppearanceVersion = 0 ;
static long sUMASystemVersion = 0 ;
static bool sUMAHasAquaLayout = false ;
-static bool sUMASystemInitialized = false ;
+
+static bool sUMAHasInittedAppearance = false;
extern int gAGABackgroundColor ;
bool UMAHasAppearance() { return sUMAHasAppearance ; }
bool UMAHasWindowManager() { return sUMAHasWindowManager ; }
long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr ; }
bool UMAHasAquaLayout() { return sUMAHasAquaLayout ; }
-bool UMASystemIsInitialized() { return sUMASystemInitialized ; }
+
void UMACleanupToolbox()
{
- if ( sUMAHasAppearance )
+ if (sUMAHasInittedAppearance)
{
UnregisterAppearanceClient() ;
}
if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress )
TXNTerminateTextension( ) ;
}
-void UMAInitToolbox( UInt16 inMoreMastersCalls )
+void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded )
{
#if !TARGET_CARBON
::MaxApplZone();
for (long i = 1; i <= inMoreMastersCalls; i++)
::MoreMasters();
- ::InitGraf(&qd.thePort);
- ::InitFonts();
- ::InitMenus();
- ::TEInit();
- ::InitDialogs(0L);
- ::FlushEvents(everyEvent, 0);
- ::InitCursor();
+ if (!isEmbedded)
+ {
+ ::InitGraf(&qd.thePort);
+ ::InitFonts();
+ ::InitMenus();
+ ::TEInit();
+ ::InitDialogs(0L);
+ ::FlushEvents(everyEvent, 0);
+ }
+
long total,contig;
PurgeSpace(&total, &contig);
-#else
- InitCursor();
#endif
+ ::InitCursor();
+
if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
sUMASystemVersion = 0x0000 ;
if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
{
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 )
{
sUMAAppearanceVersion = theAppearance ;
#if TARGET_CARBON
// Call currently implicitely done : InitFloatingWindows() ;
#else
- if ( sUMAHasWindowManager )
- InitFloatingWindows() ;
- else
- InitWindows();
+ if (!isEmbedded)
+ {
+ if ( sUMAHasWindowManager )
+ InitFloatingWindows() ;
+ else
+ InitWindows();
+ }
#endif
if ( NavServicesAvailable() )
TXNMacOSPreferredFontDescription fontDescriptions[] =
{
- { fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } ,
+ { fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding }
} ;
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
#if 0 // TARGET_CARBON
}
- sUMASystemInitialized = true ;
+ UMASetSystemIsInitialized(true);
}
// for some reasons this must be 0 right now
// everything else leads to just the first function key item
// to be selected. Thanks to Ryan Wilcox for finding out.
- macKey = 0 ;
+ macKey = 0 ;
glyph = kMenuF1Glyph + ( key - WXK_F1 ) ;
if ( key >= WXK_F13 )
glyph += 13 ;
return err ;
}
+#endif // wxUSE_GUI
+
+#if wxUSE_BASE
+
+static bool sUMASystemInitialized = false ;
+
+bool UMASystemIsInitialized()
+{
+ return sUMASystemInitialized ;
+}
+
+void UMASetSystemIsInitialized(bool val)
+{
+ sUMASystemInitialized = val;
+}
+
+
+#endif // wxUSE_BASE