// -*- c++ -*-

/*
 *  Copyright (C) 2001-2003, Richard J. Moore <rich@kde.org>
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to
 *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *  Boston, MA 02111-1307, USA.
 */

#ifndef KJSEMBEDPARTIMP_H
#define KJSEMBEDPARTIMP_H

#include <qstringlist.h>

#include <kparts/part.h>
#include <kjs/interpreter.h>
#include <kjs/object.h>
#include <kjsembed/jsbinding.h>
#include <kjsembed/xmlactionclient.h>
#include <kjsembed/kjsembedpart.h>

/**
 * Namespace containing the KJSEmbed library.
 */
namespace KJSEmbed {
namespace Bindings {

/**
 * Implements KJS bindings for KJSEmbedPart.
 */
class KJSEmbedPartImp : public KJS::ObjectImp
{
public:
    /** Identifiers for the various methods. */
    enum MethodId {
	MethodPrint, MethodPrintLn, MethodWarn,
	MethodReadLine, MethodReadFile,
	MethodCreate, MethodLoadUI, MethodLoadScript,
	ConstructImage, ConstructTextStream, ConstructQObject,
	MethodDumpObject,
	CustomMethod=0x1000
    };

    KJSEmbedPartImp( KJSEmbedPart *part, int id, const QString &param=QString::null );
    ~KJSEmbedPartImp();

    QString parameter() const { return param; }

    virtual bool implementsCall() const { return true; }
    virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );

    virtual bool implementsConstruct() const { return true; }
    virtual KJS::Object construct( KJS::ExecState *exec, const KJS::List &args );
    
private:
    KJSEmbedPart *part;
    int id;
    QString param;
};

} // namespace KJSEmbed::Bindings
}; // namespace KJSEmbed

#endif // KJSEMBEDPARTIMP_H

// Local Variables:
// c-basic-offset: 4
// End:
