+{
+ if ( m_class == LISTITEM_CLASS_NAME )
+ {
+ HandleListItem();
+ }
+ else if ( m_class == LISTCOL_CLASS_NAME )
+ {
+ HandleListCol();
+ }
+ else
+ {
+ wxASSERT_MSG( m_class == LISTCTRL_CLASS_NAME,
+ "can't handle unknown node" );
+
+ return HandleListCtrl();
+ }
+
+ return m_parentAsWindow;
+}
+
+bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
+{
+ return IsOfClass(node, LISTCTRL_CLASS_NAME) ||
+ IsOfClass(node, LISTITEM_CLASS_NAME) ||
+ IsOfClass(node, LISTCOL_CLASS_NAME);
+}
+
+void wxListCtrlXmlHandler::HandleCommonItemAttrs(wxListItem& item)
+{
+ if (HasParam(wxT("align")))
+ item.SetAlign((wxListColumnFormat)GetStyle(wxT("align")));
+ if (HasParam(wxT("text")))
+ item.SetText(GetText(wxT("text")));
+}
+
+void wxListCtrlXmlHandler::HandleListCol()
+{
+ wxListCtrl * const list = wxDynamicCast(m_parentAsWindow, wxListCtrl);
+ wxCHECK_RET( list, "must have wxListCtrl parent" );
+
+ if ( !list->HasFlag(wxLC_REPORT) )
+ {
+ ReportError("Only report mode list controls can have columns.");
+ return;
+ }
+
+ wxListItem item;
+
+ HandleCommonItemAttrs(item);
+ if (HasParam(wxT("width")))
+ item.SetWidth((int)GetLong(wxT("width")));
+
+ list->InsertColumn(list->GetColumnCount(), item);
+}
+
+void wxListCtrlXmlHandler::HandleListItem()
+{
+ wxListCtrl * const list = wxDynamicCast(m_parentAsWindow, wxListCtrl);
+ wxCHECK_RET( list, "must have wxListCtrl parent" );
+
+ wxListItem item;
+
+ HandleCommonItemAttrs(item);
+
+ if (HasParam(wxT("bg")))
+ item.SetBackgroundColour(GetColour(wxT("bg")));
+ if (HasParam(wxT("col")))
+ item.SetColumn((int)GetLong(wxT("col")));
+ if (HasParam(wxT("data")))
+ item.SetData(GetLong(wxT("data")));
+ if (HasParam(wxT("font")))
+ item.SetFont(GetFont());
+ if (HasParam(wxT("state")))
+ item.SetState(GetStyle(wxT("state")));
+ if (HasParam(wxT("textcolour")))
+ item.SetTextColour(GetColour(wxT("textcolour")));
+ if (HasParam(wxT("textcolor")))
+ item.SetTextColour(GetColour(wxT("textcolor")));
+
+ // the list control icon style, may be 0
+ int image;
+ if ( list->HasFlag(wxLC_ICON) )
+ image = GetImageIndex(list, wxIMAGE_LIST_NORMAL);
+ else if ( list->HasFlag(wxLC_SMALL_ICON) )
+ image = GetImageIndex(list, wxIMAGE_LIST_SMALL);
+ else
+ image = wxNOT_FOUND;
+
+ if ( image != wxNOT_FOUND )
+ item.SetImage(image);
+
+ // append the list item to the control
+ item.SetId(list->GetItemCount());
+
+ list->InsertItem(item);
+}
+
+wxListCtrl *wxListCtrlXmlHandler::HandleListCtrl()