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:
Vadim Zeitlin
2009-11-10 17:41:11 +00:00
parent 6eec70b984
commit 62265c2c67
12 changed files with 201 additions and 263 deletions

View File

@@ -44,17 +44,8 @@ public:
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
virtual bool RenderWithAttr(wxDC& dc,
const wxRect& rect,
int align,
const wxDataViewItemAttr *attr,
int state);
virtual bool Render(wxRect cell, wxDC *dc, int state)
{
return DummyRender(cell, dc, state);
}
wxSize GetSize() const;
virtual bool Render(wxRect cell, wxDC *dc, int state);
virtual wxSize GetSize() const;
// in-place editing
virtual bool HasEditorCtrl() const;
@@ -135,15 +126,7 @@ public:
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant& value ) const;
virtual bool RenderWithAttr(wxDC& dc,
const wxRect& rect,
int align,
const wxDataViewItemAttr *attr,
int state);
virtual bool Render(wxRect cell, wxDC *dc, int state)
{
return DummyRender(cell, dc, state);
}
virtual bool Render(wxRect cell, wxDC *dc, int state);
virtual wxSize GetSize() const;
private:
@@ -168,15 +151,7 @@ public:
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
virtual bool RenderWithAttr(wxDC& dc,
const wxRect& rect,
int align,
const wxDataViewItemAttr *attr,
int state);
virtual bool Render(wxRect cell, wxDC *dc, int state)
{
return DummyRender(cell, dc, state);
}
virtual bool Render(wxRect cell, wxDC *dc, int state);
virtual wxSize GetSize() const;
virtual bool HasEditorCtrl() const { return true; }