]> git.sesse.net Git - kdenlive/blob - src/graphicsscenerectmove.h
Fix label
[kdenlive] / src / graphicsscenerectmove.h
1 /***************************************************************************
2  *   copyright (C) 2008 by Marco Gittler (g.marco@freenet.de)                                  *
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 {
31     Q_OBJECT
32 public:
33     GraphicsSceneRectMove(QObject* parent = 0);
34
35     void setSelectedItem(QGraphicsItem *item);
36     void setScale(double s);
37     void setZoom(double s);
38     void setTool(TITLETOOL tool);
39     TITLETOOL tool() const;
40     void clearTextSelection();
41
42 public slots:
43     void slotUpdateFontSize(int s);
44
45 protected:
46     virtual void keyPressEvent(QKeyEvent * keyEvent);
47     virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
48     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
49     virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* e);
50     /** @brief Resizes and moves items */
51     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
52     virtual void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);
53
54 private:
55     void setCursor(QCursor);
56     void setResizeCursor(qreal angle);
57     double m_zoom;
58     QGraphicsItem* m_selectedItem;
59     resizeModes m_resizeMode;
60     QPointF m_sceneClickPoint;
61     TITLETOOL m_tool;
62     QPoint m_clickPoint;
63     int m_fontSize;
64
65 signals:
66     void itemMoved();
67     void sceneZoom(bool);
68     void newRect(QGraphicsRectItem *);
69     void newText(QGraphicsTextItem *);
70     void actionFinished();
71     void doubleClickEvent();
72 };
73
74 #endif