ecnode.h

00001 /***************************************************************************
00002  *   Copyright (C) 2003-2005 by David Saxton                               *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef ECNODE_H
00012 #define ECNODE_H
00013 
00014 #include "node.h"
00015 
00016 #include <qvaluevector.h>
00017 
00018 class ECNode;
00019 class Element;
00020 class Pin;
00021 class Switch;
00022 class QTimer;
00023 
00024 typedef QValueList<ECNode*> ECNodeList;
00025 typedef QValueList<Element*> ElementList;
00026 typedef QValueVector<Pin*> PinVector;
00027 
00032 class ECNode : public Node
00033 {
00034         Q_OBJECT
00035         public:
00036                 ECNode( ICNDocument *icnDocument, Node::node_type type, node_dir dir, const QPoint &pos, QString *id = 0 );
00037                 ~ECNode();
00038 
00039                 virtual void setParentItem( CNItem *parentItem );
00040                 virtual void drawShape( QPainter &p );
00044                 void setNumPins( unsigned num );
00049                 unsigned numPins() const { return m_pins.size(); }
00050                 PinVector pins() const { return m_pins; }
00051                 Pin * pin( unsigned num = 0 ) const { return (num < m_pins.size()) ? m_pins[num] : 0; }
00052                 bool showVoltageBars() const { return m_bShowVoltageBars; }
00053                 void setShowVoltageBars( bool show ) { m_bShowVoltageBars = show; }
00054                 void setNodeChanged();
00055 
00056         signals:
00057                 void numPinsChanged( unsigned newNum );
00058 
00059         protected slots:
00060                 void removeElement( Element * e );
00061                 void removeSwitch( Switch * sw );
00062 
00063         protected:
00064                 bool m_bShowVoltageBars;
00065                 double m_prevV;
00066                 double m_prevI;
00067                 QCanvasRectangle * m_pinPoint;
00068                 PinVector m_pins;
00069 };
00070 
00071 #endif
00072 
00073 
00074 

Generated on Tue May 8 17:05:29 2007 for KTechLab by  doxygen 1.5.1