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

@@ -3707,6 +3707,13 @@ public:
*/
bool CanDragRowSize(int row) const;
/**
Returns @true if columns can be hidden from the popup menu of the native header.
@since 3.1.3
*/
bool CanHideColumns() const;
/**
Disable interactive resizing of the specified column.
@@ -3765,6 +3772,15 @@ public:
*/
void DisableDragRowSize();
/**
Disables column hiding from the header popup menu.
Equivalent to passing @false to EnableHidingColumns().
@since 3.1.3
*/
void DisableHidingColumns();
/**
Enables or disables cell dragging with the mouse.
*/
@@ -3801,6 +3817,28 @@ public:
*/
void EnableDragRowSize(bool enable = true);
/**
Enables or disables column hiding from the header popup menu.
Note that currently the popup menu can only be shown when using
wxHeaderCtrl, i.e. if UseNativeColHeader() had been called.
If the native header is not used, this method always simply returns
@false without doing anything, as hiding columns is not supported
anyhow. If @a enable value is the same as CanHideColumns(), it also
returns @false to indicate that nothing was done. Otherwise, it returns
@true to indicate that the value of this option was successfully
changed.
The main use case for this method is to disallow hiding the columns
interactively when using the native header.
@since 3.1.3
@see DisableHidingColumns()
*/
bool EnableHidingColumns(bool enable = true);
/**
Returns the column ID of the specified column position.
*/