00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 #ifndef SDAGVIEWNODE_H
00065 #define SDAGVIEWNODE_H
00066
00067
00068
00069
00070 #include "../model/STaskSystem.h"
00071 #include "../model/jobs/SJob.h"
00072 #include "SViewEl.h"
00073
00074
00075 #include <qlist.h>
00076 #include <qregion.h>
00077 #include <qpixmap.h>
00078 #include <qpen.h>
00079 #include <qbrush.h>
00080 #include <qstring.h>
00081
00082 class SDAGEdgeViewEl;
00083
00089 class SDAGNodeViewEl: public SViewEl
00090 {
00091 public:
00096 SDAGNodeViewEl( STaskSystem *ts, SJob &job );
00097 ~SDAGNodeViewEl();
00103 virtual void paint( QPaintDevice *pd, QRect rect );
00108 void hide() { _visible = FALSE; };
00112 void show() { _visible = TRUE; };
00117 bool isVisible() { return _visible; };
00120 void initPixmap();
00127 void moveTo( int x, int y );
00131 void moveTo( QPoint pos ) { moveTo( pos.x(), pos.y() ); };
00134 void setPos( int x, int y );
00138 void setPos( QPoint p ) { setPos( p.x(), p.y() ); };
00141 int getWidth() { return _w; };
00144 int getHeight() { return _h; };
00148 QPoint getPos() { return QPoint( _x + _w / 2, _y + _h / 2 ); };
00152 void addEdge( SDAGEdgeViewEl* edge ) { _edges->append( edge ); };
00155 void removeEdge( SDAGEdgeViewEl* edge ) { _edges->removeRef( edge ); };
00158 SJob &getJob() { return *_pJob; };
00161 QRegion getRegion() { return QRegion( _x , _y , _w, _h, _shape ); };
00164 const QRect &getBoundBox() const;
00165
00168 const QRect &fullBoundBox() const;
00169 protected:
00172 void update( const class SEvent & );
00173
00174 private:
00177 int _x;
00180 int _y;
00183 int _w;
00186 int _h;
00189 SJob *_pJob;
00193 QRegion::RegionType _shape;
00196 bool _visible;
00197
00198 QPen _pen;
00199 QBrush _brush;
00200 QString _text;
00203 QList<SDAGEdgeViewEl> *_edges;
00207 QPixmap _pixmap;
00210 int _curPixIndex;
00218 void drawNodePixmap( int index );
00221 void drawText();
00226 void setCurPixIndex();
00230 void loadPixmap();
00234 void createPixmap();
00235 };
00236
00237 #endif //SDAGVIEWNODE_H