Allow disabling hiding columns when using wxHeaderCtrl in wxGrid

Add wxGrid::DisableHidingColumns() method which can be used to prevent
wxHeaderCtrl from allowing the user to hide columns interactively, which
is something it allows to do by default, unlike the "built-in" wxGrid
header.

Also add EnableHidingColumns() and CanHideColumns() for consistency with
the other similar methods.

Closes https://github.com/wxWidgets/wxWidgets/pull/1554
This commit is contained in:
Ilya Sinitsyn
2019-09-16 23:14:25 +07:00
committed by Vadim Zeitlin
parent 4302c6b8ba
commit e26d90028b
6 changed files with 72 additions and 1 deletions

View File

@@ -2607,6 +2607,7 @@ void wxGrid::Init()
m_gridFrozenBorderPenWidth = 2;
m_canDragColMove = false;
m_canHideColumns = true;
m_cursorMode = WXGRID_CURSOR_SELECT_CELL;
m_winCapture = NULL;
@@ -4829,6 +4830,18 @@ bool wxGrid::EnableDragColMove( bool enable )
return true;
}
bool wxGrid::EnableHidingColumns(bool enable)
{
if ( m_canHideColumns == enable || !m_useNativeHeader )
return false;
GetGridColHeader()->ToggleWindowStyle(wxHD_ALLOW_HIDE);
m_canHideColumns = enable;
return true;
}
void wxGrid::InitializeFrozenWindows()
{
// frozen row windows