Adapt MSW's renderer's alignment to use column header's alignment by default

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-04-08 11:17:54 +00:00
parent d081739d4e
commit e51bf69961
4 changed files with 34 additions and 10 deletions

View File

@@ -641,6 +641,29 @@ wxDC *wxDataViewRenderer::GetDC()
return m_dc;
}
void wxDataViewRenderer::SetAlignment( int align )
{
m_align=align;
}
int wxDataViewRenderer::GetAlignment() const
{
return m_align;
}
int wxDataViewRenderer::CalculateAlignment() const
{
if (m_align == wxDVR_DEFAULT_ALIGNMENT)
{
if (GetOwner() == NULL)
return wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL;
return GetOwner()->GetAlignment() | wxALIGN_CENTRE_VERTICAL;
}
return m_align;
}
// ---------------------------------------------------------
// wxDataViewCustomRenderer
// ---------------------------------------------------------
@@ -2214,7 +2237,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
size.y = cell_rect.height;
wxRect item_rect(cell_rect.GetTopLeft(), size);
int align = cell->GetAlignment();
int align = cell->CalculateAlignment();
// horizontal alignment:
item_rect.x = cell_rect.x;