- // then look for the col attr (col attributes are more common than
- // the row ones, hence they have priority)
- attr = m_data->m_colAttrs.GetAttr(col);
- }
-
- if ( !attr )
+ case (wxGridCellAttr::Any):
+ //Get cached merge attributes.
+ // Currenlty not used as no cache implemented as not mutiable
+ // attr = m_data->m_mergeAttr.GetAttr(row, col);
+ if(!attr)
+ {
+ //Basicaly implement old version.
+ //Also check merge cache, so we don't have to re-merge every time..
+ wxGridCellAttr *attrcell = (wxGridCellAttr *)NULL,
+ *attrrow = (wxGridCellAttr *)NULL,
+ *attrcol = (wxGridCellAttr *)NULL;
+
+ attrcell = m_data->m_cellAttrs.GetAttr(row, col);
+ attrcol = m_data->m_colAttrs.GetAttr(col);
+ attrrow = m_data->m_rowAttrs.GetAttr(row);
+
+ if((attrcell != attrrow) && (attrrow !=attrcol) && (attrcell != attrcol)){
+ // Two or move are non NULL
+ attr = new wxGridCellAttr;
+ attr->SetKind(wxGridCellAttr::Merged);
+
+ //Order important..
+ if(attrcell){
+ attr->MergeWith(attrcell);
+ attrcell->DecRef();
+ }
+ if(attrcol){
+ attr->MergeWith(attrcol);
+ attrcol->DecRef();
+ }
+ if(attrrow){
+ attr->MergeWith(attrrow);
+ attrrow->DecRef();
+ }
+ //store merge attr if cache implemented
+ //attr->IncRef();
+ //m_data->m_mergeAttr.SetAttr(attr, row, col);
+ }
+ else