File: QClamVstEditor.hxx

package info (click to toggle)
clam 1.4.0-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,836 kB
  • ctags: 20,981
  • sloc: cpp: 92,504; python: 9,721; ansic: 1,602; xml: 444; sh: 239; makefile: 153; perl: 54; asm: 15
file content (72 lines) | stat: -rw-r--r-- 2,224 bytes parent folder | download | duplicates (2)
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
71
72
#ifndef QClamVstEditor_hxx
#define QClamVstEditor_hxx

#include <QtGui/QWidget>
#include <aeffeditor.h>
#include <iostream>
#include <windows.h>
namespace CLAM { class VstNetworkExporter; }
class QClamVstEditor;
class QCloseEvent;
class QResizeEvent;
class QMoveEvent;

class QVstWindow : public QWidget
{
	Q_OBJECT
public:
	QVstWindow(WId handle, QClamVstEditor * editor);
	~QVstWindow();
	void closeEvent(QCloseEvent * event);
	void resizeEvent(QResizeEvent * event);
	void moveEvent(QMoveEvent * event);
protected:
	QClamVstEditor * _editor;
	LONG_PTR _oldWndProc;
	LONG_PTR _oldWndData;
	WId _parent;
};

class QClamVstEditor : public AEffEditor
{
public:
	QClamVstEditor(CLAM::VstNetworkExporter * effect, const std::string & uifile);
	~QClamVstEditor();
	/// Open editor, pointer to parent windows is platform-dependent (HWND on Windows, WindowRef on Mac).
	virtual bool open(void * ptr);
	/// Idle call supplied by Host application
	virtual void idle ();
	/// Close editor (detach from parent window)
	virtual void close ();

	virtual bool onKeyDown (VstKeyCode& keyCode)	{
		std::cout << "onKeyDown " 
			<< keyCode.character << " " 
			<< keyCode.virt << " "
			<< keyCode.modifier << std::endl;
		return false; }		///< Receive key down event. Return true only if key was really used!
	virtual bool onKeyUp (VstKeyCode& keyCode)		{
		std::cout << "onKeyDown " 
			<< keyCode.character << " " 
			<< keyCode.virt << " "
			<< keyCode.modifier << std::endl;
		return false; }		///< Receive key up event. Return true only if key was really used!
	virtual bool onWheel (float distance)			{
		std::cout << "onWheel " << distance << std::endl;
		return false; }		///< Handle mouse wheel event, distance is positive or negative to indicate wheel direction.
	virtual bool setKnobMode (VstInt32 val)			{
		std::cout << "setKnobMode " << val << std::endl;
		return false; }		///< Set knob mode (if supported by Host). See CKnobMode in VSTGUI.

	void setParameter (VstInt32 index, float value);
	bool getRect (ERect **ppErect);
	void detachWidget() { _widget = 0; } // To be called from widget destructor
protected:
	std::string _uifile;
	QWidget * _widget;
	QApplication * _app;
	ERect _rect;
};


#endif//QClamVstEditor_hxx