Frapper  1.0a
PinGraphicsItem.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2009 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
32 
33 #ifndef PINGRAPHICSITEM_H
34 #define PINGRAPHICSITEM_H
35 
36 #include "BaseRectItem.h"
37 #include "Parameter.h"
38 #include "ParameterGroup.h"
39 #include "InstanceCounterMacros.h"
40 
41 namespace Frapper {
42 
62 class FRAPPER_CORE_EXPORT PinGraphicsItem : public QObject, public BaseRectItem
63 {
64 
65  Q_OBJECT
67 
68 private: // nested enumerations
69 
79  CT_NonConnected
80  };
81 
82 public: // constructors and destructors
83 
92  PinGraphicsItem ( QGraphicsItem *parent, int index, Parameter *parameter );
93 
104  PinGraphicsItem ( QGraphicsItem *parent, int index, ParameterGroup *parameterGroup, Parameter::PinType pinType );
105 
117  PinGraphicsItem ( QGraphicsItem *parent, int index, ParameterGroup *parameterGroup, Parameter::PinType pinType, bool connected );
118 
122  ~PinGraphicsItem ();
123 
124 public: // functions
125 
133  virtual void paint ( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
134 
140  QPointF center () const;
141 
147  void setEnabled ( bool enabled );
148 
157  bool setEnabled ( Parameter::Type parameterType, Parameter::PinType pinType );
158 
164  Parameter::PinType getPinType () const;
165 
172  bool represents ( Parameter *parameter ) const;
173 
180  bool represents ( Parameter::Type parameterType ) const;
181 
182 signals: //
183 
194  void parameterClicked ( PinGraphicsItem *pinItem, Parameter *parameter );
195 
196 protected: // functions
197 
203  void mouseReleaseEvent ( QGraphicsSceneMouseEvent *event );
204 
210  void contextMenuEvent ( QGraphicsSceneContextMenuEvent *event );
211 
212 private: // functions
213 
221  void fillMenu ( QMenu *menu, ParameterGroup *parameterGroup );
222 
223  private slots:
227  void removeParameter ();
228 
229 private: // data
230 
235 
239  bool m_isGroup;
240 
245 
250 
258 
263 
264 };
265 
266 } // end namespace Frapper
267 
268 #endif