plugin_interaction.h 1.63 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
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
#ifndef _PLUGIN_INTERACTION_H_
#define _PLUGIN_INTERACTION_H_

#include "plugin.h"

namespace CGoGN
{

namespace SCHNApps
{

class SCHNApps;
class View;

class PluginInteraction : public Plugin
{
	Q_OBJECT

	friend class View;

public:
	PluginInteraction();
	virtual ~PluginInteraction();

public slots:
	const QList<View*>& getLinkedViews() const { return l_views; }
	bool isLinkedToView(View* view) const { return l_views.contains(view); }

	const QList<Utils::GLSLShader*> getShaders() const { return l_shaders; }

private:
32 33
	virtual void draw(View* view) = 0;
	virtual void drawMap(View* view, MapHandlerGen* map) = 0;
Pierre Kraemer's avatar
Pierre Kraemer committed
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

	virtual void keyPress(View* view, QKeyEvent* event) = 0;
	virtual void keyRelease(View* view, QKeyEvent* event) = 0;
	virtual void mousePress(View* view, QMouseEvent* event) = 0;
	virtual void mouseRelease(View* view, QMouseEvent* event) = 0;
	virtual void mouseMove(View* view, QMouseEvent* event) = 0;
	virtual void wheelEvent(View* view, QWheelEvent* event) = 0;

	virtual void viewLinked(View* view) = 0;
	virtual void viewUnlinked(View* view) = 0;

	/*********************************************************
	 * MANAGE LINKED VIEWS
	 *********************************************************/

	void linkView(View* view);
	void unlinkView(View* view);

	/*********************************************************
	 * MANAGE SHADERS
	 *********************************************************/

protected:
	void registerShader(Utils::GLSLShader* shader);
	void unregisterShader(Utils::GLSLShader* shader);

protected:
	QList<View*> l_views;
	QList<Utils::GLSLShader*> l_shaders;
};

} // namespace SCHNApps

} // namespace CGoGN

#endif