00001 00042 #ifndef AIVIEW_HPP 00043 #define AIVIEW_HPP 00044 00045 #include <QtGui> 00046 00047 #include "aicommand/aicommand.hpp" 00048 //~ 00049 00050 namespace AiFractals 00051 { 00058 class AiView : public QWidget 00059 { 00060 Q_OBJECT 00061 00062 public: 00067 AiView(QWidget * parent = 0); 00068 00072 ~AiView(); 00073 00077 void makeUpdate(); 00078 00084 void makeUpdate( QImage & image, bool undo ); 00085 00090 void makeUpdate( QString & fileName ); 00091 00096 void makeUndoUpdate( QImage & image ); 00097 00102 void retate( qreal r ); 00103 00109 void scale( qreal sx, qreal sy ); 00110 00115 void saveAs( QString & fileName ); 00116 00120 QImage & image(); 00121 00126 const bool emptyScreen(); 00127 00132 const qreal getScaleX() const; 00133 00138 const qreal getScaleY() const; 00139 00143 void clearScale(); 00144 00149 const qreal getRetation() const; 00150 00155 const int getImageWidth(); 00156 00161 const int getImageHeight(); 00162 00166 void print(); 00167 00171 void clear(); 00172 00176 void fillToWindow(); 00177 00181 void fillInWindow(); 00182 00186 QUndoStack * stack; 00187 00188 public slots: 00193 void zooming(bool enable); 00194 00195 signals: 00203 void zoneZooming( int startx, int starty, int endx, int endy ); 00204 00209 void enabledChilds(bool e); 00210 protected: 00214 void paintEvent ( QPaintEvent * event ); 00215 00219 void mouseMoveEvent ( QMouseEvent * event ); 00220 00224 void mousePressEvent ( QMouseEvent * event ); 00225 00229 void mouseReleaseEvent ( QMouseEvent * event ); 00230 private: 00231 00236 int widthView(int w); 00237 00242 int heightView(int h); 00243 00247 QImage m_image; 00248 00252 qreal m_scaleX; 00253 00257 qreal m_scaleY; 00258 00262 bool m_scale; 00263 00267 bool m_clearScale; 00268 00272 qreal m_retation; 00273 00277 bool m_canRetate; 00278 00282 bool m_isZooming; 00283 00287 int m_startX; 00288 00292 int m_startY; 00293 00297 int m_endX; 00298 00302 int m_endY; 00303 00307 bool m_fill2Win; 00308 00309 }; 00310 } 00311 #endif // AIVIEW_HPP