Allow custom wxDataViewCtrl renderers to easily use attributes.
Set up the DC passed to wxDataViewCustomRenderer::Render() to use the font and colour defined by the item attribute by default so that any calls to RenderText() from it will use them automatically. Also added public wxDataViewCustomRenderer::GetAttr() to allow retrieving the attribute explicitly in Render(). The column using custom renderer in the dataview sample now works as expected in the generic version; the native ones will be corrected in the upcoming commits. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -303,15 +303,6 @@ wxDataViewCustomRenderer::~wxDataViewCustomRenderer()
|
||||
delete m_DCPtr;
|
||||
}
|
||||
|
||||
void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state )
|
||||
{
|
||||
wxDataViewCtrl *view = GetOwner()->GetOwner();
|
||||
|
||||
wxColour col = (state & wxDATAVIEW_CELL_SELECTED) ? *wxWHITE : view->GetForegroundColour();
|
||||
dc->SetTextForeground(col);
|
||||
dc->DrawText( text, cell.x + xoffset, cell.y + ((cell.height - dc->GetCharHeight()) / 2));
|
||||
}
|
||||
|
||||
wxDC* wxDataViewCustomRenderer::GetDC()
|
||||
{
|
||||
if ((m_DCPtr == NULL) && (GetOwner() != NULL) && (GetOwner()->GetOwner() != NULL))
|
||||
|
Reference in New Issue
Block a user