summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kdesavers/lines.h
blob: 0d820c0e8be16933b1bf225ecbe21e8f615602bd (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
92
93
94
95
96
97
98
//-----------------------------------------------------------------------------
//
// klines 0.1.1 - Basic screen saver for TDE
// by Dirk Staneker 1997
// based on kpolygon 0.3 by Martin R. Jones 1996
//

#ifndef __LINES_H__
#define __LINES_H__

#include <tqtimer.h>
#include <tqptrlist.h>

#include <kdialogbase.h>
#include <krandomsequence.h>
#include <tdescreensaver.h>

class KColorButton;

class Lines{
	private:
	struct Ln{
		Ln* next;
		int x1, y1, x2, y2;
	};
	Ln *start, *end, *akt;
	int offx1, offy1, offx2, offy2;
	uint numLn;
	public:
	Lines(int);
	~Lines();
	inline void reset();
	inline void getKoord(int&, int&, int&, int&);
	inline void setKoord(const int&, const int&, const int&, const int&);
	inline void next(void);
	void turn(const int&, const int&);
};

class kLinesSaver:public KScreenSaver{
	Q_OBJECT
  
	public:
	kLinesSaver( WId id );
	virtual ~kLinesSaver();

	void setLines(int len);
	void setSpeed(int spd);
	void setColor(const TQColor&, const TQColor&, const TQColor&);

	private:
	void readSettings();
	void blank();
	void initialiseLines();
	void initialiseColor();

	protected slots:
	void slotTimeout();

	protected:
	KRandomSequence rnd;
	TQTimer timer;
	unsigned numLines;
	int colorContext, speed;
	TQColor colors[64];
    TQColor colstart, colmid, colend;
	double colscale;
	Lines* lines;
};

class kLinesSetup : public KDialogBase{
	Q_OBJECT
  
	public:
	kLinesSetup(TQWidget *parent=NULL, const char *name=NULL);
    ~kLinesSetup();

	protected:
	void readSettings();

	private slots:
	void slotLength(int);
	void slotSpeed(int);
	void slotColstart(const TQColor &);
	void slotColmid(const TQColor &);
	void slotColend(const TQColor &);
	void slotOk();
	void slotHelp();

	private:
	KColorButton *colorPush0, *colorPush1, *colorPush2;
	TQWidget *preview;
	kLinesSaver *saver;
	int length, speed;
	TQColor colstart, colmid, colend;
};

#endif