Update just the colour, not font, in wxOSX SetForegroundColour()
Calling wxWindow::SetForegroundColour() also changed the window font, which was unexpected and unnecessary. Add a separate peer SetForegroundColour() method and implement it to change just the colour in Cocoa version (and leave unimplemented, just as it was before, for iOS) and use it in wxWindow to avoid the font change.
This commit is contained in:
@@ -504,33 +504,32 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindowMac::MacUpdateControlFont()
|
||||
{
|
||||
if ( GetPeer() )
|
||||
GetPeer()->SetFont(GetFont()) ;
|
||||
|
||||
// do not trigger refreshes upon invisible and possible partly created objects
|
||||
if ( IsShownOnScreen() )
|
||||
Refresh() ;
|
||||
}
|
||||
|
||||
bool wxWindowMac::SetFont(const wxFont& font)
|
||||
{
|
||||
bool retval = wxWindowBase::SetFont( font );
|
||||
|
||||
MacUpdateControlFont() ;
|
||||
if (retval)
|
||||
{
|
||||
if ( GetPeer() )
|
||||
GetPeer()->SetFont(GetFont()) ;
|
||||
|
||||
// do not trigger refreshes upon invisible and possible partly created objects
|
||||
if ( IsShownOnScreen() )
|
||||
Refresh() ;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool wxWindowMac::SetForegroundColour(const wxColour& col )
|
||||
{
|
||||
bool retval = wxWindowBase::SetForegroundColour( col );
|
||||
if ( !wxWindowBase::SetForegroundColour( col ) )
|
||||
return false;
|
||||
|
||||
if (retval)
|
||||
MacUpdateControlFont();
|
||||
if ( GetPeer() )
|
||||
GetPeer()->SetForegroundColour(col);
|
||||
|
||||
return retval;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxWindowMac::SetBackgroundStyle(wxBackgroundStyle style)
|
||||
|
Reference in New Issue
Block a user