-void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset,
- wxRect cell, wxDC *dc, int state )
-{
- wxColour col = state & wxDATAVIEW_CELL_SELECTED
- ? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)
- : GetOwner()->GetOwner()->GetForegroundColour();
-
- wxDataViewItemAttr attr;
- attr.SetColour(col);
- RenderText(*dc, cell, wxALIGN_NOT, text, &attr, state, xoffset);
-}
-
-void
-wxDataViewCustomRenderer::RenderText(wxDC& dc,
- const wxRect& rect,
- int align,
- const wxString& text,
- const wxDataViewItemAttr *attr,
- int WXUNUSED(state),
- int xoffset)
-{
- wxDCTextColourChanger changeFg(dc);
- if ( attr && attr->HasColour() )
- changeFg.Set(attr->GetColour());
-
- wxDCFontChanger changeFont(dc);
- if ( attr && attr->HasFont() )
- {
- wxFont font(dc.GetFont());
- if ( attr->GetBold() )
- font.MakeBold();
- if ( attr->GetItalic() )
- font.MakeItalic();
-
- changeFont.Set(font);
- }
-
- wxRect rectText = rect;
- rectText.x += xoffset;
- rectText.width -= xoffset;
-
- dc.DrawLabel(text, rectText, align);
-}
-