]> git.sesse.net Git - kdenlive/blob - src/onmonitoritems/rotoscoping/bpointitem.h
c910334e004c2b0e6c28c7a48cf45dfbebf1cb2a
[kdenlive] / src / onmonitoritems / rotoscoping / bpointitem.h
1 /***************************************************************************
2  *   Copyright (C) 2011 by Till Theato (root@ttill.de)                     *
3  *   This file is part of Kdenlive (www.kdenlive.org).                     *
4  *                                                                         *
5  *   Kdenlive 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  *   Kdenlive 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 Kdenlive.  If not, see <http://www.gnu.org/licenses/>.     *
17  ***************************************************************************/
18
19 #ifndef BPOINTITEM_H
20 #define BPOINTITEM_H
21
22 #include "beziercurve/bpoint.h"
23
24 #include <QtCore>
25 #include <QAbstractGraphicsShapeItem>
26
27 class QGraphicsView;
28
29 class BPointItem : public QAbstractGraphicsShapeItem
30 {
31 public:
32     explicit BPointItem(const BPoint &point, QGraphicsItem* parent = 0);
33
34     BPoint getPoint() const;
35     void setPoint(const BPoint &point);
36
37     enum { Type = UserType + 11 };
38     virtual int type() const;
39
40     QRectF boundingRect() const;
41     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
42
43     /** @brief Gets The action mode for the area @param pos +- 4. */
44     int getSelection(const QPointF &pos);
45
46 protected:
47     void mousePressEvent(QGraphicsSceneMouseEvent *event);
48     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
49     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
50     void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
51
52 private:
53     BPoint m_point;
54     int m_selection;
55     QGraphicsView *m_view;
56 };
57
58 #endif