Back to index

kdeartwork  4.3.2
polygon.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //
00003 // kpolygon - Basic screen saver for KDE
00004 //
00005 // Copyright (c)  Martin R. Jones 1996
00006 //
00007 
00008 #ifndef POLYGON_H
00009 #define POLYGON_H
00010 
00011 #include <qtimer.h>
00012 #include <QVector>
00013 #include <QList>
00014 
00015 #include <kdialog.h>
00016 #include <kscreensaver.h>
00017 #include <krandomsequence.h>
00018 
00019 class QPolygon;
00020 
00021 class kPolygonSaver : public KScreenSaver
00022 {
00023        Q_OBJECT
00024 public:
00025        kPolygonSaver( WId id );
00026        virtual ~kPolygonSaver();
00027 
00028        void setPolygon( int len, int ver );
00029        void setSpeed( int spd );
00030 
00031 private:
00032        void readSettings();
00033        void initialisePolygons();
00034        void moveVertices();
00035        void initialiseColor();
00036        void nextColor();
00037 
00038 protected:
00039        void paintEvent(QPaintEvent *event);
00040 
00041 protected:
00042        QTimer        timer;
00043        int                  numLines;
00044        int                  numVertices;
00045        int                  speed;
00046        QColor        colors[64];
00047     int         currentColor;
00048        QList<QPolygon> polygons;
00049        QVector<QPoint> directions;
00050        KRandomSequence rnd;
00051 };
00052 
00053 class kPolygonSetup : public KDialog
00054 {
00055        Q_OBJECT
00056 public:
00057        kPolygonSetup( QWidget *parent = 0 );
00058     ~kPolygonSetup();
00059 
00060 protected:
00061        void readSettings();
00062 
00063 private slots:
00064        void slotLength( int );
00065        void slotVertices( int );
00066        void slotSpeed( int );
00067        void slotOk();
00068        void slotHelp();
00069 
00070 private:
00071        QWidget *preview;
00072        kPolygonSaver *saver;
00073 
00074        int length;
00075        int vertices;
00076        int speed;
00077 };
00078 
00079 #endif
00080