/***************************************************************************
                          kdcpreview.h  -  preview widget for file dialogs
                             -------------------
    begin                : Mon Aug 26 2002
    copyright            : (C) 2002 by Adam Tenderholt
    email                : atenderholt@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef _KDCPREVIEW_H
#define _KDCPREVIEW_H

#include <kpreviewwidgetbase.h>
#include <kurl.h>
#include <qwidget.h>
#include <qframe.h>
#include <qpixmap.h>
#include "render2d.h"


class KDCPreviewWidget : public QFrame {

  public:

    KDCPreviewWidget(QWidget* parent, const char* name=0);
    ~KDCPreviewWidget();

    void setFile(QString filename);
    void setRender2D(Render2D* render) { m_render=render;}
    void paintEvent(QPaintEvent*);

  private:
    Render2D* m_render;
    QString filename;
    QPixmap* m_pixmap;
};

class KDCPreview : public KPreviewWidgetBase {

  public:

    KDCPreview(QWidget *parent, const char *name=0);
    ~KDCPreview();

  public slots:

    void showPreview(const KURL& url);
    void clearPreview();
    void setRender2D(Render2D* render) {m_render=render;}

  protected:

    KURL m_url;
    KDCPreviewWidget* m_widget;
    Render2D* m_render;

};

#endif

//eof

