#ifndef __PIPELINEEDITOR__NODE__H__ #define __PIPELINEEDITOR__NODE__H__ #include #include #include #include #include // Some forward declarations class QGraphicsSceneMouseEvent; class QGraphicsSceneHoverEvent; // Some forward declarations namespace cpPlugins { namespace Interface { class Object; } } namespace PipelineEditor { // Some other forward declarations class Edge; class GraphCanvas; /** */ class Node : public QGraphicsItem { public: Node( GraphCanvas* canvas, cpPlugins::Interface::Object* object ); virtual ~Node( ); void addEdge( Edge* edge ); QList< Edge* > edges( ) const; void updateRepresentation( ); QRectF boundingRect( ) const; QPainterPath shape( ) const; void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget ); void moveBy(qreal dx, qreal dy) { std::cout << "move: " << dx << " " << dy << std::endl; this->QGraphicsItem::moveBy( dx, dy ); } protected: QVariant itemChange( GraphicsItemChange change, const QVariant& value ); void mousePressEvent( QGraphicsSceneMouseEvent* event ); void mouseReleaseEvent( QGraphicsSceneMouseEvent* event ); void mouseDoubleClickEvent( QGraphicsSceneMouseEvent* event ); void hoverMoveEvent( QGraphicsSceneHoverEvent* event ); void hoverLeaveEvent( QGraphicsSceneHoverEvent* event ); void dragMoveEvent( QGraphicsSceneDragDropEvent* event ); void dragLeaveEvent( QGraphicsSceneDragDropEvent* event ); void dropEvent( QGraphicsSceneDragDropEvent* event ); void _selectPort( const QPointF& pos ); void _deselectPort( ); private: GraphCanvas* m_Canvas; QList< Edge* > m_Edges; cpPlugins::Interface::Object* m_Object; // Graphical objects QString m_Label; QRectF m_Bounds; std::set< std::string > m_Inputs; std::set< std::string > m_Outputs; std::map< std::string, QRectF > m_InputPorts; std::map< std::string, QRectF > m_OutputPorts; // Interaction objects const QRectF* m_SelectedPort; bool m_SelectedPortIsInput; bool m_DraggingPort; }; } // ecapseman #endif // __PIPELINEEDITOR__NODE__H__ // eof - $RCSfile$