/////////////////////////////////////////////////////////////////////////////
// Name:        xh_glistc.cpp
// Purpose:     XML resource for wxListCtrl
// Author:      Aleksandras Gluchovas
// Created:     2000/09/09
// RCS-ID:      $Id: xh_glistc.cpp,v 1.2 2001/04/19 21:09:25 georgetasker Exp $
// Copyright:   (c) 2000 Aleksandras Gluchovas
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////
 
#ifdef __GNUG__
#pragma implementation "xh_glistc.h"
#endif

// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

#include "wx/wspp/xh_glistc.h"
#include "wx/wspp/glist.h"

wxGenericListCtrlXmlHandler::wxGenericListCtrlXmlHandler() 
: wxXmlResourceHandler() 
{
    ADD_STYLE(wxLC_SORT_DESCENDING);
    AddWindowStyles();
}


wxObject *wxGenericListCtrlXmlHandler::DoCreateResource()
{ 
	wxGenericListCtrl* list = wxDynamicCast(m_Instance, wxGenericListCtrl);

	if ( list )

		list->Create( m_ParentAsWindow, 
					  GetID(),
					  GetPosition(),
					  GetSize(),
					  GetStyle(),
					  GetName() );
	else
		list = new wxGenericListCtrl(m_ParentAsWindow,
									 GetID(),
									 GetPosition(), GetSize(),
									 GetStyle(),
									 GetName());

	list->AddColumn( "First" );
	list->AddColumn( "Second" );
	wxListModel* model = new wxListModel();
	model->SetRowCount( 100 );

	list->SetModel( model );

    SetupWindow(list);
    
    return list;
}

bool wxGenericListCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
    return IsOfClass(node, wxT("wxGenericListCtrl"));
}