-// which to use. If a non-default attr object has one then it is used,
-// otherwise the default editor or renderer passed in is used. It should be
-// the default for the data type of the cell. If it is NULL (because the
-// table has a type that the grid does not have in its registry,) then the
-// grid's default editor or renderer is used.
-
-wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGridCellRenderer* def) const
-{
- if ((m_defGridAttr != this || def == NULL) && HasRenderer())
- return m_renderer;
- else if (def)
- return def;
- else if (m_defGridAttr != this)
- return m_defGridAttr->GetRenderer(NULL);
- else
- {
+// which attribute to use. If a non-default attr object has one then it is
+// used, otherwise the default editor or renderer is fetched from the grid and
+// used. It should be the default for the data type of the cell. If it is
+// NULL (because the table has a type that the grid does not have in its
+// registry,) then the grid's default editor or renderer is used.
+
+wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGrid* grid, int row, int col) const
+{
+ if ((m_defGridAttr != this || grid == NULL) && HasRenderer())
+ return m_renderer; // use local attribute
+
+ wxGridCellRenderer* renderer = NULL;
+ if (grid) // get renderer for the data type
+ renderer = grid->GetDefaultRendererForCell(row, col);
+
+ if (! renderer)
+ // if we still don't have one then use the grid default
+ renderer = m_defGridAttr->GetRenderer(NULL,0,0);
+
+ if (! renderer)