]> git.sesse.net Git - kdenlive/blob - src/graphicsscenerectmove.h
Krazy fixes: cleanup all headers
[kdenlive] / src / graphicsscenerectmove.h
1 /***************************************************************************
2  *   copyright (C) 2008 by Marco Gittler                                   *
3  *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
4  *                                                                         *
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.                                   *
9  *                                                                         *
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.                          *
14  *                                                                         *
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  ***************************************************************************/
20
21 #ifndef GRAPHICSSCENERECTMOVE_H
22 #define GRAPHICSSCENERECTMOVE_H
23
24 #include <QGraphicsScene>
25
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 };
28
29 class GraphicsSceneRectMove: public QGraphicsScene {
30     Q_OBJECT
31 public:
32     GraphicsSceneRectMove(QObject* parent = 0);
33
34     void setSelectedItem(QGraphicsItem *item);
35     void setScale(double s);
36     void setZoom(double s);
37     void setTool(TITLETOOL tool);
38     TITLETOOL tool();
39     void clearTextSelection();
40
41 protected:
42     virtual void keyPressEvent(QKeyEvent * keyEvent);
43     virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
44     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
45     virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* e);
46     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
47     virtual void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);
48
49 private:
50     void setCursor(QCursor);
51     double zoom;
52     QGraphicsItem* m_selectedItem;
53     resizeModes resizeMode;
54     QPointF m_sceneClickPoint;
55     TITLETOOL m_tool;
56     QPoint m_clickPoint;
57
58 signals:
59     void itemMoved();
60     void sceneZoom(bool);
61     void newRect(QGraphicsRectItem *);
62     void newText(QGraphicsTextItem *);
63     void actionFinished();
64 };
65
66 #endif