Simplify wxWidgetCocoaImpl::SetForegroundColour() in wxOSX
Use the colour directly in implementation class method and ensure that we pass it the correct colour from wxWindow::SetForegroundColour() itself. This simplifies the logic a bit and avoids clang warning about unused "col" parameter in wxWidgetCocoaImpl::SetForegroundColour(). Closes https://github.com/wxWidgets/wxWidgets/pull/2491
This commit is contained in:
@@ -3619,8 +3619,7 @@ void wxWidgetCocoaImpl::SetForegroundColour(const wxColour& col)
|
|||||||
|
|
||||||
if ([targetView respondsToSelector:@selector(setTextColor:)])
|
if ([targetView respondsToSelector:@selector(setTextColor:)])
|
||||||
{
|
{
|
||||||
wxColor col = GetWXPeer()->GetForegroundColour();
|
[targetView setTextColor: col.IsOk() ? col.OSXGetNSColor() : nil];
|
||||||
[targetView setTextColor: col.OSXGetNSColor()];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -527,7 +527,12 @@ bool wxWindowMac::SetForegroundColour(const wxColour& col )
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( GetPeer() )
|
if ( GetPeer() )
|
||||||
GetPeer()->SetForegroundColour(col);
|
{
|
||||||
|
// Note that we use GetForegroundColour() and not "col" itself here in
|
||||||
|
// case we're now inheriting our parent foreground rather than passing
|
||||||
|
// the (null) colour argument.
|
||||||
|
GetPeer()->SetForegroundColour(GetForegroundColour());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user