Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

visualization/SViewEl.h

Go to the documentation of this file.
00001 /* #start# ***********************************************************
00002 
00003            Scheduling Simulator
00004         Lehrstuhl f"ur Effiziente Algorithmen
00005            Technische Universit"at M"unchen
00006 
00007  File    : $Id: SViewEl.h,v 1.4 2003/01/08 18:57:15 meierb Exp $
00008 
00009  Purpose : base class for small building blocks which can be combined
00010            to a graphical display (e.g., single machines, jobs, ...).
00011            view elements do only paint themselves. they are not
00012            responsible for setting up the graphical context and for
00013            communicating with the window system.
00014 
00015  RCS-Log:
00016  $Log: SViewEl.h,v $
00017  Revision 1.4  2003/01/08 18:57:15  meierb
00018  added randomized release times
00019 
00020  Revision 1.1.1.1  2002/12/02 22:26:19  meierb
00021  my_schedule
00022 
00023  Revision 1.2  2002/11/11 16:19:36  taeubig
00024  changes in header inclusion
00025 
00026  Revision 1.1  2002/08/29 12:59:59  taeubig
00027  Added the sources
00028 
00029  Revision 1.16  2001/07/16 14:37:55  taeubig
00030  cosmetics
00031 
00032  Revision 1.15  2000/08/22 17:04:37  hall
00033  changed painting (mesh + gantt) ... nicer :-)
00034 
00035  Revision 1.14  2000/08/21 23:04:28  hall
00036  more "intelligent" repaint (moved to SViewEl.cpp),
00037  fixes/workarounds for crazy bugs
00038 
00039  Revision 1.13  2000/06/07 11:39:27  taeubig
00040  Updated for new MeshView
00041 
00042  Revision 1.12  2000/01/28 14:27:32  hall
00043  getBoundBox() doesn't create new Qrects anymore
00044 
00045  Revision 1.11  2000/01/16 18:43:05  kern
00046  java docs
00047 
00048  Revision 1.10  2000/01/13 17:56:21  hall
00049  new DAG-layouting class + Superclass for Container-Views added
00050 
00051  Revision 1.9  2000/01/12 09:27:47  kern
00052  added javadocs
00053 
00054  Revision 1.8  1999/12/01 09:48:34  kern
00055  design structure complete
00056 
00057  Revision 1.7  1999/11/29 11:46:09  kern
00058  added design structure
00059 
00060  Revision 1.6  1999/08/05 08:48:19  schickin
00061  purpose of important classes noted in the header-files
00062 
00063  Revision 1.5  1999/04/27 13:40:03  schickin
00064  well folks, that's the first demo version that really runs 8-)
00065 
00066  Revision 1.4  1999/02/10 15:05:57  schickin
00067  model-directory can be compiled now
00068 
00069  Revision 1.3  1999/02/10 10:50:50  schickin
00070  main loop for simulation added
00071 
00072  Revision 1.2  1999/01/29 10:04:16  schickin
00073  Project-Headers added.
00074 
00075 
00076  * #end# ************************************************************* */
00077 
00078 #ifndef SVIEWEL_H
00079 #define SVIEWEL_H
00080 
00081 // system header files
00082 
00083 // project header files
00084 #include "SView.h"
00085 #include "../general/SObserver.h"
00086 
00087 // QT header files
00088 #include <qobject.h>
00089 #include <qpainter.h>
00090 #include <qpaintdevice.h>
00091 #include <qevent.h>
00092 #include <qpoint.h>
00093 #include <qregion.h>
00094 
00095 class STaskSystem;
00102 class SViewEl : public QObject, public SObserver 
00103 {
00104   Q_OBJECT
00105 public:
00111   SViewEl() : _pTaskSystem(NULL), _pView(NULL) {};
00112   SViewEl( STaskSystem *ts ) : _pTaskSystem( ts ), _pView(NULL) {};
00118   virtual void setView( SView &view ) { _pView = &view; };
00126   virtual void paint( QPaintDevice *pd, QRect rect ) = 0;
00131   enum SMarkStyles {STANDARD, MARKED, MARKED1, MARKED2, MARKED3, MARKED4}; 
00139   virtual bool isAffectedBy(QMouseEvent *ev) { return TRUE; };
00145   virtual bool mouseEvent(QMouseEvent *ev) { return TRUE; };
00150   virtual void setPos( QPoint p ) {};
00151   /* WARNING: This will be abstract in the future!!! */
00152   /* THIS IS ONLY A DIRTY HACK! */
00153   virtual const QRect &getBoundBox() const {
00154     ((SViewEl *) this)->_bBox = 
00155       ((SViewEl *) this)->getRegion().boundingRect();
00156     return _bBox;
00157   };
00161   virtual QRegion getRegion() = 0;
00162 
00163 protected:
00164   QColor lighterGray() { return QColor(220, 220, 225); };
00165 
00168   void draw3DRect(QPainter &p, int x, int y, int w, int h);
00169   void draw3DRect(QPainter &p, const QRect &r) {
00170     draw3DRect(p, r.x(), r.y(), r.width(), r.height()); };
00171   
00172 
00178   SView &getView() { return *_pView; };
00184   void requestRepaint() { 
00185     if( _pView != NULL ) _pView->repaint( QRect(0, 0, 30000, 30000) ); 
00186   };
00187 
00188   void requestRepaint(const QRect &rect) { 
00189     if( _pView != NULL ) _pView->repaint( rect ); 
00190   };
00194   virtual void update( const class SEvent & ) {};
00200   STaskSystem *_pTaskSystem;
00201   
00202 private:
00207   SView *_pView;          
00208 
00209   QRect _bBox;
00210 };
00211 
00212 #endif //SVIEWEL_H

Generated on Thu May 22 16:48:09 2003 for Sketch-it! by doxygen1.2.18