viewButtonArea.h 1.34 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3 4 5 6 7 8 9 10 11
#ifndef _VIEWBUTTONAREA_H_
#define _VIEWBUTTONAREA_H_

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

#include <iostream>

12 13 14 15
#define WITH_QT 1
#include "Utils/textures.h"
#include "Utils/Shaders/shaderWallPaper.h"

Pierre Kraemer's avatar
Pierre Kraemer committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
namespace CGoGN
{

namespace SCHNApps
{

class View;

class ViewButton : public QObject
{
	Q_OBJECT

public:
	ViewButton(const QString& image, View* view);
	~ViewButton();

	QSize getSize();

	void click(int x, int y, int globalX, int globalY);
35
	void drawAt(int x, int y, Utils::ShaderWallPaper* shader);
Pierre Kraemer's avatar
Pierre Kraemer committed
36 37 38 39 40 41 42

	static const int SIZE = 24;
	static const int SPACE = 4;

protected:
	QString m_img;
	View* m_view;
43
	Utils::Texture<2,Geom::Vec3uc>* m_texture;
Pierre Kraemer's avatar
Pierre Kraemer committed
44 45 46 47 48 49 50 51 52 53

signals:
	void clicked(int x, int y, int globalX, int globalY);
};

class ViewButtonArea : public QObject
{
	Q_OBJECT

public:
54
	ViewButtonArea(View* view);
Pierre Kraemer's avatar
Pierre Kraemer committed
55

56
	~ViewButtonArea();
Pierre Kraemer's avatar
Pierre Kraemer committed
57 58 59 60 61 62 63 64 65 66 67

	void addButton(ViewButton* button);
	void removeButton(ViewButton* button);

	bool isClicked(int x, int y);
	void clickButton(int x, int y, int globalX, int globalY);

	const QRect& getForm() { return m_form; }

	void setTopRightPosition(int x, int y);

Sylvain Thery's avatar
Sylvain Thery committed
68 69
	void setTopLeftPosition(int x, int y);

Pierre Kraemer's avatar
Pierre Kraemer committed
70 71 72 73 74 75
	void draw();

protected:
	View* m_view;
	QRect m_form;
	QList<ViewButton*> l_buttons;
76
	Utils::ShaderWallPaper* m_shaderButton;
Pierre Kraemer's avatar
Pierre Kraemer committed
77 78 79 80 81 82 83
};

} // namespace SCHNApps

} // namespace CGoGN

#endif