Don't use external flag to determine if wxPG header is visible

Check if wxPG header really exists and is visible prior to any operation.

Closes #18128.
This commit is contained in:
Artur Wieczorek
2018-07-07 20:28:11 +02:00
parent 81cac4e46b
commit 0ee25cce3a

View File

@@ -812,7 +812,7 @@ bool wxPropertyGridManager::DoSelectPage( int index )
#endif #endif
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
m_pHeaderCtrl->OnPageChanged(nextPage); m_pHeaderCtrl->OnPageChanged(nextPage);
#endif #endif
@@ -929,7 +929,7 @@ void wxPropertyGridManager::SetColumnCount( int colCount, int page )
GetGrid()->Refresh(); GetGrid()->Refresh();
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
m_pHeaderCtrl->OnPageUpdated(); m_pHeaderCtrl->OnPageUpdated();
#endif #endif
} }
@@ -1347,7 +1347,7 @@ void wxPropertyGridManager::RecalculatePositions( int width, int height )
// Header comes after the tool bar // Header comes after the tool bar
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
{ {
m_pHeaderCtrl->SetSize(0, propgridY, width, wxDefaultCoord); m_pHeaderCtrl->SetSize(0, propgridY, width, wxDefaultCoord);
propgridY += m_pHeaderCtrl->GetSize().y; propgridY += m_pHeaderCtrl->GetSize().y;
@@ -1900,7 +1900,7 @@ void wxPropertyGridManager::SetSplitterLeft( bool subProps, bool allPages )
} }
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
m_pHeaderCtrl->OnColumWidthsChanged(); m_pHeaderCtrl->OnColumWidthsChanged();
#endif #endif
} }
@@ -1920,7 +1920,7 @@ void wxPropertyGridManager::SetPageSplitterLeft(int page, bool subProps)
SetPageSplitterPosition( page, maxW ); SetPageSplitterPosition( page, maxW );
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
m_pHeaderCtrl->OnColumWidthsChanged(); m_pHeaderCtrl->OnColumWidthsChanged();
#endif #endif
} }
@@ -1966,10 +1966,8 @@ void
wxPropertyGridManager::OnPGColDrag( wxPropertyGridEvent& WXUNUSED(event) ) wxPropertyGridManager::OnPGColDrag( wxPropertyGridEvent& WXUNUSED(event) )
{ {
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( !m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
return; m_pHeaderCtrl->OnColumWidthsChanged();
m_pHeaderCtrl->OnColumWidthsChanged();
#endif #endif
} }
@@ -2005,7 +2003,7 @@ void wxPropertyGridManager::OnResize( wxSizeEvent& WXUNUSED(event) )
} }
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
m_pHeaderCtrl->OnColumWidthsChanged(); m_pHeaderCtrl->OnColumWidthsChanged();
#endif #endif
} }
@@ -2148,7 +2146,7 @@ void wxPropertyGridManager::SetSplitterPosition( int pos, int splitterColumn )
} }
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
m_pHeaderCtrl->OnColumWidthsChanged(); m_pHeaderCtrl->OnColumWidthsChanged();
#endif #endif
} }
@@ -2162,7 +2160,7 @@ void wxPropertyGridManager::SetPageSplitterPosition( int page,
GetPage(page)->DoSetSplitterPosition( pos, column ); GetPage(page)->DoSetSplitterPosition( pos, column );
#if wxUSE_HEADERCTRL #if wxUSE_HEADERCTRL
if ( m_showHeader ) if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() )
m_pHeaderCtrl->OnColumWidthsChanged(); m_pHeaderCtrl->OnColumWidthsChanged();
#endif #endif
} }