Add CanOverflow function to wxGridCellAttr

Add function to determine whether the cell will draw the overflowed text
to neighbour cells. Note that only left aligned cells currently can overflow.
This commit is contained in:
Ilya Sinitsyn
2020-02-06 23:45:32 +07:00
committed by Vadim Zeitlin
parent 249e5add7e
commit a40acbb28e
3 changed files with 22 additions and 0 deletions

View File

@@ -570,6 +570,9 @@ public:
void GetSize(int *num_rows, int *num_cols) const; void GetSize(int *num_rows, int *num_cols) const;
wxGridFitMode GetFitMode() const; wxGridFitMode GetFitMode() const;
bool GetOverflow() const { return GetFitMode().IsOverflow(); } 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; wxGridCellRenderer *GetRenderer(const wxGrid* grid, int row, int col) const;
wxGridCellEditor *GetEditor(const wxGrid* grid, int row, int col) const; wxGridCellEditor *GetEditor(const wxGrid* grid, int row, int col) const;

View File

@@ -1234,6 +1234,18 @@ public:
*/ */
bool GetOverflow() const; 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(); wxAttrKind GetKind();

View File

@@ -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 // 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 // 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 // used, otherwise the default editor or renderer is fetched from the grid and