/***************************************************************************
 * drawingitem.h: implementation of DrawingItem class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2007 the KTabEdit development team <mrgwen@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.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#ifndef DRAWINGITEM_H
#define DRAWINGITEM_H

#include <QBrush>
#include <QFont>
#include <QString>

#include "unit.h"

#include "cm.h"
#include "pixel.h"
#include "qpointcm.h"
#include "qrectcm.h"

class QGraphicsItem;
class QGraphicsScene;

class QCanvasEllipseCm;
class QCanvasTextCm;

class DrawingItem : public Unit {
public:
	DrawingItem(uint dpi);
	virtual ~DrawingItem();
	
	virtual void setGraphicsScene(QGraphicsScene* graphicsScene);
	virtual QGraphicsScene* graphicsScene() const;
	
	virtual void setPosition(const QPointCm& position);
	virtual QPointCm position() const;
	virtual Cm positionX() const;
	virtual Cm positionY() const;
	virtual void addToPosition(const Cm& width,  const Cm& height);
	virtual void addWidthToPosition(const Cm& width);
	virtual void addHeightToPosition(const Cm& height);
	
	virtual void show() = 0;
	virtual void hide() = 0;
	virtual bool isVisible() const;
	
	virtual QRectCm boundingRect() const = 0;
	virtual Cm height() const = 0;
	virtual Cm width() const = 0;
	
	virtual void addItemToScene(QGraphicsItem* item);
	virtual void addEllipseItemToScene(QCanvasEllipseCm* item, const QBrush& brush, const Cm& x, const Cm& y, const Cm& width, const Cm& height);
	virtual void addTextItemToScene(QCanvasTextCm* item, const QString& text, const QFont& font, const Cm& x, const Cm& y);
	virtual void addTextItemToSceneFromPoint(QCanvasTextCm* item, const QString& text, const QFont& font, const QPointCm& point);
	virtual void drawCanvas(const QPointCm& position, DrawingItem* canvasItem);
private:
	QGraphicsScene* mGraphicsScene;
	QPointCm mPosition;
	bool mIsVisible;
};

#endif
