/*
 * Copyright 2009-2010  Stefan Gehn <stefan@srcbox.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, see <http://www.gnu.org/licenses/>.
 */

#ifndef PHOTOPAGEWIDGETS_HPP_
#define PHOTOPAGEWIDGETS_HPP_

#include <qobject.h>
#include <qgraphicswidget.h>
#include <qgraphicssceneevent.h>


class RectWidget : public QGraphicsWidget
{
	Q_OBJECT
public:
	RectWidget(QGraphicsItem *parent);
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
};


class EdgeWidget : public QGraphicsWidget
{
	Q_OBJECT
public:
	enum EdgeSide { Left, Right };

	EdgeWidget(EdgeSide side, QGraphicsItem *parent);
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

	Q_SIGNAL void activated();

protected:
	void mousePressEvent(QGraphicsSceneMouseEvent *event);
	void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
	void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

private:
	EdgeSide mSide;
	QPointF mStartPos;
};


class NumberWidget : public QGraphicsWidget
{
	Q_OBJECT
public:
	NumberWidget(QGraphicsItem * parent);
	void setNumber(int number);
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

private:
	int mNumber;
};

#endif /* PHOTOPAGEWIDGETS_HPP_ */
