Warning--
[kdeartwork.git] / kscreensaver / kdesavers / lines.h
blobd3f1062c13c5524aaae21bb136dbcc0818fd2421
1 //-----------------------------------------------------------------------------
2 //
3 // klines 0.1.1 - Basic screen saver for KDE
4 // by Dirk Staneker 1997
5 // based on kpolygon 0.3 by Martin R. Jones 1996
6 //
8 #ifndef __LINES_H__
9 #define __LINES_H__
11 #include <qtimer.h>
12 #include <qptrlist.h>
14 #include <kdialogbase.h>
15 #include <krandomsequence.h>
16 #include <kscreensaver.h>
18 class KColorButton;
20 class Lines{
21 private:
22 struct Ln{
23 Ln* next;
24 int x1, y1, x2, y2;
26 Ln *start, *end, *akt;
27 int offx1, offy1, offx2, offy2;
28 uint numLn;
29 public:
30 Lines(int);
31 ~Lines();
32 inline void reset();
33 inline void getKoord(int&, int&, int&, int&);
34 inline void setKoord(const int&, const int&, const int&, const int&);
35 inline void next(void);
36 void turn(const int&, const int&);
39 class kLinesSaver:public KScreenSaver{
40 Q_OBJECT
41 public:
42 kLinesSaver( WId id );
43 virtual ~kLinesSaver();
45 void setLines(int len);
46 void setSpeed(int spd);
47 void setColor(const QColor&, const QColor&, const QColor&);
49 private:
50 void readSettings();
51 void blank();
52 void initialiseLines();
53 void initialiseColor();
55 protected slots:
56 void slotTimeout();
58 protected:
59 KRandomSequence rnd;
60 QTimer timer;
61 unsigned numLines;
62 int colorContext, speed;
63 QColor colors[64];
64 QColor colstart, colmid, colend;
65 double colscale;
66 Lines* lines;
69 class kLinesSetup : public KDialogBase{
70 Q_OBJECT
71 public:
72 kLinesSetup(QWidget *parent=NULL, const char *name=NULL);
73 ~kLinesSetup();
75 protected:
76 void readSettings();
78 private slots:
79 void slotLength(int);
80 void slotSpeed(int);
81 void slotColstart(const QColor &);
82 void slotColmid(const QColor &);
83 void slotColend(const QColor &);
84 void slotOk();
85 void slotHelp();
87 private:
88 KColorButton *colorPush0, *colorPush1, *colorPush2;
89 QWidget *preview;
90 kLinesSaver *saver;
91 int length, speed;
92 QColor colstart, colmid, colend;
95 #endif