- wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
-
- wxMacPortSetter helper(this) ;
- long xx = XLOG2DEVMAC(x);
- long yy = YLOG2DEVMAC(y);
-#if TARGET_CARBON
-
- bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
- if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || m_font.GetNoAntiAliasing() )
- useDrawThemeText = false ;
-#endif
- MacInstallFont() ;
- if ( 0 )
- {
- m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize);
- SetAntiAliasedTextEnabled(true, 8);
- m_macAliasWasEnabled = true ;
- }
- FontInfo fi ;
- ::GetFontInfo( &fi ) ;
-#if TARGET_CARBON
- if ( !useDrawThemeText )
-#endif
- yy += fi.ascent ;
- ::MoveTo( xx , yy );
- if ( m_backgroundMode == wxTRANSPARENT )
- {
- ::TextMode( srcOr) ;
- }
- else
- {
- ::TextMode( srcCopy ) ;
- }
- int length = strtext.Length() ;
-
- int laststop = 0 ;
- int i = 0 ;
- int line = 0 ;
- {
- while( i < length )
- {
- if( strtext[i] == 13 || strtext[i] == 10)
- {
- wxString linetext = strtext.Mid( laststop , i - laststop ) ;
-#if TARGET_CARBON
- if ( useDrawThemeText )
- {
- Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
- wxMacCFStringHolder mString( linetext ) ;
- if ( m_backgroundMode != wxTRANSPARENT )
- {
- Point bounds={0,0} ;
- Rect background = frame ;
- SInt16 baseline ;
- ::GetThemeTextDimensions( mString,
- kThemeCurrentPortFont,
- kThemeStateActive,
- false,
- &bounds,
- &baseline );
- background.right = background.left + bounds.h ;
- background.bottom = background.top + bounds.v ;
- ::EraseRect( &background ) ;
- }
- ::DrawThemeTextBox( mString,
- kThemeCurrentPortFont,
- kThemeStateActive,
- false,
- &frame,
- teJustLeft,
- nil );
- line++ ;
- }
- else
-#endif
- {
- wxCharBuffer text = wxMacStringToCString(linetext) ;
- ::DrawText( text , 0 , strlen(text) ) ;
- line++ ;
- ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
- }
- laststop = i+1 ;
- }
- i++ ;
- }
- wxString linetext = strtext.Mid( laststop , i - laststop ) ;
-#if TARGET_CARBON
- if ( useDrawThemeText )
- {
- Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
- wxMacCFStringHolder mString( linetext ) ;
-
- if ( m_backgroundMode != wxTRANSPARENT )
- {
- Point bounds={0,0} ;
- Rect background = frame ;
- SInt16 baseline ;
- ::GetThemeTextDimensions( mString,
- kThemeCurrentPortFont,
- kThemeStateActive,
- false,
- &bounds,
- &baseline );
- background.right = background.left + bounds.h ;
- background.bottom = background.top + bounds.v ;
- ::EraseRect( &background ) ;
- }
- ::DrawThemeTextBox( mString,
- kThemeCurrentPortFont,
- kThemeStateActive,
- false,
- &frame,
- teJustLeft,
- nil );
- }
- else
-#endif
- {
- wxCharBuffer text = wxMacStringToCString(linetext) ;
- ::DrawText( text , 0 , strlen(text) ) ;
- }
- }
- ::TextMode( srcOr ) ;