- item.SetTextColour(oldItem->GetTextColour());
- item.SetBackgroundColour(oldItem->GetBackgroundColour());
- item.SetFont(oldItem->GetFont());
+ if (oldItem)
+ {
+ long mask = item.GetMask();
+ if ( !mask )
+ // by default, get everything for backwards compatibility
+ mask = -1;
+
+ if ( mask & wxLIST_MASK_TEXT )
+ item.SetText(oldItem->GetText());
+ if ( mask & wxLIST_MASK_IMAGE )
+ item.SetImage(oldItem->GetImage());
+ if ( mask & wxLIST_MASK_DATA )
+ item.SetData(oldItem->GetData());
+ if ( mask & wxLIST_MASK_STATE )
+ item.SetState(oldItem->GetState());
+ if ( mask & wxLIST_MASK_WIDTH )
+ item.SetWidth(oldItem->GetWidth());
+ if ( mask & wxLIST_MASK_FORMAT )
+ item.SetAlign(oldItem->GetAlign());
+
+ item.SetTextColour(oldItem->GetTextColour());
+ item.SetBackgroundColour(oldItem->GetBackgroundColour());
+ item.SetFont(oldItem->GetFont());
+ }