Remove check for read only cells from IsCellEditControlEnabled()

This check was introduced back in 283b7808d8 (added support for readonly
cells and 3d border drawing, 2000-02-16), but was wrong even then and
remained wrong ever since: we must not set m_cellEditCtrlEnabled to true
when the current cell is read-only, so there is no need to check for the
latter condition if m_cellEditCtrlEnabled is indeed true.

Ensure that we really never erroneously set m_cellEditCtrlEnabled for
the read-only cells by replacing an wxASSERT_MSG checking for this in
EnableCellEditControl() with wxCHECK_RET().

Also explicitly document this function precondition, also added back in
b54ba67107 ([...] added CanEnableCellControl() and use it before calling
EnableEC, 2000-02-17) but never documented so far.
This commit is contained in:
Vadim Zeitlin
2020-06-27 23:50:44 +02:00
parent 1a330bb43e
commit 45bc2e648b
3 changed files with 7 additions and 11 deletions

View File

@@ -1504,7 +1504,7 @@ public:
void EnableCellEditControl( bool enable = true );
void DisableCellEditControl() { EnableCellEditControl(false); }
bool CanEnableCellControl() const;
bool IsCellEditControlEnabled() const;
bool IsCellEditControlEnabled() const { return m_cellEditCtrlEnabled; }
bool IsCellEditControlShown() const;
bool IsCurrentCellReadOnly() const;