using Theme layout for measuring as well
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15868 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1584,22 +1584,17 @@ void wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
|
|||||||
|
|
||||||
if ( theFont )
|
if ( theFont )
|
||||||
{
|
{
|
||||||
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
|
// work around the constness
|
||||||
|
*((wxFont*)(&m_font)) = *theFont ;
|
||||||
|
}
|
||||||
|
|
||||||
if ( font )
|
|
||||||
{
|
|
||||||
::TextFont( font->m_macFontNum ) ;
|
|
||||||
::TextSize( YLOG2DEVREL( font->m_macFontSize) ) ;
|
|
||||||
::TextFace( font->m_macFontStyle ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MacInstallFont() ;
|
MacInstallFont() ;
|
||||||
}
|
|
||||||
|
|
||||||
FontInfo fi ;
|
FontInfo fi ;
|
||||||
::GetFontInfo( &fi ) ;
|
::GetFontInfo( &fi ) ;
|
||||||
|
#if TARGET_CARBON
|
||||||
|
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( height )
|
if ( height )
|
||||||
*height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
|
*height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
|
||||||
@@ -1636,7 +1631,25 @@ void wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
|
|||||||
{
|
{
|
||||||
if ( height )
|
if ( height )
|
||||||
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
||||||
|
#if TARGET_CARBON
|
||||||
|
if ( useGetThemeText )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
true,
|
||||||
|
&bounds,
|
||||||
|
nil );
|
||||||
|
CFRelease( mString ) ;
|
||||||
|
curwidth = bounds.h ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||||
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
*width = XDEV2LOGREL( curwidth ) ;
|
*width = XDEV2LOGREL( curwidth ) ;
|
||||||
laststop = i+1 ;
|
laststop = i+1 ;
|
||||||
@@ -1644,13 +1657,33 @@ void wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
|
|||||||
i++ ;
|
i++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TARGET_CARBON
|
||||||
|
if ( useGetThemeText )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
true,
|
||||||
|
&bounds,
|
||||||
|
nil );
|
||||||
|
CFRelease( mString ) ;
|
||||||
|
curwidth = bounds.h ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||||
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
*width = XDEV2LOGREL( curwidth ) ;
|
*width = XDEV2LOGREL( curwidth ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( theFont )
|
if ( theFont )
|
||||||
{
|
{
|
||||||
|
// work around the constness
|
||||||
|
*((wxFont*)(&m_font)) = formerFont ;
|
||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1584,22 +1584,17 @@ void wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
|
|||||||
|
|
||||||
if ( theFont )
|
if ( theFont )
|
||||||
{
|
{
|
||||||
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
|
// work around the constness
|
||||||
|
*((wxFont*)(&m_font)) = *theFont ;
|
||||||
|
}
|
||||||
|
|
||||||
if ( font )
|
|
||||||
{
|
|
||||||
::TextFont( font->m_macFontNum ) ;
|
|
||||||
::TextSize( YLOG2DEVREL( font->m_macFontSize) ) ;
|
|
||||||
::TextFace( font->m_macFontStyle ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MacInstallFont() ;
|
MacInstallFont() ;
|
||||||
}
|
|
||||||
|
|
||||||
FontInfo fi ;
|
FontInfo fi ;
|
||||||
::GetFontInfo( &fi ) ;
|
::GetFontInfo( &fi ) ;
|
||||||
|
#if TARGET_CARBON
|
||||||
|
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( height )
|
if ( height )
|
||||||
*height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
|
*height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
|
||||||
@@ -1636,7 +1631,25 @@ void wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
|
|||||||
{
|
{
|
||||||
if ( height )
|
if ( height )
|
||||||
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
||||||
|
#if TARGET_CARBON
|
||||||
|
if ( useGetThemeText )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
true,
|
||||||
|
&bounds,
|
||||||
|
nil );
|
||||||
|
CFRelease( mString ) ;
|
||||||
|
curwidth = bounds.h ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||||
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
*width = XDEV2LOGREL( curwidth ) ;
|
*width = XDEV2LOGREL( curwidth ) ;
|
||||||
laststop = i+1 ;
|
laststop = i+1 ;
|
||||||
@@ -1644,13 +1657,33 @@ void wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
|
|||||||
i++ ;
|
i++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TARGET_CARBON
|
||||||
|
if ( useGetThemeText )
|
||||||
|
{
|
||||||
|
Point bounds={0,0} ;
|
||||||
|
CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
|
||||||
|
::GetThemeTextDimensions( mString,
|
||||||
|
kThemeCurrentPortFont,
|
||||||
|
kThemeStateActive,
|
||||||
|
true,
|
||||||
|
&bounds,
|
||||||
|
nil );
|
||||||
|
CFRelease( mString ) ;
|
||||||
|
curwidth = bounds.h ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
curwidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||||
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
*width = XDEV2LOGREL( curwidth ) ;
|
*width = XDEV2LOGREL( curwidth ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( theFont )
|
if ( theFont )
|
||||||
{
|
{
|
||||||
|
// work around the constness
|
||||||
|
*((wxFont*)(&m_font)) = formerFont ;
|
||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user