1 --- src/osx/cocoa/window.mm.orig 2018-01-05 11:08:33.000000000 +0000
2 +++ src/osx/cocoa/window.mm 2018-01-05 11:11:17.000000000 +0000
5 void wxWidgetCocoaImpl::SetLabel( const wxString& title, wxFontEncoding encoding )
7 + if ( [m_osxView respondsToSelector:@selector(setAttributedTitle:) ] )
9 + wxFont f = GetWXPeer()->GetFont();
10 + // we should not override system font colors unless explicitly specified
11 + wxColour col = GetWXPeer()->UseFgCol() ? GetWXPeer()->GetForegroundColour() : wxNullColour;
12 + if ( f.GetStrikethrough() || f.GetUnderlined() || col.IsOk() )
14 + wxCFStringRef cf(title, encoding );
16 + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]
17 + initWithString:cf.AsNSString()];
19 + [attrString beginEditing];
21 + NSTextAlignment textAlign;
22 + if ( [m_osxView isKindOfClass:[NSControl class]] )
23 + textAlign = [(id)m_osxView alignment];
25 + textAlign = NSCenterTextAlignment;
26 + [attrString setAlignment:textAlign
27 + range:NSMakeRange(0, [attrString length])];
29 + [attrString addAttribute:NSFontAttributeName
30 + value:f.OSXGetNSFont()
31 + range:NSMakeRange(0, [attrString length])];
32 + if ( f.GetStrikethrough() )
34 + [attrString addAttribute:NSStrikethroughStyleAttributeName
35 + value:@(NSUnderlineStyleSingle)
36 + range:NSMakeRange(0, [attrString length])];
39 + if ( f.GetUnderlined() )
41 + [attrString addAttribute:NSUnderlineStyleAttributeName
42 + value:@(NSUnderlineStyleSingle)
43 + range:NSMakeRange(0, [attrString length])];
49 + [attrString addAttribute:NSForegroundColorAttributeName
50 + value:col.OSXGetNSColor()
51 + range:NSMakeRange(0, [attrString length])];
54 + [attrString endEditing];
56 + [(id)m_osxView setAttributedTitle:attrString];
58 + [attrString release];
64 if ( [m_osxView respondsToSelector:@selector(setTitle:) ] )
66 wxCFStringRef cf( title , encoding );
67 @@ -2683,13 +2740,13 @@
68 if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
69 targetView = [(NSScrollView*) m_osxView documentView];
72 if ([targetView respondsToSelector:@selector(setFont:)])
73 [targetView setFont: font.OSXGetNSFont()];
74 if ([targetView respondsToSelector:@selector(setTextColor:)])
75 - [targetView setTextColor:[NSColor colorWithCalibratedRed:(CGFloat) (col.Red() / 255.0)
76 - green:(CGFloat) (col.Green() / 255.0)
77 - blue:(CGFloat) (col.Blue() / 255.0)
78 - alpha:(CGFloat) (col.Alpha() / 255.0)]];
79 + [targetView setTextColor: col.OSXGetNSColor()];
80 + if ([m_osxView respondsToSelector:@selector(setAttributedTitle:)])
81 + SetLabel(wxStripMenuCodes(GetWXPeer()->GetLabel(), wxStrip_Mnemonics), GetWXPeer()->GetFont().GetEncoding());
84 void wxWidgetCocoaImpl::SetToolTip(wxToolTip* tooltip)
85 --- include/wx/window.h.orig 2018-01-05 11:38:33.000000000 +0000
86 +++ include/wx/window.h 2018-01-05 11:38:59.000000000 +0000
87 @@ -1089,6 +1089,10 @@
91 + bool UseFgCol() const
96 virtual bool SetForegroundColour(const wxColour& colour);
97 void SetOwnForegroundColour(const wxColour& colour)
98 --- interface/wx/window.h.orig 2018-01-05 11:37:43.000000000 +0000
99 +++ interface/wx/window.h 2018-01-05 11:38:18.000000000 +0000
100 @@ -2060,6 +2060,8 @@
102 bool UseBgCol() const;
104 + bool UseFgCol() const;
107 Sets the font of the window but prevents it from being inherited by the
108 children of this window.