/***************************************************************************
 *   Copyright (C) 2004 by Hans Oischinger                                 *
 *   hans.oischinger@kdemail.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.                                   *
 *                                                                         *
 *   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.             *
 ***************************************************************************/
#ifndef DOCUMENTWIDGET_H
#define DOCUMENTWIDGET_H

#include "widgets/canvaswidget.h"
#include "coreinterfaces.h"

class DocumentElement;
class KCanvas;
class KRenderingDevice;
class LengthAttribute;
class QPoint;
class Matrix;
/**
The central widget, displaying the document
 
@author Hans Oischinger
*/
class DocumentWidget : public CanvasWidget,
      public ElementListenerInterface,
      public ElementSelectionListenerInterface
{
  Q_OBJECT
public:
  DocumentWidget(QWidget *parent = 0, const char *name = 0);
  ~DocumentWidget();

  // ElementListener Iface
  void onElementInserted( ElementNode* );
  void onElementRemoved( ElementNode* );
  void onElementModified( ElementNode* );
  void onSelectionModified();

protected:
  void showEvent(QShowEvent *);
  virtual void wheelEvent(QWheelEvent *);
  virtual void mouseMoveEvent(QMouseEvent *);
  virtual void mousePressEvent(QMouseEvent *);
  virtual void mouseReleaseEvent(QMouseEvent *);

public slots:
  /**
   * Sets all animVals and draws the tree
   * @param root Element to start from, if 0 we'll start from the root of the tree
   */
  void updateElementTree( ElementNode* root = 0 );
  void updateElementSelection();
};

#endif
