-
- FontInfo fi ;
- ::GetFontInfo( &fi ) ;
-
- yy += fi.ascent ;
- ::MoveTo( xx , yy );
- if ( m_backgroundMode == wxTRANSPARENT )
- {
- ::TextMode( srcOr) ;
- }
- else
- {
- ::TextMode( srcCopy ) ;
- }
-
- const char *text = NULL ;
- int length = 0 ;
- wxString macText ;
-
- if ( wxApp::s_macDefaultEncodingIsPC )
- {
- macText = wxMacMakeMacStringFromPC( strtext ) ;
- text = macText ;
- length = macText.Length() ;
- }
- else
- {
- text = strtext ;
- length = strtext.Length() ;
- }
-
- int laststop = 0 ;
- int i = 0 ;
- int line = 0 ;
-
- while( i < length )
- {
- if( text[i] == 13 || text[i] == 10)
- {
- ::DrawText( text , laststop , i - laststop ) ;
- line++ ;
- ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
- laststop = i+1 ;
- }
- i++ ;
- }
-
- ::DrawText( text , laststop , i - laststop ) ;
- ::TextMode( srcOr ) ;
-}
-
-bool wxDC::CanGetTextExtent() const
-{
- wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
-
- return true ;
-}
-
-void wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
- wxCoord *descent, wxCoord *externalLeading ,
- wxFont *theFont ) const
-{
- wxCHECK_RET(Ok(), wxT("Invalid DC"));
- wxMacPortSetter helper(this) ;
-
- wxFont formerFont = m_font ;
-
- if ( theFont )
- {
- wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-
- if ( font )
- {
- ::TextFont( font->m_macFontNum ) ;
- ::TextSize( YLOG2DEVREL( font->m_macFontSize) ) ;
- ::TextFace( font->m_macFontStyle ) ;
- }
- }
- else
- {
- MacInstallFont() ;
- }
-
- FontInfo fi ;
- ::GetFontInfo( &fi ) ;
-
- if ( height )
- *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
- if ( descent )
- *descent =YDEV2LOGREL( fi.descent );
- if ( externalLeading )
- *externalLeading = YDEV2LOGREL( fi.leading ) ;
-
- const char *text = NULL ;
- int length = 0 ;
- wxString macText ;
- if ( wxApp::s_macDefaultEncodingIsPC )
- {
- macText = wxMacMakeMacStringFromPC( string ) ;
- text = macText ;
- length = macText.Length() ;
- }
- else
- {
- text = string ;
- length = string.Length() ;
- }
-
- int laststop = 0 ;
- int i = 0 ;
- int curwidth = 0 ;
- if ( width )
- {
- *width = 0 ;
-
- while( i < length )
- {
- if( text[i] == 13 || text[i] == 10)
- {
- if ( height )
- *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
- curwidth = ::TextWidth( text , laststop , i - laststop ) ;
- if ( curwidth > *width )
- *width = XDEV2LOGREL( curwidth ) ;
- laststop = i+1 ;
- }
- i++ ;
- }
-
- curwidth = ::TextWidth( text , laststop , i - laststop ) ;
- if ( curwidth > *width )
- *width = XDEV2LOGREL( curwidth ) ;
- }
-
- if ( theFont )
- {
- m_macFontInstalled = false ;
- }
+ 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 ) ;