00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef DRAWPADCANVAS_H
00015 #define DRAWPADCANVAS_H
00016
00017 #include <qscrollview.h>
00018
00019 #include <qlist.h>
00020 #include <qpointarray.h>
00021
00022 class DrawPad;
00023 class Page;
00024
00025 class DrawPadCanvas : public QScrollView
00026 {
00027 Q_OBJECT
00028
00029 public:
00030 DrawPadCanvas(DrawPad* drawPad, QWidget* parent = 0, const char* name = 0);
00031 ~DrawPadCanvas();
00032
00033 void load(QIODevice* ioDevice);
00034 void initialPage();
00035 void save(QIODevice* ioDevice);
00036
00037 void importPage(const QString& fileName);
00038 void exportPage(uint fromPage, uint toPage, const QString& name, const QString& format);
00039 void importPixmap( const QPixmap& );
00040
00041 bool goPreviousPageEnabled();
00042 bool goNextPageEnabled();
00043
00044 Page* currentPage();
00045 QList<Page> pages();
00046 uint pagePosition();
00047 uint pageCount();
00048
00049 void selectPage(Page* page);
00050 void selectPage(uint pagePosition);
00051 void backupPage();
00052
00053 public slots:
00054 void deleteAll();
00055 void newPage(QString title, uint width, uint height, const QColor& color);
00056 void clearPage();
00057 void deletePage();
00058 void movePageUp();
00059 void movePageDown();
00060
00061 void undo();
00062 void redo();
00063
00064 void goFirstPage();
00065 void goPreviousPage();
00066 void goNextPage();
00067 void goLastPage();
00068
00069 signals:
00070 void pagesChanged();
00071
00072 protected:
00073 void contentsMousePressEvent(QMouseEvent* e);
00074 void contentsMouseReleaseEvent(QMouseEvent* e);
00075 void contentsMouseMoveEvent(QMouseEvent* e);
00076 void drawContents(QPainter* p, int cx, int cy, int cw, int ch);
00077
00078 private:
00079 DrawPad* m_pDrawPad;
00080 QList<Page> m_pages;
00081 };
00082
00083 #endif // DRAWPADCANVAS_H