wxGridCellAttr *attrrow = m_data->m_rowAttrs.GetAttr(row);
wxGridCellAttr *attrcol = m_data->m_colAttrs.GetAttr(col);
- if((attrcell != attrrow) && (attrrow !=attrcol) && (attrcell != attrcol)){
- // Two or move are non NULL
+ if((attrcell != attrrow) && (attrrow != attrcol) && (attrcell != attrcol)){
+ // Two or more are non NULL
attr = new wxGridCellAttr;
attr->SetKind(wxGridCellAttr::Merged);
//m_data->m_mergeAttr.SetAttr(attr, row, col);
}
else
- {
+ {
// one or none is non null return it or null.
if(attrrow) attr = attrrow;
- if(attrcol) attr = attrcol;
- if(attrcell) attr = attrcell;
+ if(attrcol)
+ {
+ if(attr)
+ attr->DecRef();
+ attr = attrcol;
+ }
+ if(attrcell)
+ {
+ if(attr)
+ attr->DecRef();
+ attr = attrcell;
+ }
}
}
break;
attr = m_data->m_cellAttrs.GetAttr(row, col);
break;
case (wxGridCellAttr::Col):
- attr = m_data->m_colAttrs.GetAttr(col);
+ attr = m_data->m_colAttrs.GetAttr(col);
break;
case (wxGridCellAttr::Row):
- attr = m_data->m_rowAttrs.GetAttr(row);
+ attr = m_data->m_rowAttrs.GetAttr(row);
break;
default:
// unused as yet...
wxCONSTRUCTOR_5( wxGrid , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
/*
- TODO : Expose more information of a list's layout etc. via appropriate objects (à la NotebookPageInfo)
+ TODO : Expose more information of a list's layout etc. via appropriate objects (\81à la NotebookPageInfo)
*/
#else
IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
m_defaultCellAttr->SetFont(font);
}
+
+// For editors and renderers the type registry takes precedence over the
+// default attr, so we need to register the new editor/renderer for the string
+// data type in order to make setting a default editor/renderer appear to
+// work correctly.
+
void wxGrid::SetDefaultRenderer(wxGridCellRenderer *renderer)
{
- m_defaultCellAttr->SetRenderer(renderer);
+ RegisterDataType(wxGRID_VALUE_STRING,
+ renderer,
+ GetDefaultEditorForType(wxGRID_VALUE_STRING));
}
void wxGrid::SetDefaultEditor(wxGridCellEditor *editor)
{
- m_defaultCellAttr->SetEditor(editor);
+ RegisterDataType(wxGRID_VALUE_STRING,
+ GetDefaultRendererForType(wxGRID_VALUE_STRING),
+ editor);
}
// ----------------------------------------------------------------------------