Allow changing horizontal alignment of numeric cells in wxGrid.

wxGridCellAttr didn't provide any way to query its alignment attributes
without falling back to the (always defined) default alignment so the code in
wxGridCellNumberRenderer and similar classes simply always used right
alignment,

Add a new wxGridCellAttr::GetNonDefaultAlignment() function which allows to
retrieve the alignment defined in the attribute and use it to use right
alignment by default but allow overriding it.

Add a test to the sample showing a non right-aligned numeric cell.

Incidentally fix a long-standing bug in wxGridCell{DateTime,Enum}Renderers
which used wxRIGHT instead of wxALIGN_RIGHT and so were not aligned properly
even by default.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-11-27 01:47:38 +00:00
parent ba0185b557
commit cfbc15ee04
6 changed files with 71 additions and 13 deletions

View File

@@ -449,6 +449,15 @@ public:
const wxColour& GetBackgroundColour() const;
const wxFont& GetFont() const;
void GetAlignment(int *hAlign, int *vAlign) const;
// unlike GetAlignment() which always overwrites its output arguments with
// the alignment values to use, falling back on default alignment if this
// attribute doesn't have any, this function will preserve the values of
// parameters on entry if the corresponding alignment is not set in this
// attribute meaning that they can be initialized to default alignment (and
// also that they must be initialized, unlike with GetAlignment())
void GetNonDefaultAlignment(int *hAlign, int *vAlign) const;
void GetSize(int *num_rows, int *num_cols) const;
bool GetOverflow() const
{ return m_overflow != SingleCell; }