[Commits] (davids) colheader - Mac Unicode test rendering fix

commits at osafoundation.org commits at osafoundation.org
Mon Apr 4 02:23:23 PDT 2005


Commit by: davids
Modified files:
internal/wxPython-2.5/src/generic/colheader.cpp 1.45 1.46

Log message:

colheader - Mac Unicode test rendering fix
not as clean as could be, but will do for now.
r=TBD



ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.45&r2=text&tr2=1.46

Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.45 internal/wxPython-2.5/src/generic/colheader.cpp:1.46
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.45	Sun Apr  3 22:22:37 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp	Mon Apr  4 02:23:22 2005
@@ -44,6 +44,10 @@
 	#include "wx/bitmap.h"
 #endif
 
+#if defined(__WXMAC__)
+#include "wx/mac/uma.h"
+#endif
+
 #include "wx/renderer.h"
 #include "wx/colheader.h"
 
@@ -1893,21 +1897,29 @@
 	// render the label text as/if specified
 	if (! bHasIcon && ! m_LabelTextRef.IsEmpty())
 	{
-	CFStringRef			cfLabelText;
-
-		cfLabelText =
-			(bUseUnicode
-			? CFStringCreateWithBytes( NULL, (const UInt8*)(m_LabelTextRef.mb_str()), m_LabelTextRef.length() * sizeof(UniChar), kCFStringEncodingUnicode, false )
-			: CFStringCreateWithCString( NULL, (const char*)(m_LabelTextRef.c_str()), kCFStringEncodingMacRoman ));
-
-		if (cfLabelText != NULL)
+		if (bUseUnicode)
 		{
+		wxMacCFStringHolder	localCFSHolder( m_LabelTextRef, wxFONTENCODING_UNICODE );
+
 			errStatus =
 				(OSStatus)DrawThemeTextBox(
-					cfLabelText, m_FontID, drawInfo.state, true,
+					(CFStringRef)localCFSHolder, m_FontID, drawInfo.state, true,
 					&qdBoundsR, nativeTextJust, NULL );
+		}
+		else
+		{
+		CFStringRef			cfLabelText;
 
-			CFRelease( cfLabelText );
+			cfLabelText = CFStringCreateWithCString( NULL, (const char*)(m_LabelTextRef.c_str()), kCFStringEncodingMacRoman );
+			if (cfLabelText != NULL)
+			{
+				errStatus =
+					(OSStatus)DrawThemeTextBox(
+						cfLabelText, m_FontID, drawInfo.state, true,
+						&qdBoundsR, nativeTextJust, NULL );
+
+				CFRelease( cfLabelText );
+			}
 		}
 	}
 



More information about the Commits mailing list