
#ifndef _DIREKTORPART_H_
#define _DIREKTORPART_H_

#include <kparts/part.h>
#include <kparts/factory.h>

class QWidget;
class QPainter;
class KURL;
class MainWindow;
/**
 * This is a "Part".  It that does all the real work in a KPart
 * application.
 *
 * @short Main Part
 * @author Hans Oischinger <hans.oischinger@kdemail.net>
 * @version 0.1
 */
class KastPart : public KParts::ReadWritePart
{
    Q_OBJECT
public:
    /**
     * Default constructor
     */
    KastPart(QWidget *parentWidget, const char *widgetName,
                    QObject *parent, const char *name);

    /**
     * Destructor
     */
    virtual ~KastPart();

    /**
     * This is a virtual function inherited from KParts::ReadWritePart.  
     * A shell will use this to inform this Part if it should act
     * read-only
     */
    virtual void setReadWrite(bool rw);

    /**
     * Reimplemented to disable and enable Save action
     */
    virtual void setModified(bool modified);

public slots:
    virtual bool openURL (const KURL &url);
    void setUnmodified();

protected:
    /**
     * This must be implemented by each part
     */
    virtual bool openFile();

    /**
     * This must be implemented by each read-write part
     */
    virtual bool saveFile();

    /**
     * Add a file to the recent files list
     */
    void addRecentFile(const KURL&);

protected slots:
    void fileOpen();
    void fileSaveAs();
    void editCut();
    void editDelete();
    void animationToggleRecord();
    void viewToggleStroke();

private:
    MainWindow *m_widget;
};

class KInstance;
class KAboutData;

class KastPartFactory : public KParts::Factory
{
    Q_OBJECT
public:
    KastPartFactory();
    virtual ~KastPartFactory();
    virtual KParts::Part* createPartObject( QWidget *parentWidget, const char *widgetName,
                                            QObject *parent, const char *name,
                                            const char *classname, const QStringList &args );
    static KInstance* self();
 
private:
    static KInstance* s_instance;
    static KAboutData* s_about;
};

#endif // _DIREKTORPART_H_
