diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index d753161100..21184f9c17 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -570,6 +570,9 @@ public: void GetSize(int *num_rows, int *num_cols) const; wxGridFitMode GetFitMode() const; bool GetOverflow() const { return GetFitMode().IsOverflow(); } + // whether the cell will draw the overflowed text to neighbour cells + // currently only left aligned cells can overflow + bool CanOverflow() const; wxGridCellRenderer *GetRenderer(const wxGrid* grid, int row, int col) const; wxGridCellEditor *GetEditor(const wxGrid* grid, int row, int col) const; diff --git a/interface/wx/grid.h b/interface/wx/grid.h index ffba02af79..77319ed411 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -1234,6 +1234,18 @@ public: */ bool GetOverflow() const; + /** + Returns @true if the cell will draw an overflowed text into the + neighbouring cells. + + Note that only left aligned cells currenty can overflow. It means that + GetFitMode().IsOverflow() should returns true and GetAlignment should + returns wxALIGN_LEFT for hAlign parameter. + + @since 3.1.4 + */ + bool CanOverflow() const; + wxAttrKind GetKind(); diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index d3fed3f57d..ed11e6c7e0 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -645,6 +645,13 @@ wxGridFitMode wxGridCellAttr::GetFitMode() const } } +bool wxGridCellAttr::CanOverflow() const +{ + int hAlign; + GetAlignment(&hAlign, NULL); + return GetOverflow() && (hAlign == wxALIGN_LEFT); +} + // GetRenderer and GetEditor use a slightly different decision path about // which attribute to use. If a non-default attr object has one then it is // used, otherwise the default editor or renderer is fetched from the grid and