1 /*
2  * Patchbay Canvas engine using QGraphicsView/Scene
3  * Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
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  * 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  * For a full copy of the GNU General Public License see the COPYING file
16  */
17 
18 #ifndef CANVASLINEMOV_H
19 #define CANVASLINEMOV_H
20 
21 #include <QGraphicsLineItem>
22 
23 #include "abstractcanvasline.h"
24 
25 class QPainter;
26 
27 START_NAMESPACE_PATCHCANVAS
28 
29 class CanvasLineMov :
30     public AbstractCanvasLineMov,
31     public QGraphicsLineItem
32 {
33 public:
34     CanvasLineMov(PortMode port_mode, PortType port_type, QGraphicsItem* parent);
35 
36     virtual void deleteFromScene();
37 
38     virtual void updateLinePos(QPointF scenePos);
39 
40     virtual int type() const;
41 
42     // QGraphicsItem generic calls
setZValue(qreal z)43     virtual void setZValue(qreal z)
44     {
45         QGraphicsLineItem::setZValue(z);
46     }
47 
48 private:
49     PortMode m_port_mode;
50     PortType m_port_type;
51     int p_lineX;
52     int p_lineY;
53     int p_width;
54 
55     virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
56 };
57 
58 END_NAMESPACE_PATCHCANVAS
59 
60 #endif // CANVASLINEMOV_H
61