+/////////////////////////////////////////////////////////////////////////////
+// Name: uma.cpp
+// Purpose: UMA support
+// Author: Stefan Csomor
+// Modified by:
+// Created: 04/01/98
+// RCS-ID: $Id$
+// Copyright: (c) Stefan Csomor
+// Licence: The wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#include "wx/defs.h"
#include "wx/dc.h"
#include <MacTextEditor.h>
wxString str = wxStripMenuCodes( title ) ;
MenuRef menu ;
#if TARGET_CARBON
- CFStringRef cfs = wxMacCreateCFString( str ) ;
CreateNewMenu( id , 0 , &menu ) ;
- SetMenuTitleWithCFString( menu , cfs ) ;
- CFRelease( cfs ) ;
+ SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str) ) ;
#else
Str255 ptitle ;
wxMacStringToPascal( str , ptitle ) ;
{
wxString str = wxStripMenuCodes( title ) ;
#if TARGET_CARBON
- CFStringRef cfs = wxMacCreateCFString( str ) ;
- SetMenuTitleWithCFString( menu , cfs ) ;
- CFRelease( cfs ) ;
+ SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str) ) ;
#else
Str255 ptitle ;
wxMacStringToPascal( str , ptitle ) ;
{
wxString str = wxStripMenuCodes( title ) ;
#if TARGET_CARBON
- CFStringRef cfs = wxMacCreateCFString( str ) ;
- SetMenuItemTextWithCFString( menu , item , cfs ) ;
- CFRelease( cfs ) ;
+ SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str) ) ;
#else
Str255 ptitle ;
wxMacStringToPascal( str , ptitle ) ;
// quickdraw
+#if !TARGET_CARBON
+
int gPrOpenCounter = 0 ;
-OSStatus UMAPrOpen(void *macPrintSession)
+OSStatus UMAPrOpen()
{
-#if !TARGET_CARBON
OSErr err = noErr ;
++gPrOpenCounter ;
if ( gPrOpenCounter == 1 )
wxASSERT( err == noErr ) ;
}
return err ;
-#else
- OSStatus err = noErr ;
- ++gPrOpenCounter ;
- if ( gPrOpenCounter == 1 )
- {
- #if PM_USE_SESSION_APIS
- err = PMCreateSession((PMPrintSession *)macPrintSession) ;
- #else
- err = PMBegin() ;
- #endif
- wxASSERT( err == noErr ) ;
- }
- return err ;
-#endif
}
-OSStatus UMAPrClose(void *macPrintSession)
+OSStatus UMAPrClose()
{
-#if !TARGET_CARBON
OSErr err = noErr ;
wxASSERT( gPrOpenCounter >= 1 ) ;
if ( gPrOpenCounter == 1 )
}
--gPrOpenCounter ;
return err ;
-#else
- OSStatus err = noErr ;
- wxASSERT( gPrOpenCounter >= 1 ) ;
- if ( gPrOpenCounter == 1 )
- {
- #if PM_USE_SESSION_APIS
- err = PMRelease(*(PMPrintSession *)macPrintSession) ;
- *(PMPrintSession *)macPrintSession = kPMNoReference;
- #else
- err = PMEnd() ;
- #endif
- }
- --gPrOpenCounter ;
- return err ;
-#endif
}
-#if !TARGET_CARBON
-
pascal QDGlobalsPtr GetQDGlobalsPtr (void) ;
pascal QDGlobalsPtr GetQDGlobalsPtr (void)
{
DisposeWindow( inWindowRef ) ;
}
-void UMASetWTitleC( WindowRef inWindowRef , const char *title )
+void UMASetWTitle( WindowRef inWindowRef , const wxString& title )
{
- Str255 ptitle ;
- strncpy( (char*)ptitle , title , 96 ) ;
- ptitle[96] = 0 ;
#if TARGET_CARBON
- c2pstrcpy( ptitle, (char *)ptitle ) ;
+ SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title) ) ;
#else
- c2pstr( (char*)ptitle ) ;
-#endif
+ Str255 ptitle ;
+ wxMacStringToPascal( title , ptitle ) ;
SetWTitle( inWindowRef , ptitle ) ;
+#endif
}
void UMAGetWTitleC( WindowRef inWindowRef , char *title )
// appearance additions
+void UMASetControlTitle( ControlHandle inControl , const wxString& title )
+{
+#if TARGET_CARBON
+ SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title) ) ;
+#else
+ Str255 ptitle ;
+ wxMacStringToPascal( title , ptitle ) ;
+ SetControlTitle( inControl , ptitle ) ;
+#endif
+}
+
void UMAActivateControl( ControlHandle inControl )
{
// we have to add the control after again to the update rgn
{
GetPort( &m_oldPort ) ;
SetPort( newport ) ;
- wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
+ wxASSERT_MSG( m_clip == NULL , wxT("Cannot call setup twice") ) ;
m_clip = NewRgn() ;
GetClip( m_clip );
m_textFont = GetPortTextFont( (CGrafPtr) newport);