summaryrefslogtreecommitdiffstats
path: root/examples/canvas/canvas.h
blob: cc269037ccfd933b6829507ba80ed95138174fb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef EXAMPLE_H
#define EXAMPLE_H

#include <ntqpopupmenu.h>
#include <ntqmainwindow.h>
#include <ntqintdict.h>
#include <ntqcanvas.h>

class BouncyLogo : public TQCanvasSprite {
    void initPos();
    void initSpeed();
public:
    BouncyLogo(TQCanvas*);
    void advance(int);
    int rtti() const;
};


class FigureEditor : public TQCanvasView {
    Q_OBJECT

public:
    FigureEditor(TQCanvas&, TQWidget* parent=0, const char* name=0, WFlags f=0);
    void clear();

protected:
    void contentsMousePressEvent(TQMouseEvent*);
    void contentsMouseMoveEvent(TQMouseEvent*);

signals:
    void status(const TQString&);

private:
    TQCanvasItem* moving;
    TQPoint moving_start;
};

class Main : public TQMainWindow {
    Q_OBJECT

public:
    Main(TQCanvas&, TQWidget* parent=0, const char* name=0, WFlags f=0);
    ~Main();

public slots:
    void help();

private slots:
    void aboutTQt();
    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:
    TQCanvas& canvas;
    FigureEditor *editor;

    TQPopupMenu* options;
    TQPrinter* printer;
    int dbf_id;
};

#endif