Add wxGrid::Enable{Row,Col}Resize()

These functions are needed to allow resizing the rows/columns whose size
was fixed by Disable{Row,Col}Resize() as otherwise the effect of a call
to the latter function can't be undone at all.
This commit is contained in:
Vadim Zeitlin 2022-09-02 20:52:20 +01:00
parent e2a6eac6e8
commit ab2dd24976
3 changed files with 34 additions and 1 deletions

View file

@ -1904,6 +1904,10 @@ public:
void DisableRowResize(int row) { DoDisableLineResize(row, m_setFixedRows); }
void DisableColResize(int col) { DoDisableLineResize(col, m_setFixedCols); }
// and then resizing them may be re-enabled again later
void EnableRowResize(int row) { DoEnableLineResize(row, m_setFixedRows); }
void EnableColResize(int col) { DoEnableLineResize(col, m_setFixedCols); }
// These function return true if resizing rows/columns by dragging
// their edges inside the grid is enabled. Note that this doesn't cover
// dragging their separators in the label windows (which can be enabled
@ -2963,8 +2967,9 @@ private:
void DoSetSizes(const wxGridSizesInfo& sizeInfo,
const wxGridOperations& oper);
// common part of Disable{Row,Col}Resize and CanDrag{Row,Col}Size
// common part of {Disable,Enable}{Row,Col}Resize and CanDrag{Row,Col}Size
void DoDisableLineResize(int line, wxGridFixedIndicesSet *& setFixed);
void DoEnableLineResize(int line, wxGridFixedIndicesSet* setFixed);
bool DoCanResizeLine(int line, const wxGridFixedIndicesSet *setFixed) const;
// Helper of Render(): get grid size, origin offset and fill cell arrays

View file

@ -4655,6 +4655,17 @@ public:
*/
void DisableHidingColumns();
/**
Enable interactively resizing a column if it was previously forbidden.
Calling this function only makes sense if the row resizing had been
previously forbidden using DisableColResize(), as it simply undoes its
effect.
@since 3.3.0
*/
void EnableColResize(int col);
/**
Enables or disables cell dragging with the mouse.
*/
@ -4726,6 +4737,17 @@ public:
*/
bool EnableHidingColumns(bool enable = true);
/**
Enable interactively resizing a row if it was previously forbidden.
Calling this function only makes sense if the row resizing had been
previously forbidden using DisableRowResize(), as it simply undoes its
effect.
@since 3.3.0
*/
void EnableRowResize(int row)l
/**
Returns the column ID of the specified column position.
*/

View file

@ -9913,6 +9913,12 @@ void wxGrid::DoDisableLineResize(int line, wxGridFixedIndicesSet *& setFixed)
setFixed->insert(line);
}
void wxGrid::DoEnableLineResize(int line, wxGridFixedIndicesSet* setFixed)
{
if ( setFixed )
setFixed->erase(line);
}
bool
wxGrid::DoCanResizeLine(int line, const wxGridFixedIndicesSet *setFixed) const
{