Add symbolic constant wxALIGN_INVALID and use it instead of -1 in wxGrid.
wxGridCellAttr was using literal -1 to indicate "no alignment" which wasn't immediately obvious, use a new wxALIGN_INVALID (which has the same value) instead. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1466,6 +1466,11 @@ enum wxDirection
|
|||||||
|
|
||||||
enum wxAlignment
|
enum wxAlignment
|
||||||
{
|
{
|
||||||
|
// 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP use
|
||||||
|
// it) so define a symbolic name for an invalid alignment value which can
|
||||||
|
// be assumed to be different from anything else
|
||||||
|
wxALIGN_INVALID = -1,
|
||||||
|
|
||||||
wxALIGN_NOT = 0x0000,
|
wxALIGN_NOT = 0x0000,
|
||||||
wxALIGN_CENTER_HORIZONTAL = 0x0100,
|
wxALIGN_CENTER_HORIZONTAL = 0x0100,
|
||||||
wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
|
wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
|
||||||
|
@@ -388,8 +388,7 @@ public:
|
|||||||
{
|
{
|
||||||
Init(attrDefault);
|
Init(attrDefault);
|
||||||
|
|
||||||
// MB: args used to be 0,0 here but wxALIGN_LEFT is 0
|
SetAlignment(wxALIGN_INVALID, wxALIGN_INVALID);
|
||||||
SetAlignment(-1, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// VZ: considering the number of members wxGridCellAttr has now, this ctor
|
// VZ: considering the number of members wxGridCellAttr has now, this ctor
|
||||||
@@ -436,7 +435,10 @@ public:
|
|||||||
bool HasTextColour() const { return m_colText.Ok(); }
|
bool HasTextColour() const { return m_colText.Ok(); }
|
||||||
bool HasBackgroundColour() const { return m_colBack.Ok(); }
|
bool HasBackgroundColour() const { return m_colBack.Ok(); }
|
||||||
bool HasFont() const { return m_font.Ok(); }
|
bool HasFont() const { return m_font.Ok(); }
|
||||||
bool HasAlignment() const { return (m_hAlign != -1 || m_vAlign != -1); }
|
bool HasAlignment() const
|
||||||
|
{
|
||||||
|
return m_hAlign != wxALIGN_INVALID || m_vAlign != wxALIGN_INVALID;
|
||||||
|
}
|
||||||
bool HasRenderer() const { return m_renderer != NULL; }
|
bool HasRenderer() const { return m_renderer != NULL; }
|
||||||
bool HasEditor() const { return m_editor != NULL; }
|
bool HasEditor() const { return m_editor != NULL; }
|
||||||
bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
|
bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
|
||||||
@@ -1675,9 +1677,9 @@ public:
|
|||||||
void SetLabelAlignment( int orientation, int align )
|
void SetLabelAlignment( int orientation, int align )
|
||||||
{
|
{
|
||||||
if ( orientation == wxHORIZONTAL )
|
if ( orientation == wxHORIZONTAL )
|
||||||
SetColLabelAlignment( align, -1 );
|
SetColLabelAlignment( align, wxALIGN_INVALID );
|
||||||
else
|
else
|
||||||
SetRowLabelAlignment( align, -1 );
|
SetRowLabelAlignment( align, wxALIGN_INVALID );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetLabelAlignment( int orientation, int WXUNUSED(align) ) const
|
int GetLabelAlignment( int orientation, int WXUNUSED(align) ) const
|
||||||
|
@@ -66,6 +66,16 @@ enum wxDirection
|
|||||||
*/
|
*/
|
||||||
enum wxAlignment
|
enum wxAlignment
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
A value different from any valid alignment value.
|
||||||
|
|
||||||
|
Note that you shouldn't use 0 for this as it's the value of (valid)
|
||||||
|
alignments wxALIGN_LEFT and wxALIGN_TOP.
|
||||||
|
|
||||||
|
@since 2.9.1
|
||||||
|
*/
|
||||||
|
wxALIGN_INVALID = -1,
|
||||||
|
|
||||||
wxALIGN_NOT = 0x0000,
|
wxALIGN_NOT = 0x0000,
|
||||||
wxALIGN_CENTER_HORIZONTAL = 0x0100,
|
wxALIGN_CENTER_HORIZONTAL = 0x0100,
|
||||||
wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
|
wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
|
||||||
|
Reference in New Issue
Block a user