Changed wxGridCellAttr::HasAlignment to treat values of -1 as no

alignment because wxALIGN_LEFT and wxALIGN_TOP are 0.

Updated griddemo.cpp to use correct alignment defs.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7864 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Bedward
2000-07-27 04:09:21 +00:00
parent 4c7277db42
commit 0767cb6f44
2 changed files with 28 additions and 27 deletions

View File

@@ -564,7 +564,8 @@ public:
wxGridCellAttr()
{
Init();
SetAlignment(0, 0);
// MB: args used to be 0,0 here but wxALIGN_LEFT is 0
SetAlignment(-1, -1);
}
// VZ: considering the number of members wxGridCellAttr has now, this ctor
@@ -610,7 +611,7 @@ public:
bool HasTextColour() const { return m_colText.Ok(); }
bool HasBackgroundColour() const { return m_colBack.Ok(); }
bool HasFont() const { return m_font.Ok(); }
bool HasAlignment() const { return m_hAlign || m_vAlign; }
bool HasAlignment() const { return (m_hAlign != -1 || m_vAlign != -1); }
bool HasRenderer() const { return m_renderer != NULL; }
bool HasEditor() const { return m_editor != NULL; }

View File

@@ -229,7 +229,7 @@ GridFrame::GridFrame()
grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY);
grid->SetCellValue(4, 4, "a weird looking cell");
grid->SetCellAlignment(4, 4, wxCENTRE, wxCENTRE);
grid->SetCellAlignment(4, 4, wxALIGN_CENTRE, wxALIGN_CENTRE);
grid->SetCellRenderer(4, 4, new MyGridCellRenderer);
grid->SetCellValue(3, 0, "1");
@@ -398,16 +398,16 @@ void GridFrame::SetRowLabelHorizAlignment( wxCommandEvent& WXUNUSED(ev) )
switch ( horiz )
{
case wxLEFT:
horiz = wxCENTRE;
case wxALIGN_LEFT:
horiz = wxALIGN_CENTRE;
break;
case wxCENTRE:
horiz = wxRIGHT;
case wxALIGN_CENTRE:
horiz = wxALIGN_RIGHT;
break;
case wxRIGHT:
horiz = wxLEFT;
case wxALIGN_RIGHT:
horiz = wxALIGN_LEFT;
break;
}
@@ -421,16 +421,16 @@ void GridFrame::SetRowLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) )
switch ( vert )
{
case wxTOP:
vert = wxCENTRE;
case wxALIGN_TOP:
vert = wxALIGN_CENTRE;
break;
case wxCENTRE:
vert = wxBOTTOM;
case wxALIGN_CENTRE:
vert = wxALIGN_BOTTOM;
break;
case wxBOTTOM:
vert = wxTOP;
case wxALIGN_BOTTOM:
vert = wxALIGN_TOP;
break;
}
@@ -445,16 +445,16 @@ void GridFrame::SetColLabelHorizAlignment( wxCommandEvent& WXUNUSED(ev) )
switch ( horiz )
{
case wxLEFT:
horiz = wxCENTRE;
case wxALIGN_LEFT:
horiz = wxALIGN_CENTRE;
break;
case wxCENTRE:
horiz = wxRIGHT;
case wxALIGN_CENTRE:
horiz = wxALIGN_RIGHT;
break;
case wxRIGHT:
horiz = wxLEFT;
case wxALIGN_RIGHT:
horiz = wxALIGN_LEFT;
break;
}
@@ -469,16 +469,16 @@ void GridFrame::SetColLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) )
switch ( vert )
{
case wxTOP:
vert = wxCENTRE;
case wxALIGN_TOP:
vert = wxALIGN_CENTRE;
break;
case wxCENTRE:
vert = wxBOTTOM;
case wxALIGN_CENTRE:
vert = wxALIGN_BOTTOM;
break;
case wxBOTTOM:
vert = wxTOP;
case wxALIGN_BOTTOM:
vert = wxALIGN_TOP;
break;
}