summaryrefslogtreecommitdiffstats
path: root/examples/canvas/canvas.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/canvas/canvas.h')
-rw-r--r--examples/canvas/canvas.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/examples/canvas/canvas.h b/examples/canvas/canvas.h
new file mode 100644
index 0000000..115d0b3
--- /dev/null
+++ b/examples/canvas/canvas.h
@@ -0,0 +1,91 @@
+#ifndef EXAMPLE_H
+#define EXAMPLE_H
+
+#include <qpopupmenu.h>
+#include <qmainwindow.h>
+#include <qintdict.h>
+#include <qcanvas.h>
+
+class BouncyLogo : public QCanvasSprite {
+ void initPos();
+ void initSpeed();
+public:
+ BouncyLogo(QCanvas*);
+ void advance(int);
+ int rtti() const;
+};
+
+
+class FigureEditor : public QCanvasView {
+ Q_OBJECT
+
+public:
+ FigureEditor(QCanvas&, QWidget* parent=0, const char* name=0, WFlags f=0);
+ void clear();
+
+protected:
+ void contentsMousePressEvent(QMouseEvent*);
+ void contentsMouseMoveEvent(QMouseEvent*);
+
+signals:
+ void status(const QString&);
+
+private:
+ QCanvasItem* moving;
+ QPoint moving_start;
+};
+
+class Main : public QMainWindow {
+ Q_OBJECT
+
+public:
+ Main(QCanvas&, QWidget* parent=0, const char* name=0, WFlags f=0);
+ ~Main();
+
+public slots:
+ void help();
+
+private slots:
+ void aboutQt();
+ void newView();
+ void clear();
+ void init();
+
+ void addSprite();
+ void addCircle();
+ void addHexagon();
+ void addPolygon();
+ void addSpline();
+ void addText();
+ void addLine();
+ void addRectangle();
+ void addMesh();
+ void addLogo();
+ void addButterfly();
+
+ void enlarge();
+ void shrink();
+ void rotateClockwise();
+ void rotateCounterClockwise();
+ void zoomIn();
+ void zoomOut();
+ void mirror();
+ void moveL();
+ void moveR();
+ void moveU();
+ void moveD();
+
+ void print();
+
+ void toggleDoubleBuffer();
+
+private:
+ QCanvas& canvas;
+ FigureEditor *editor;
+
+ QPopupMenu* options;
+ QPrinter* printer;
+ int dbf_id;
+};
+
+#endif