00001
00008
00009 #ifndef RAIL_H
00010 #define RAIL_H
00011
00012 #include "ork.h"
00013
00014 #include <QRectF>
00015 #include <QString>
00016 #include <QPainter>
00017 #include <QSvgRenderer>
00018 #include <QGraphicsItem>
00019 #include <QGraphicsSvgItem>
00020 #include <QGraphicsSceneMouseEvent>
00021
00026 class Rail : public QGraphicsSvgItem
00027 {
00028 Q_OBJECT
00029
00030 public :
00031
00039 Rail( QSvgRenderer* renderer, QString type = "", int address = 0, int delay = 0, QString decoder = "", QString info = "" , QGraphicsItem * parent = 0 ) ;
00040
00042 int address() ;
00043
00046 QString decoder() ;
00047
00049 int delay() ;
00050
00053 QString type() ;
00054
00057 bool isOpen() ;
00058
00063 void setState( bool open, bool quiet = FALSE ) ;
00064
00068 void toggleState( bool quiet = FALSE ) ;
00069
00071 QRectF boundingRect() const ;
00072
00073 signals :
00074
00078 void stateChanged( bool ) ;
00079
00082 void clicked() ;
00083
00084 protected :
00085
00090 void mousePressEvent( QGraphicsSceneMouseEvent* event ) ;
00091
00092
00093 private :
00096 void initState() ;
00097
00101 void setElementIdSafe( const QString &id ) ;
00102
00106 QString _type ;
00107
00111 int _address ;
00112
00115 int _delay ;
00116
00119 QString _decoder ;
00120
00123 bool _open ;
00124 } ;
00125
00126
00127 #endif // RAIL_H
00128