summaryrefslogtreecommitdiffstats
path: root/kolf/objects/test/test.h
blob: 3086a5785c43b54383def8ed4ac5c1da41442a2a (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
#ifndef KOLFTEST_H
#define KOLFTEST_H

#include <qcanvas.h>
#include <qobject.h>

#include <klibloader.h>

#include <kolf/canvasitem.h>
#include <kolf/object.h>

class KConfig;

class TestFactory : KLibFactory { Q_OBJECT public: QObject *createObject(QObject *, const char *, const char *, const QStringList & = QStringList()); };

class Test : public QCanvasEllipse, public CanvasItem
{
public:
	Test(QCanvas *canvas);

	virtual Config *config(QWidget *parent);
	virtual void save(KConfig *cfg);
	virtual void load(KConfig *cfg);

	virtual void advance(int phase);

	int switchEvery() const { return m_switchEvery / 2; }
	void setSwitchEvery(int news) { m_switchEvery = news * 2; }

private:
	int count;
	int m_switchEvery;
};

class TestConfig : public Config
{
	Q_OBJECT

public:
	TestConfig(Test *test, QWidget *parent);

private slots:
	void switchEveryChanged(int news);

private:
	Test *m_test;
};

class TestObj : public Object
{
public:
	TestObj() { m_name = i18n("Flash"); m__name = "flash"; m_author = "Jason Katz-Brown"; }
	virtual QCanvasItem *newObject(QCanvas *canvas) { return new Test(canvas); }
};

#endif