/***************************************************************************
 *   Copyright (C) 2004 by Trenton Carr                                    *
 *   trenton.carr@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
 
#include "kmathline_part.h"

#include <kcomponentdata.h>

#include "lines.h"

KMathLinePart::KMathLinePart( QWidget *parentWidget, const char *widgetName,
                                  QObject *parent, const char *name )
    : KMathBasePart(parentWidget, widgetName, parent, name)
{
    setInstance( KMathLinePartFactory::instance() );

    m_widget = new Lines( parentWidget, widgetName );

    setWidget(m_widget);

    setXMLFile("kmathline_part.rc");
}


// It's usually safe to leave the factory code alone.. with the
// notable exception of the KAboutData data
#include <kaboutdata.h>
#include <klocale.h>

KInstance*  KMathLinePartFactory::s_instance = 0L;
KAboutData* KMathLinePartFactory::s_about = 0L;

KMathLinePartFactory::KMathLinePartFactory()
    : KParts::Factory()
{
}

KMathLinePartFactory::~KMathLinePartFactory()
{
    delete s_instance;
    delete s_about;

    s_instance = 0L;
}

KParts::Part* KMathLinePartFactory::createPartObject( QWidget *parentWidget, const char *widgetName,
                                                        QObject *parent, const char *name,
                                                        const char *classname, const QStringList &args )
{
    // Create an instance of our Part
    KMathLinePart* obj = new KMathLinePart( parentWidget, widgetName, parent, name );
    return obj;
}

KInstance* KMathLinePartFactory::instance()
{
    if( !s_instance )
    {
        s_about = new KAboutData("kmathlinepart", I18N_NOOP("KMathLinePart"), "0.3");
        s_about->addAuthor("Trenton Carr", 0, "trentoncarr@telkomsa.net");
        s_instance = new KInstance(s_about);
    }
    return s_instance;
}

K_EXPORT_COMPONENT_FACTORY( libkmathlinepart, KMathLinePartFactory )

#include "kmathline_part.moc"
