Make wxGrid::SetLabelXXX() work when using native header as well

Allow changing label colours and font of the native column header too.

Closes https://github.com/wxWidgets/wxWidgets/pull/1762

Closes #18605.
This commit is contained in:
ali kettab
2020-03-12 22:04:41 +01:00
committed by Vadim Zeitlin
parent 95eea38eb0
commit 40cbea298d

View File

@@ -6497,8 +6497,15 @@ bool wxGrid::UseNativeColHeader(bool native)
CreateColumnWindow();
if ( m_useNativeHeader )
{
SetNativeHeaderColCount();
wxHeaderCtrl* const colHeader = GetGridColHeader();
colHeader->SetBackgroundColour( GetLabelBackgroundColour() );
colHeader->SetForegroundColour( GetLabelTextColour() );
colHeader->SetFont( GetLabelFont() );
}
CalcWindowSizes();
return true;
@@ -7980,6 +7987,10 @@ void wxGrid::SetLabelTextColour( const wxColour& colour )
if ( m_labelTextColour != colour )
{
m_labelTextColour = colour;
if ( IsUsingNativeHeader() )
GetGridColHeader()->SetForegroundColour( colour );
if ( ShouldRefresh() )
{
m_rowLabelWin->Refresh();
@@ -7991,6 +8002,10 @@ void wxGrid::SetLabelTextColour( const wxColour& colour )
void wxGrid::SetLabelFont( const wxFont& font )
{
m_labelFont = font;
if ( IsUsingNativeHeader() )
GetGridColHeader()->SetFont( font );
if ( ShouldRefresh() )
{
m_rowLabelWin->Refresh();