summaryrefslogtreecommitdiffstats
path: root/kolf/objects/poolball/poolball.h
blob: db09f7bdb21d41c0b1e7f5e5cffa079d2763ba1b (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
#ifndef KOLFPOOLBALL_H
#define KOLFPOOLBALL_H

#include <tqcanvas.h>
#include <tqobject.h>
#include <tqpainter.h>

#include <klibloader.h>

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

class StateDB;
class KConfig;

class PoolBallFactory : KLibFactory {
    Q_OBJECT
    TQ_OBJECT

public:
    TQObject *createObject(TQObject *, const char *, const char *, const TQStringList & = TQStringList()); 
};

class PoolBall : public Ball
{
public:
	PoolBall(TQCanvas *canvas);

	virtual bool deleteable() const { return true; }

	virtual Config *config(TQWidget *parent);
	virtual void saveState(StateDB *);
	virtual void save(KConfig *cfg);
	virtual void loadState(StateDB *);
	virtual void load(KConfig *cfg);
	virtual void draw(TQPainter &);
	virtual bool fastAdvance() const { return true; }

	int number() const { return m_number; }
	void setNumber(int newNumber) { m_number = newNumber; update(); }

private:
	int m_number;
};

class PoolBallConfig : public Config
{
	Q_OBJECT
  TQ_OBJECT

public:
	PoolBallConfig(PoolBall *poolBall, TQWidget *parent);

private slots:
	void numberChanged(int);

private:
	PoolBall *m_poolBall;
};

class PoolBallObj : public Object
{
public:
	PoolBallObj() { m_name = i18n("Pool Ball"); m__name = "poolball"; m_author = "Jason Katz-Brown"; }
	virtual TQCanvasItem *newObject(TQCanvas *canvas) { return new PoolBall(canvas); }
};

#endif