wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
- virtual ~wxDataViewIconTextRenderer();
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
- virtual bool Render( wxRect cell, wxDC *dc, int state );
+ 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 wxSize GetSize() const;
virtual bool HasEditorCtrl() const { return true; }
bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
wxDataViewItemAttr &attr )
{
- if (col != 2)
- return false;
-
- // do what the labels defined above hint at
- switch ( row % 5 )
+ switch ( col )
{
case 0:
- attr.SetColour(*wxBLUE);
- break;
+ return false;
case 1:
- attr.SetColour(*wxGREEN);
+ if ( !(row % 2) )
+ return false;
+ attr.SetColour(*wxLIGHT_GREY);
break;
case 2:
- attr.SetColour(*wxRED);
- break;
-
- case 3:
- attr.SetColour(*wxCYAN);
- attr.SetBold(true);
+ // do what the labels defined above hint at
+ switch ( row % 5 )
+ {
+ case 0:
+ attr.SetColour(*wxBLUE);
+ break;
+
+ case 1:
+ attr.SetColour(*wxGREEN);
+ break;
+
+ case 2:
+ attr.SetColour(*wxRED);
+ break;
+
+ case 3:
+ attr.SetColour(*wxCYAN);
+ attr.SetBold(true);
+ break;
+
+ case 4:
+ return false;
+ }
break;
-
- case 4:
- return false;
}
return true;
SetAlignment(align);
}
-wxDataViewIconTextRenderer::~wxDataViewIconTextRenderer()
-{
-}
-
bool wxDataViewIconTextRenderer::SetValue( const wxVariant &value )
{
m_value << value;
return false;
}
-bool wxDataViewIconTextRenderer::Render( wxRect cell, wxDC *dc, int state )
+bool
+wxDataViewIconTextRenderer::RenderWithAttr(wxDC& dc,
+ const wxRect& rect,
+ int align,
+ const wxDataViewItemAttr *attr,
+ int state)
{
int xoffset = 0;
- const wxIcon &icon = m_value.GetIcon();
- if (icon.IsOk())
+
+ const wxIcon& icon = m_value.GetIcon();
+ if ( icon.IsOk() )
{
- dc->DrawIcon( icon, cell.x, cell.y + ((cell.height - icon.GetHeight()) / 2));
- xoffset = icon.GetWidth()+4;
+ dc.DrawIcon(icon, rect.x, rect.y + (rect.height - icon.GetHeight())/2);
+ xoffset = icon.GetWidth()+4;
}
- RenderText( m_value.GetText(), xoffset, cell, dc, state );
+ RenderText(dc, rect, align, m_value.GetText(), attr, state, xoffset);
return true;
}