+++ /dev/null
-#ifndef __cpBaseQtApplication__Pipeline__Port__h__\r
-#define __cpBaseQtApplication__Pipeline__Port__h__\r
-\r
-#include <cpBaseQtApplication_Export.h>\r
-#include <QGraphicsPathItem>\r
-\r
-namespace cpBaseQtApplication\r
-{\r
- namespace Pipeline\r
- {\r
- class Block;\r
- class Connection;\r
-\r
- /**\r
- */\r
- class cpBaseQtApplication_EXPORT Port\r
- : public QObject,\r
- public QGraphicsPathItem\r
- {\r
- Q_OBJECT;\r
- public:\r
- typedef Port Self;\r
- typedef QGraphicsPathItem Superclass;\r
-\r
- enum { Type = QGraphicsItem::UserType + 1 };\r
-\r
- public:\r
- Port( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
- virtual ~Port( );\r
-\r
- void setBlock( Block* b );\r
- inline Block* block( ) const\r
- { return( this->m_Block ); }\r
-\r
- virtual void setName( const QString& n );\r
- virtual void setExtendedName( const QString& n );\r
- inline QString name( ) const\r
- { return( this->m_Label->toPlainText( ) ); }\r
- inline QString extendedName( ) const\r
- { return( this->m_ExtendedLabel->toPlainText( ) ); }\r
-\r
- inline int radius( ) const\r
- { return( this->m_Radius ); }\r
-\r
- inline bool isExtended( ) const\r
- { return( this->m_IsExtended ); }\r
- virtual void setExtend( bool extend );\r
-\r
- virtual bool isConnected( Port* other ) = 0;\r
- inline int type( ) const\r
- { return( this->Type ); }\r
-\r
- virtual void paint(\r
- QPainter* painter,\r
- const QStyleOptionGraphicsItem* option,\r
- QWidget* widget\r
- );\r
-\r
- protected:\r
- virtual void _updateLabels( ) { }\r
-\r
- protected:\r
- Block* m_Block;\r
-\r
- int m_Radius;\r
- int m_Margin;\r
- bool m_IsExtended;\r
-\r
- QGraphicsTextItem* m_Label;\r
- QGraphicsTextItem* m_ExtendedLabel;\r
- };\r
-\r
- /**\r
- */\r
- class cpBaseQtApplication_EXPORT NamePort\r
- : public Port\r
- {\r
- Q_OBJECT;\r
- public:\r
- typedef NamePort Self;\r
- typedef Port Superclass;\r
-\r
- enum { Type = Superclass::Type + 1 };\r
-\r
- public:\r
- NamePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
- virtual ~NamePort( );\r
-\r
- virtual bool isConnected( Port* other );\r
- inline int type( ) const\r
- { return( this->Type ); }\r
-\r
- protected:\r
- virtual void _updateLabels( );\r
- };\r
-\r
- /**\r
- */\r
- class cpBaseQtApplication_EXPORT InfoPort\r
- : public Port\r
- {\r
- Q_OBJECT;\r
- public:\r
- typedef InfoPort Self;\r
- typedef Port Superclass;\r
-\r
- enum { Type = Superclass::Type + 2 };\r
-\r
- public:\r
- InfoPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
- virtual ~InfoPort( );\r
-\r
- virtual bool isConnected( Port* other );\r
- inline int type( ) const\r
- { return( this->Type ); }\r
-\r
- protected:\r
- virtual void _updateLabels( );\r
- };\r
-\r
- /**\r
- */\r
- class cpBaseQtApplication_EXPORT InputPort\r
- : public Port\r
- {\r
- Q_OBJECT;\r
- public:\r
- typedef InputPort Self;\r
- typedef Port Superclass;\r
-\r
- enum { Type = Superclass::Type + 3 };\r
-\r
- public:\r
- InputPort(\r
- QGraphicsItem* parent,\r
- bool multiple,\r
- QGraphicsScene* scene = NULL\r
- );\r
- virtual ~InputPort( );\r
-\r
- virtual void setExtend( bool extend );\r
-\r
- virtual bool isConnected( Port* other );\r
- inline int type( ) const\r
- { return( this->Type ); }\r
-\r
- void setConnection( Connection* c );\r
- void removeConnection( Connection* c );\r
- inline unsigned int numberOfConnections( ) const\r
- { return( this->m_Connection.size( ) ); }\r
- inline Connection* connection( unsigned int i )\r
- { return( this->m_Connection[ i ] ); }\r
- inline const Connection* connection( unsigned int i ) const\r
- { return( this->m_Connection[ i ] ); }\r
- inline bool hasConnection( ) const\r
- { return( this->m_Connection.size( ) > 0 ); }\r
- inline bool isMultiple( ) const\r
- { return( this->m_IsMultiple ); }\r
-\r
- protected:\r
- QVariant itemChange( GraphicsItemChange change, const QVariant& value );\r
- virtual void _updateLabels( );\r
-\r
- protected:\r
- std::vector< Connection* > m_Connection;\r
- bool m_IsMultiple;\r
- };\r
-\r
- /**\r
- */\r
- class cpBaseQtApplication_EXPORT OutputPort\r
- : public Port\r
- {\r
- Q_OBJECT;\r
- public:\r
- typedef OutputPort Self;\r
- typedef Port Superclass;\r
-\r
- enum { Type = Superclass::Type + 4 };\r
-\r
- public:\r
- OutputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
- virtual ~OutputPort( );\r
-\r
- void removeConnection( Connection* c );\r
- virtual void setExtend( bool extend );\r
-\r
- virtual bool isConnected( Port* other );\r
- inline int type( ) const\r
- { return( this->Type ); }\r
-\r
- inline std::vector< Connection* >& connections( )\r
- { return( this->m_Connections ); }\r
- inline const std::vector< Connection* >& connections( ) const\r
- { return( this->m_Connections ); }\r
-\r
- signals:\r
- void viewData( const std::string& name, bool show );\r
-\r
- protected:\r
- QVariant itemChange( GraphicsItemChange change, const QVariant& value );\r
- virtual void _updateLabels( );\r
-\r
- virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent* evt );\r
-\r
- protected:\r
- std::vector< Connection* > m_Connections;\r
- };\r
-\r
- } // ecapseman\r
-\r
-} // ecapseman\r
-\r
-#endif // __cpBaseQtApplication__Pipeline__Port__h__\r
-\r
-// eof - $RCSfile$\r