]> git.saurik.com Git - wxWidgets.git/commitdiff
since drawtext does not have to take linefeeds into account, they're #if 0'ed now...
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 27 Feb 2004 10:07:24 +0000 (10:07 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 27 Feb 2004 10:07:24 +0000 (10:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25978 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/dc.cpp
src/mac/dc.cpp

index bfd36c8421f7a034fa538bf5c30d6db69a139f44..cfb052789cfd2da63f19848283cb6c8e884c7252 100644 (file)
@@ -1476,6 +1476,7 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
     int i = 0 ;
     int line = 0 ;
     {
+#if 0 // we don't have to do all that here
         while( i < length )
         {
             if( strtext[i] == 13 || strtext[i] == 10)
@@ -1515,6 +1516,21 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
                 {
                     wxCharBuffer text = linetext.mb_str(wxConvLocal) ; 
                     ::DrawText( text , 0 , strlen(text) ) ;
+                    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 ) ;
+                    }
                     line++ ;
                     ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
                 }
@@ -1523,6 +1539,8 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
             i++ ;
         }
         wxString linetext = strtext.Mid( laststop , i - laststop ) ;
+#endif // 0
+        wxString linetext = strtext ;
 #if TARGET_CARBON
         if ( useDrawThemeText )
         {
@@ -1556,6 +1574,14 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
 #endif
         {
             wxCharBuffer text = linetext.mb_str(wxConvLocal) ; 
+            if ( m_backgroundMode != wxTRANSPARENT )
+            {
+                Rect frame = { yy - fi.ascent + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy - fi.ascent + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+                short width = ::TextWidth( text , 0 , strlen(text) ) ;
+                frame.right = frame.left + width ;
+
+                ::EraseRect( &frame ) ;
+            }
             ::DrawText( text , 0 , strlen(text) ) ;
          }
     }
@@ -1602,6 +1628,7 @@ void  wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
     if ( width )
     {
         *width = 0 ;
+#if 0 // apparently we don't have to do all that
         while( i < length )
         {
             if( strtext[i] == 13 || strtext[i] == 10)
@@ -1637,6 +1664,8 @@ void  wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
         }
         
         wxString linetext = strtext.Mid( laststop , i - laststop ) ;
+#endif // 0
+        wxString linetext = strtext ;
 #if TARGET_CARBON
         if ( useGetThemeText )
         {
index bfd36c8421f7a034fa538bf5c30d6db69a139f44..cfb052789cfd2da63f19848283cb6c8e884c7252 100644 (file)
@@ -1476,6 +1476,7 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
     int i = 0 ;
     int line = 0 ;
     {
+#if 0 // we don't have to do all that here
         while( i < length )
         {
             if( strtext[i] == 13 || strtext[i] == 10)
@@ -1515,6 +1516,21 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
                 {
                     wxCharBuffer text = linetext.mb_str(wxConvLocal) ; 
                     ::DrawText( text , 0 , strlen(text) ) ;
+                    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 ) ;
+                    }
                     line++ ;
                     ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
                 }
@@ -1523,6 +1539,8 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
             i++ ;
         }
         wxString linetext = strtext.Mid( laststop , i - laststop ) ;
+#endif // 0
+        wxString linetext = strtext ;
 #if TARGET_CARBON
         if ( useDrawThemeText )
         {
@@ -1556,6 +1574,14 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
 #endif
         {
             wxCharBuffer text = linetext.mb_str(wxConvLocal) ; 
+            if ( m_backgroundMode != wxTRANSPARENT )
+            {
+                Rect frame = { yy - fi.ascent + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy - fi.ascent + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+                short width = ::TextWidth( text , 0 , strlen(text) ) ;
+                frame.right = frame.left + width ;
+
+                ::EraseRect( &frame ) ;
+            }
             ::DrawText( text , 0 , strlen(text) ) ;
          }
     }
@@ -1602,6 +1628,7 @@ void  wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
     if ( width )
     {
         *width = 0 ;
+#if 0 // apparently we don't have to do all that
         while( i < length )
         {
             if( strtext[i] == 13 || strtext[i] == 10)
@@ -1637,6 +1664,8 @@ void  wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
         }
         
         wxString linetext = strtext.Mid( laststop , i - laststop ) ;
+#endif // 0
+        wxString linetext = strtext ;
 #if TARGET_CARBON
         if ( useGetThemeText )
         {