wxOSX: Don't tighten truncated markup in wxDataViewCtrl

Starting with OS X 10.10, rich text is automatically tightened if it
doesn't fit and needs to be ellipsized, in an effort to fit more text
on screen. This is not desirable in wxDataViewCtrl where the cells may
display texts of varying lengths, some tightened and some not.
Explicitly disable this functionality to have consistent appearance.
This commit is contained in:
Václav Slavík
2017-04-04 14:30:33 +02:00
parent e01510f6c0
commit 1fb0b9c01f

View File

@@ -2963,6 +2963,22 @@ bool wxDataViewTextRenderer::MacRender()
{
NSMutableParagraphStyle *par = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
[par setLineBreakMode:[cell lineBreakMode]];
// Tightening looks very ugly when combined with non-tightened rows,
// so disabled it on OS X version where it's used:
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_11)
{
[par setAllowsDefaultTighteningForTruncation:NO];
}
else
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10)
{
[par setTighteningFactorForTruncation:0.0];
}
#endif
[str addAttribute:NSParagraphStyleAttributeName
value:par
range:NSMakeRange(0, [str length])];