summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kdesavers/polygon.h
blob: f3a50c17dfb80a2e3084499a82182b2022cb06a4 (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
//-----------------------------------------------------------------------------
//
// kpolygon - Basic screen saver for TDE
//
// Copyright (c)  Martin R. Jones 1996
//

#ifndef __POLYGON_H__
#define __POLYGON_H__

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

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

class kPolygonSaver : public KScreenSaver
{
	TQ_OBJECT
  
public:
	kPolygonSaver( WId id );
	virtual ~kPolygonSaver();

	void setPolygon( int len, int ver );
	void setSpeed( int spd );

private:
	void readSettings();
	void blank();
	void initialisePolygons();
	void moveVertices();
	void initialiseColor();
	void nextColor();

protected slots:
	void slotTimeout();

protected:
	TQTimer		timer;
	unsigned	numLines;
	int			numVertices;
	int			colorContext;
	int			speed;
	TQColor		colors[64];
    int         currentColor;
	TQPtrList<TQPointArray> polygons;
	TQMemArray<TQPoint> directions;
	KRandomSequence rnd;
};

class kPolygonSetup : public KDialogBase
{
	TQ_OBJECT
  
public:
	kPolygonSetup( TQWidget *parent = 0, const char *name = 0 );
    ~kPolygonSetup();

protected:
	void readSettings();

private slots:
	void slotLength( int );
	void slotVertices( int );
	void slotSpeed( int );
	void slotOk();
	void slotHelp();

private:
	TQWidget *preview;
	kPolygonSaver *saver;

	int length;
	int vertices;
	int speed;
};

#endif