viewButtonArea.h 973 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef _VIEWBUTTONAREA_H_
#define _VIEWBUTTONAREA_H_

#include <QPixmap>
#include <QSize>
#include <QRect>
#include <QPainter>
#include <QList>

#include <iostream>

class View;

class ViewButton : public QObject
{
	Q_OBJECT

public:
Pierre Kraemer's avatar
Pierre Kraemer committed
19
20
	ViewButton(const QString& image, View* view);
	~ViewButton();
21

22
	QSize getSize() { return m_GLimg.size(); }
23

24
	void click(int x, int y);
25
26
27
	void drawAt(int x, int y);

protected:
Pierre Kraemer's avatar
Pierre Kraemer committed
28
	View* m_view;
29

30
31
32
33
34
	QSize m_size;
	QImage m_GLimg;
	int m_texID;

signals:
35
	void clicked(int x, int y);
36
37
38
39
40
41
42
43
44
};

class ViewButtonArea : public QObject
{
	Q_OBJECT

public:
	ViewButtonArea(View* view) : m_view(view)
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
45
46
	~ViewButtonArea()
	{}
47
48

	void addButton(ViewButton* button);
Pierre Kraemer's avatar
Pierre Kraemer committed
49
	void removeButton(ViewButton* button);
50

Pierre Kraemer's avatar
Pierre Kraemer committed
51
	bool isClicked(int x, int y);
52
	void clickButton(int x, int y);
53

Pierre Kraemer's avatar
Pierre Kraemer committed
54
	const QRect& getForm() { return m_form; }
55
56
57
58
59
60
61

	void setTopRightPosition(int x, int y);

	void draw();

protected:
	View* m_view;
Pierre Kraemer's avatar
Pierre Kraemer committed
62
63
	QRect m_form;
	QList<ViewButton*> l_buttons;
64
65
66
};

#endif