1 /* Copyright (c) 2012, STANISLAW ADASZEWSKI
\r
4 Redistribution and use in source and binary forms, with or without
\r
5 modification, are permitted provided that the following conditions are met:
\r
6 * Redistributions of source code must retain the above copyright
\r
7 notice, this list of conditions and the following disclaimer.
\r
8 * Redistributions in binary form must reproduce the above copyright
\r
9 notice, this list of conditions and the following disclaimer in the
\r
10 documentation and/or other materials provided with the distribution.
\r
11 * Neither the name of STANISLAW ADASZEWSKI nor the
\r
12 names of its contributors may be used to endorse or promote products
\r
13 derived from this software without specific prior written permission.
\r
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
\r
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
\r
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
18 DISCLAIMED. IN NO EVENT SHALL STANISLAW ADASZEWSKI BE LIABLE FOR ANY
\r
19 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
\r
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
\r
22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 #ifndef __PIPELINEEDITOR__QNEPORT__H__
\r
28 #define __PIPELINEEDITOR__QNEPORT__H__
\r
30 #include <QGraphicsPathItem>
\r
32 namespace PipelineEditor
\r
35 class QNEConnection;
\r
40 : public QGraphicsPathItem
\r
43 typedef QNEPort Self;
\r
44 typedef QGraphicsPathItem Superclass;
\r
46 enum { Type = QGraphicsItem::UserType + 1 };
\r
49 QNEPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
50 virtual ~QNEPort( );
\r
52 void setBlock( QNEBlock* b );
\r
53 inline QNEBlock* block( ) const
\r
54 { return( this->m_Block ); }
\r
56 virtual void setName( const QString& n );
\r
57 inline const QString& name( ) const
\r
58 { return( this->m_Name ); }
\r
60 void setPtr( quint64 p );
\r
61 inline quint64 ptr( )
\r
62 { return( this->m_Ptr ); }
\r
64 inline int radius( ) const
\r
65 { return( this->m_Radius ); }
\r
67 virtual bool isConnected( QNEPort* other ) = 0;
\r
68 inline int type( ) const
\r
69 { return( this->Type ); }
\r
75 QGraphicsTextItem* m_Label;
\r
87 typedef QNENamePort Self;
\r
88 typedef QNEPort Superclass;
\r
90 enum { Type = Superclass::Type + 1 };
\r
93 QNENamePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
94 virtual ~QNENamePort( );
\r
96 virtual void setName( const QString& n );
\r
98 virtual bool isConnected( QNEPort* other );
\r
99 inline int type( ) const
\r
100 { return( this->Type ); }
\r
109 typedef QNETypePort Self;
\r
110 typedef QNEPort Superclass;
\r
112 enum { Type = Superclass::Type + 2 };
\r
115 QNETypePort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
116 virtual ~QNETypePort( );
\r
118 virtual void setName( const QString& n );
\r
120 virtual bool isConnected( QNEPort* other );
\r
121 inline int type( ) const
\r
122 { return( this->Type ); }
\r
131 typedef QNEInputPort Self;
\r
132 typedef QNEPort Superclass;
\r
134 enum { Type = Superclass::Type + 3 };
\r
137 QNEInputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
138 virtual ~QNEInputPort( );
\r
140 virtual void setName( const QString& n );
\r
142 virtual bool isConnected( QNEPort* other );
\r
143 inline int type( ) const
\r
144 { return( this->Type ); }
\r
146 void setConnection( QNEConnection* c );
\r
147 inline QNEConnection* connection( )
\r
148 { return( this->m_Connection ); }
\r
149 inline const QNEConnection* connection( ) const
\r
150 { return( this->m_Connection ); }
\r
151 inline bool hasConnection( ) const
\r
152 { return( this->m_Connection != NULL ); }
\r
155 QVariant itemChange( GraphicsItemChange change, const QVariant& value );
\r
158 QNEConnection* m_Connection;
\r
163 class QNEOutputPort
\r
167 typedef QNEOutputPort Self;
\r
168 typedef QNEPort Superclass;
\r
170 enum { Type = Superclass::Type + 4 };
\r
173 QNEOutputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );
\r
174 virtual ~QNEOutputPort( );
\r
176 virtual void setName( const QString& n );
\r
178 virtual bool isConnected( QNEPort* other );
\r
179 inline int type( ) const
\r
180 { return( this->Type ); }
\r
182 inline QVector< QNEConnection* >& connections( )
\r
183 { return( this->m_Connections ); }
\r
184 inline const QVector< QNEConnection* >& connections( ) const
\r
185 { return( this->m_Connections ); }
\r
188 QVariant itemChange( GraphicsItemChange change, const QVariant& value );
\r
191 QVector< QNEConnection* > m_Connections;
\r
196 #endif // __PIPELINEEDITOR__QNEPORT__H__
\r