~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to demos/affine/xform.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef XFORM_H
 
2
#define XFORM_H
 
3
 
 
4
#include "arthurwidgets.h"
 
5
#include <qbasictimer.h>
 
6
 
 
7
class HoverPoints;
 
8
 
 
9
class XFormView : public ArthurFrame
 
10
{
 
11
    Q_OBJECT
 
12
 
 
13
public:
 
14
    XFormView(QWidget *parent);
 
15
    void paint(QPainter *);
 
16
    void drawVectorType(QPainter *painter);
 
17
    void drawPixmapType(QPainter *painter);
 
18
    void drawTextType(QPainter *painter);
 
19
    QSize sizeHint() const { return QSize(500, 500); }
 
20
 
 
21
    void mousePressEvent(QMouseEvent *e);
 
22
    void resizeEvent(QResizeEvent *e);
 
23
    HoverPoints *hoverPoints() { return pts; }
 
24
 
 
25
    QLineEdit *textEditor;
 
26
 
 
27
public slots:
 
28
    void setAnimation(bool animate);
 
29
    void updateCtrlPoints(const QPolygonF &);
 
30
    void changeRotation(int rotation);
 
31
    void changeScale(int scale);
 
32
    void changeShear(int shear);
 
33
 
 
34
    void setVectorType();
 
35
    void setPixmapType();
 
36
    void setTextType();
 
37
    void reset();
 
38
 
 
39
signals:
 
40
    void rotationChanged(int rotation);
 
41
    void scaleChanged(int scale);
 
42
    void shearChanged(int shear);
 
43
 
 
44
protected:
 
45
    void timerEvent(QTimerEvent *e);
 
46
    void wheelEvent(QWheelEvent *);
 
47
 
 
48
private:
 
49
    enum XFormType { VectorType, PixmapType, TextType };
 
50
 
 
51
    QPolygonF ctrlPoints;
 
52
    HoverPoints *pts;
 
53
    double rotation;
 
54
    double scale;
 
55
    double shear;
 
56
    XFormType type;
 
57
    QPixmap pixmap;
 
58
    QBasicTimer timer;
 
59
};
 
60
 
 
61
class XFormWidget : public QWidget
 
62
{
 
63
    Q_OBJECT
 
64
public:
 
65
    XFormWidget(QWidget *parent);
 
66
 
 
67
private:
 
68
    XFormView *view;
 
69
};
 
70
 
 
71
#endif // XFORM_H