Respect item font when rendering markup (wxOSX)
Respect per-item attributes and namely the font (which may differ from the control's font) when rendering markup items in wxDataViewCtrl.
This commit is contained in:
committed by
Václav Slavík
parent
58fc33d7c2
commit
5e5ffad0b8
@@ -22,8 +22,8 @@ public:
|
|||||||
// We don't care about the original colours because we never use them but
|
// We don't care about the original colours because we never use them but
|
||||||
// we do need the correct initial font as we apply modifiers (e.g. create a
|
// we do need the correct initial font as we apply modifiers (e.g. create a
|
||||||
// font larger than it) to it and so it must be valid.
|
// font larger than it) to it and so it must be valid.
|
||||||
wxMarkupToAttrString(wxWindow *win, const wxString& markup)
|
wxMarkupToAttrString(const wxFont& font, const wxString& markup)
|
||||||
: wxMarkupParserAttrOutput(win->GetFont(), wxColour(), wxColour())
|
: wxMarkupParserAttrOutput(font, wxColour(), wxColour())
|
||||||
{
|
{
|
||||||
const wxCFStringRef
|
const wxCFStringRef
|
||||||
label(wxControl::RemoveMnemonics(wxMarkupParser::Strip(markup)));
|
label(wxControl::RemoveMnemonics(wxMarkupParser::Strip(markup)));
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
// default which is different from the system "Lucida Grande" font. So
|
// default which is different from the system "Lucida Grande" font. So
|
||||||
// we need to explicitly change the font for the entire string.
|
// we need to explicitly change the font for the entire string.
|
||||||
[m_attrString addAttribute:NSFontAttributeName
|
[m_attrString addAttribute:NSFontAttributeName
|
||||||
value:win->GetFont().OSXGetNSFont()
|
value:font.OSXGetNSFont()
|
||||||
range:NSMakeRange(0, [m_attrString length])];
|
range:NSMakeRange(0, [m_attrString length])];
|
||||||
|
|
||||||
// Now translate the markup tags to corresponding attributes.
|
// Now translate the markup tags to corresponding attributes.
|
||||||
|
@@ -107,7 +107,7 @@ void wxButtonCocoaImpl::SetBitmap(const wxBitmap& bitmap)
|
|||||||
#if wxUSE_MARKUP
|
#if wxUSE_MARKUP
|
||||||
void wxButtonCocoaImpl::SetLabelMarkup(const wxString& markup)
|
void wxButtonCocoaImpl::SetLabelMarkup(const wxString& markup)
|
||||||
{
|
{
|
||||||
wxMarkupToAttrString toAttr(GetWXPeer(), markup);
|
wxMarkupToAttrString toAttr(GetWXPeer()->GetFont(), markup);
|
||||||
NSMutableAttributedString *attrString = toAttr.GetNSAttributedString();
|
NSMutableAttributedString *attrString = toAttr.GetNSAttributedString();
|
||||||
|
|
||||||
// Button text is always centered.
|
// Button text is always centered.
|
||||||
|
@@ -2829,7 +2829,7 @@ bool wxDataViewTextRenderer::MacRender()
|
|||||||
#if wxUSE_MARKUP
|
#if wxUSE_MARKUP
|
||||||
if ( m_useMarkup )
|
if ( m_useMarkup )
|
||||||
{
|
{
|
||||||
wxMarkupToAttrString toAttr(GetView(), GetValue().GetString());
|
wxMarkupToAttrString toAttr(wxFont([cell font]), GetValue().GetString());
|
||||||
NSMutableAttributedString *str = toAttr.GetNSAttributedString();
|
NSMutableAttributedString *str = toAttr.GetNSAttributedString();
|
||||||
|
|
||||||
if ( [cell lineBreakMode] != NSLineBreakByClipping )
|
if ( [cell lineBreakMode] != NSLineBreakByClipping )
|
||||||
|
@@ -104,7 +104,7 @@ public:
|
|||||||
#if wxUSE_MARKUP
|
#if wxUSE_MARKUP
|
||||||
virtual void SetLabelMarkup( const wxString& markup) wxOVERRIDE
|
virtual void SetLabelMarkup( const wxString& markup) wxOVERRIDE
|
||||||
{
|
{
|
||||||
wxMarkupToAttrString toAttr(GetWXPeer(), markup);
|
wxMarkupToAttrString toAttr(GetWXPeer()->GetFont(), markup);
|
||||||
|
|
||||||
DoSetAttrString(toAttr.GetNSAttributedString());
|
DoSetAttrString(toAttr.GetNSAttributedString());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user