]> git.saurik.com Git - wxWidgets.git/commitdiff
unicode fixes
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 28 Mar 2003 17:30:20 +0000 (17:30 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 28 Mar 2003 17:30:20 +0000 (17:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19852 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/choice.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/tooltip.cpp
src/mac/choice.cpp
src/mac/listbox.cpp
src/mac/tooltip.cpp

index 19f8e405d288a387c2e3271845829da4dcd31a1c..37f432cff0a318b36131d7f4eb29fc6729424649 100644 (file)
@@ -238,7 +238,20 @@ wxSize wxChoice::DoGetBestSize() const
         // Find the widest line
         for(int i = 0; i < GetCount(); i++) {
             wxString str(GetString(i));
-            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+        #if wxUSE_UNICODE
+            Point bounds={0,0} ;
+            SInt16 baseline ;
+            ::GetThemeTextDimensions( wxMacCFStringHolder( str ) ,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &bounds,
+                &baseline );
+            wLine = bounds.h ;
+        #else
+            wxCharBuffer text = wxMacStringToCString( str ) ;
+            wLine = ::TextWidth( text , 0 , strlen(text) ) ;
+        #endif
             lbWidth = wxMax(lbWidth, wLine);
         }
         // Add room for the popup arrow
index 12e2c048bb05dd97ae0c5ad503b6cfd6a552c9cc..656a835b6e0ebbeef39cf02647df78a62d458024 100644 (file)
@@ -620,7 +620,20 @@ wxSize wxListBox::DoGetBestSize() const
         // Find the widest line
         for(int i = 0; i < GetCount(); i++) {
             wxString str(GetString(i));
-            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+        #if wxUSE_UNICODE
+            Point bounds={0,0} ;
+            SInt16 baseline ;
+            ::GetThemeTextDimensions( wxMacCFStringHolder( str ) ,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &bounds,
+                &baseline );
+            wLine = bounds.h ;
+        #else
+            wxCharBuffer text = wxMacStringToCString( str ) ;
+            wLine = ::TextWidth( text , 0 , strlen(text) ) ;
+        #endif
             lbWidth = wxMax(lbWidth, wLine);
         }
         
index bee14fc9fb1174c9f70b4956f099aa27acda052d..042a6f2c35e3902fd35e127b135ba72d5fe5d0e3 100644 (file)
@@ -256,7 +256,6 @@ void wxMacToolTip::Draw()
         ::GetFontInfo(&fontInfo);
         short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
         short height = 0 ;
-        //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
         
         int i = 0 ;
         int length = m_label.Length() ;
index 19f8e405d288a387c2e3271845829da4dcd31a1c..37f432cff0a318b36131d7f4eb29fc6729424649 100644 (file)
@@ -238,7 +238,20 @@ wxSize wxChoice::DoGetBestSize() const
         // Find the widest line
         for(int i = 0; i < GetCount(); i++) {
             wxString str(GetString(i));
-            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+        #if wxUSE_UNICODE
+            Point bounds={0,0} ;
+            SInt16 baseline ;
+            ::GetThemeTextDimensions( wxMacCFStringHolder( str ) ,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &bounds,
+                &baseline );
+            wLine = bounds.h ;
+        #else
+            wxCharBuffer text = wxMacStringToCString( str ) ;
+            wLine = ::TextWidth( text , 0 , strlen(text) ) ;
+        #endif
             lbWidth = wxMax(lbWidth, wLine);
         }
         // Add room for the popup arrow
index 12e2c048bb05dd97ae0c5ad503b6cfd6a552c9cc..656a835b6e0ebbeef39cf02647df78a62d458024 100644 (file)
@@ -620,7 +620,20 @@ wxSize wxListBox::DoGetBestSize() const
         // Find the widest line
         for(int i = 0; i < GetCount(); i++) {
             wxString str(GetString(i));
-            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+        #if wxUSE_UNICODE
+            Point bounds={0,0} ;
+            SInt16 baseline ;
+            ::GetThemeTextDimensions( wxMacCFStringHolder( str ) ,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &bounds,
+                &baseline );
+            wLine = bounds.h ;
+        #else
+            wxCharBuffer text = wxMacStringToCString( str ) ;
+            wLine = ::TextWidth( text , 0 , strlen(text) ) ;
+        #endif
             lbWidth = wxMax(lbWidth, wLine);
         }
         
index bee14fc9fb1174c9f70b4956f099aa27acda052d..042a6f2c35e3902fd35e127b135ba72d5fe5d0e3 100644 (file)
@@ -256,7 +256,6 @@ void wxMacToolTip::Draw()
         ::GetFontInfo(&fontInfo);
         short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
         short height = 0 ;
-        //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
         
         int i = 0 ;
         int length = m_label.Length() ;