/***************************************************************************
 *   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 "kmathtriggraph_part.h"

#include <kcomponentdata.h>

#include "triggraph.h"


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

    m_widget = new TrigGraph( parentWidget, widgetName );

    setWidget(m_widget);

    setXMLFile("kmathtriggraph_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*  KMathTrigGraphPartFactory::s_instance = 0L;
KAboutData* KMathTrigGraphPartFactory::s_about = 0L;

KMathTrigGraphPartFactory::KMathTrigGraphPartFactory()
    : KParts::Factory()
{
}

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

    s_instance = 0L;
}

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

KInstance* KMathTrigGraphPartFactory::instance()
{
    if( !s_instance )
    {
        s_about = new KAboutData("kmathtriggraphpart", I18N_NOOP("KMathTrigGraphPart"), "0.1");
        s_about->addAuthor("Trenton Carr", 0, "trentoncarr@telkomsa.net");
        s_instance = new KInstance(s_about);
    }
    return s_instance;
}

K_EXPORT_COMPONENT_FACTORY( libkmathtriggraphpart, KMathTrigGraphPartFactory )

#include "kmathtriggraph_part.moc"
