00001 #ifndef H_LAYER 00002 #define H_LAYER 00003 00004 #include <QObject> 00005 #include <QImage> 00006 00007 #include "FlowData.h" 00008 00009 struct DrawInfo 00010 { 00011 QPainter *painter; 00012 QRectF targetRect; 00013 QRectF sourceRect; 00014 QRectF rangeRect; 00015 }; 00016 00017 /* 00018 TODO: 00019 - set Qt::WA_OpaquePaintEvent and make opaque drawing self (optimizing) 00020 */ 00021 class Layer : public QObject 00022 { 00023 Q_OBJECT 00024 00025 public: 00026 Layer(); 00027 ~Layer(); 00028 00029 virtual void setWidget(QWidget *widget) = 0; 00030 00031 bool getVisibility(); 00032 float getOpacity(); 00033 00034 virtual void draw(const DrawInfo &drawInfo) = 0; 00035 00036 public slots: 00037 virtual void setFlowData(FlowData *flowData); 00038 virtual void setSize(const QSize &size); 00039 void setOpacity(float value); 00040 void setVisibility(bool visible); 00041 00042 signals: 00043 void layerChanged(Layer*); 00044 00045 protected: 00046 FlowData *flowData; 00047 QSize size; 00048 float opacity; 00049 bool visible; 00050 }; 00051 00052 #endif // H_LAYER