-#include <wx/mac/uma.h>
-#include <wx/mac/aga.h>
+#include "wx/defs.h"
+#include "wx/mac/uma.h"
+#include "wx/mac/aga.h"
+
+#ifdef __UNIX__
+ #include <NavigationServices/Navigation.h>
+#else
+ #include <Navigation.h>
+#endif
// init
bool UMAHasWindowManager() { return sUMAHasWindowManager ; }
long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr ; }
-
+void UMACleanupToolbox()
+{
+#if UMA_USE_APPEARANCE
+ if ( sUMAHasAppearance )
+ {
+ UnregisterAppearanceClient() ;
+ }
+#endif
+ if ( NavServicesAvailable() )
+ {
+ NavUnload() ;
+ }
+}
void UMAInitToolbox( UInt16 inMoreMastersCalls )
{
#if !TARGET_CARBON
::InitGraf(&qd.thePort);
::InitFonts();
- ::InitWindows();
::InitMenus();
::TEInit();
::InitDialogs(0L);
}
#endif // UMA_USE_WINDOWMGR
#endif
+
+#ifndef __UNIX__
+#if TARGET_CARBON
+// Call currently implicitely done : InitFloatingWindows() ;
+#else
+ if ( sUMAHasWindowManager )
+ InitFloatingWindows() ;
+ else
+ InitWindows();
+#endif
+#endif
+
+ if ( NavServicesAvailable() )
+ {
+ NavLoad() ;
+ }
}
// process manager
int gPrOpenCounter = 0 ;
-void UMAPrOpen()
+OSStatus UMAPrOpen()
{
#if !TARGET_CARBON
OSErr err = noErr ;
err = PrError() ;
wxASSERT( err == noErr ) ;
}
+ return err ;
#else
- #pragma warning "TODO Printing for Carbon"
+ OSStatus err = noErr ;
+ ++gPrOpenCounter ;
+ if ( gPrOpenCounter == 1 )
+ {
+ err = PMBegin() ;
+ wxASSERT( err == noErr ) ;
+ }
+ return err ;
#endif
}
-void UMAPrClose()
+OSStatus UMAPrClose()
{
#if !TARGET_CARBON
OSErr err = noErr ;
wxASSERT( err == noErr ) ;
}
--gPrOpenCounter ;
+ return err ;
#else
- #pragma warning "TODO Printing for Carbon"
+ OSStatus err = noErr ;
+ wxASSERT( gPrOpenCounter >= 1 ) ;
+ if ( gPrOpenCounter == 1 )
+ {
+ err = PMEnd() ;
+ }
+ --gPrOpenCounter ;
+ return err ;
#endif
}
Str255 ptitle ;
strncpy( (char*)ptitle , title , 96 ) ;
ptitle[96] = 0 ;
+#if TARGET_CARBON
+ c2pstrcpy( ptitle, (char *)ptitle ) ;
+#else
c2pstr( (char*)ptitle ) ;
+#endif
SetWTitle( inWindowRef , ptitle ) ;
}
+
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
{
GetWTitle( inWindowRef , (unsigned char*)title ) ;
+#if TARGET_CARBON
+ p2cstrcpy( title, (unsigned char *)title ) ;
+#else
p2cstr( (unsigned char*)title ) ;
+#endif
}
void UMAShowWindow( WindowRef inWindowRef )
{
if ( UMAHasAppearance() )
{
- ::HideControl( theControl ) ;
+ ::HideControl( theControl ) ;
}
else
{
- ::HideControl( theControl ) ;
+ ::HideControl( theControl ) ;
}
}
}
#endif
SetPort( port ) ;
+ wxDC::MacInvalidateSetup() ;
return err ;
}
{
// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
// if ( inActivate != isHightlited )
- HiliteWindow( inWindowRef , inActivate ) ;
- ControlHandle control = NULL ;
- UMAGetRootControl( inWindowRef , & control ) ;
- if ( control )
- {
- if ( inActivate )
- UMAActivateControl( control ) ;
- else
- UMADeactivateControl( control ) ;
- }
+ GrafPtr port ;
+ GetPort( &port ) ;
+#if TARGET_CARBON
+ SetPort( GetWindowPort( inWindowRef ) ) ;
+#else
+ SetPort( inWindowRef ) ;
+#endif
+ SetOrigin( 0 , 0 ) ;
+ HiliteWindow( inWindowRef , inActivate ) ;
+ ControlHandle control = NULL ;
+ UMAGetRootControl( inWindowRef , & control ) ;
+ if ( control )
+ {
+ if ( inActivate )
+ UMAActivateControl( control ) ;
+ else
+ UMADeactivateControl( control ) ;
+ }
+ SetPort( port ) ;
+ wxDC::MacInvalidateSetup() ;
}
}
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
{
#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- ::DrawThemePlacard( inRect , inState ) ;
- }
- else
+ if ( UMAHasAppearance() )
+ {
+ ::DrawThemePlacard( inRect , inState ) ;
+ }
+ else
#endif
#if !TARGET_CARBON
- {
- }
+ {
+ }
#else
- {
- }
+ {
+ }
#endif
}