1 /***************************************************************************
2 * copyright (C) 2008 by Marco Gittler (g.marco@freenet.de) *
3 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef GRAPHICSSCENERECTMOVE_H
22 #define GRAPHICSSCENERECTMOVE_H
24 #include <QGraphicsScene>
26 enum resizeModes {NoResize, TopLeft, BottomLeft, TopRight, BottomRight, Left, Right, Up, Down};
27 enum TITLETOOL { TITLE_SELECT = 0, TITLE_RECTANGLE = 1, TITLE_TEXT = 2, TITLE_IMAGE = 3 };
29 class GraphicsSceneRectMove: public QGraphicsScene
33 GraphicsSceneRectMove(QObject* parent = 0);
35 void setSelectedItem(QGraphicsItem *item);
36 void setScale(double s);
37 void setZoom(double s);
38 void setTool(TITLETOOL tool);
40 void clearTextSelection();
43 virtual void keyPressEvent(QKeyEvent * keyEvent);
44 virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
45 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
46 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* e);
47 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
48 virtual void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);
51 void setCursor(QCursor);
53 QGraphicsItem* m_selectedItem;
54 resizeModes m_resizeMode;
55 QPointF m_sceneClickPoint;
62 void newRect(QGraphicsRectItem *);
63 void newText(QGraphicsTextItem *);
64 void actionFinished();