summaryrefslogtreecommitdiffstats
path: root/noatun/modules/kjofol-skin/kjwidget.h
blob: 693d4eaa29fc977161d65149aca639797735c3a8 (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
#ifndef KJWIDGET_H
#define KJWIDGET_H

#include "kjloader.h"

class KJWidget
{
public:
	KJWidget(KJLoader *);
	virtual ~KJWidget() {};
	// called when the widget should paint
	virtual void paint(TQPainter *, const TQRect &) {};
	// called to receive the rect this widget is in
	virtual TQRect rect() const { return mRect; }
	// called when pressed in this widget
	virtual bool mousePress(const TQPoint &) {return false; }
	// called when the mouse is released after clicked in this widget
	virtual void mouseRelease(const TQPoint &, bool){}
	virtual void mouseMove(const TQPoint &, bool) {}
	// called with the current time (mille)
	virtual void timeUpdate(int) {}
	// called when a new song is playing, player() is ready with it too
	virtual void newFile() {}
	// called when config-entries have to be read, is a TODO for most widgets
	virtual void readConfig() {}

	// called when the mouse is moved while clicked in this widget
	// tqrepaint myself
	virtual void tqrepaint(bool me=true, const TQRect &rect=TQRect(), bool clear=false);

	virtual TQString tip() { return 0; }

public:
	static TQBitmap getMask(const TQImage &color, register TQRgb=tqRgb(255,0,255));

protected:
	const TQString &backgroundPressed(const TQString &bmp) const;
	KJLoader *tqparent() const {return mParent;}
	KJLoader &parser() const {return *mParent;}

	KJFont &textFont() const {return *mParent->mText;}
	KJFont &timeFont() const {return *mParent->mNumbers;}
	KJFont &volumeFont() const {return *mParent->mVolumeFont;}
	KJFont &pitchFont() const {return *mParent->mPitchFont;}

	void setRect(const TQRect& rect) {mRect=rect;}
	void setRect(int x, int y, int xs, int ys) {mRect=TQRect(x,y,xs,ys);}
private:
	KJLoader *mParent;
	TQRect mRect;
};

#endif