LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / uavobjectwidgetutils / mixercurvepoint.h
blob1b6c74dcfaa0e7c0d99b05328ee785438a63c1ec
1 /**
2 ******************************************************************************
4 * @file mixercurvepoint.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup UAVObjectWidgetUtils Plugin
9 * @{
10 * @brief Utility plugin for UAVObject to Widget relation management
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef MIXERCURVEPOINT_H
29 #define MIXERCURVEPOINT_H
31 #include <QGraphicsItem>
32 #include <QColor>
33 #include <QList>
34 #include <QFont>
35 #include "uavobjectwidgetutils_global.h"
37 class Edge;
38 class MixerCurveWidget;
39 QT_BEGIN_NAMESPACE
40 class QGraphicsSceneMouseEvent;
41 QT_END_NAMESPACE
44 class UAVOBJECTWIDGETUTILS_EXPORT MixerNode : public QObject, public QGraphicsItem {
45 Q_OBJECT
46 Q_INTERFACES(QGraphicsItem)
47 public:
48 MixerNode(MixerCurveWidget *graphWidget, QGraphicsItem *graphItem);
49 void addEdge(Edge *edge);
50 QList<Edge *> edges() const;
52 enum { Type = UserType + 10 };
53 int type() const
55 return Type;
58 void verticalMove(bool flag);
60 void setPositiveColor(QColor color = "#609FF2")
62 m_positiveColor = color;
65 void setNegativeColor(QColor color = "#EF5F5F")
67 m_negativeColor = color;
70 void setAlpha(qreal alpha)
72 m_alpha = alpha;
75 void setImage(QImage img)
77 m_image = img;
80 void setDrawNode(bool draw)
82 m_drawNode = draw;
85 void setDrawText(bool draw)
87 m_drawText = draw;
90 QRectF boundingRect() const;
91 QPainterPath shape() const;
92 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
94 double value();
96 protected:
97 QVariant itemChange(GraphicsItemChange change, const QVariant &val);
99 void mousePressEvent(QGraphicsSceneMouseEvent *event);
100 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
102 private:
103 QList<Edge *> m_edgeList;
104 QPointF m_newPos;
105 MixerCurveWidget *m_graph;
106 QGraphicsItem *m_graphItem;
108 qreal m_alpha;
109 QColor m_positiveColor;
110 QColor m_neutralColor;
111 QColor m_negativeColor;
112 QColor m_disabledColor;
113 QColor m_disabledTextColor;
115 QImage m_image;
117 bool m_vertical;
118 bool m_drawNode;
119 bool m_drawText;
120 int m_index;
123 #endif // MIXERCURVEPOINT_H