1 #ifndef __cpBaseQtApplication__Pipeline__Port__h__
\r
2 #define __cpBaseQtApplication__Pipeline__Port__h__
\r
4 #include <cpBaseQtApplication_Export.h>
\r
5 #include <QGraphicsPathItem>
\r
7 namespace cpBaseQtApplication
\r
16 class cpBaseQtApplication_EXPORT Port
\r
18 public QGraphicsPathItem
\r
23 typedef QGraphicsPathItem Superclass;
\r
25 enum { Type = QGraphicsItem::UserType + 1 };
\r
28 Port( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
31 void setBlock( Block* b );
\r
32 inline Block* block( ) const
\r
33 { return( this->m_Block ); }
\r
35 virtual void setName( const QString& n );
\r
36 virtual void setExtendedName( const QString& n );
\r
37 inline QString name( ) const
\r
38 { return( this->m_Label->toPlainText( ) ); }
\r
39 inline QString extendedName( ) const
\r
40 { return( this->m_ExtendedLabel->toPlainText( ) ); }
\r
42 inline int radius( ) const
\r
43 { return( this->m_Radius ); }
\r
45 inline bool isExtended( ) const
\r
46 { return( this->m_IsExtended ); }
\r
47 virtual void setExtend( bool extend );
\r
49 virtual bool isConnected( Port* other ) = 0;
\r
50 inline int type( ) const
\r
51 { return( this->Type ); }
\r
55 const QStyleOptionGraphicsItem* option,
\r
60 virtual void _updateLabels( ) { }
\r
69 QGraphicsTextItem* m_Label;
\r
70 QGraphicsTextItem* m_ExtendedLabel;
\r
75 class cpBaseQtApplication_EXPORT NamePort
\r
80 typedef NamePort Self;
\r
81 typedef Port Superclass;
\r
83 enum { Type = Superclass::Type + 1 };
\r
86 NamePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
87 virtual ~NamePort( );
\r
89 virtual bool isConnected( Port* other );
\r
90 inline int type( ) const
\r
91 { return( this->Type ); }
\r
94 virtual void _updateLabels( );
\r
99 class cpBaseQtApplication_EXPORT InfoPort
\r
104 typedef InfoPort Self;
\r
105 typedef Port Superclass;
\r
107 enum { Type = Superclass::Type + 2 };
\r
110 InfoPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
111 virtual ~InfoPort( );
\r
113 virtual bool isConnected( Port* other );
\r
114 inline int type( ) const
\r
115 { return( this->Type ); }
\r
118 virtual void _updateLabels( );
\r
123 class cpBaseQtApplication_EXPORT InputPort
\r
128 typedef InputPort Self;
\r
129 typedef Port Superclass;
\r
131 enum { Type = Superclass::Type + 3 };
\r
135 QGraphicsItem* parent,
\r
137 QGraphicsScene* scene = NULL
\r
139 virtual ~InputPort( );
\r
141 virtual void setExtend( bool extend );
\r
143 virtual bool isConnected( Port* other );
\r
144 inline int type( ) const
\r
145 { return( this->Type ); }
\r
147 void setConnection( Connection* c );
\r
148 void removeConnection( Connection* c );
\r
149 inline unsigned int numberOfConnections( ) const
\r
150 { return( this->m_Connection.size( ) ); }
\r
151 inline Connection* connection( unsigned int i )
\r
152 { return( this->m_Connection[ i ] ); }
\r
153 inline const Connection* connection( unsigned int i ) const
\r
154 { return( this->m_Connection[ i ] ); }
\r
155 inline bool hasConnection( ) const
\r
156 { return( this->m_Connection.size( ) > 0 ); }
\r
157 inline bool isMultiple( ) const
\r
158 { return( this->m_IsMultiple ); }
\r
161 QVariant itemChange( GraphicsItemChange change, const QVariant& value );
\r
162 virtual void _updateLabels( );
\r
165 std::vector< Connection* > m_Connection;
\r
171 class cpBaseQtApplication_EXPORT OutputPort
\r
176 typedef OutputPort Self;
\r
177 typedef Port Superclass;
\r
179 enum { Type = Superclass::Type + 4 };
\r
182 OutputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
183 virtual ~OutputPort( );
\r
185 void removeConnection( Connection* c );
\r
186 virtual void setExtend( bool extend );
\r
188 virtual bool isConnected( Port* other );
\r
189 inline int type( ) const
\r
190 { return( this->Type ); }
\r
192 inline std::vector< Connection* >& connections( )
\r
193 { return( this->m_Connections ); }
\r
194 inline const std::vector< Connection* >& connections( ) const
\r
195 { return( this->m_Connections ); }
\r
198 void viewData( const std::string& name, bool show );
\r
201 QVariant itemChange( GraphicsItemChange change, const QVariant& value );
\r
202 virtual void _updateLabels( );
\r
204 virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent* evt );
\r
207 std::vector< Connection* > m_Connections;
\r
214 #endif // __cpBaseQtApplication__Pipeline__Port__h__
\r