#ifndef OFX_INTERACT_H
#define OFX_INTERACT_H
#include "ofxOld.h"
namespace OFX {
namespace Host {
namespace Interact {
const void *GetSuite(int version);
class Base {
public:
virtual ~Base() {
}
OfxInteractHandle getHandle() {return (OfxInteractHandle)this;}
virtual OfxPropertySetHandle getPropHandle() = 0;
};
enum State {
eUninitialised,
eDescribed,
eCreated,
eFailed
};
class Descriptor : public Base {
protected:
Property::Set _properties; State _state; OfxPluginEntryPoint *_entryPoint;
public:
Descriptor();
virtual ~Descriptor();
void setEntryPoint(OfxPluginEntryPoint *entryPoint) {_entryPoint = entryPoint;}
bool describe(int bitDepthPerComponent, bool hasAlpha);
OfxPropertySetHandle getPropHandle() {return _properties.getHandle();}
const Property::Set &getProperties() const {return _properties;}
Property::Set &getProperties() {return _properties;}
OfxStatus callEntry(const char *action,
void *handle,
OfxPropertySetHandle inArgs,
OfxPropertySetHandle outArgs);
State getState() const {return _state;}
};
class Instance : public Base, protected Property::GetHook {
protected:
Descriptor &_descriptor; Property::Set _properties; State _state; void *_effectInstance; Property::Set _argProperties;
void initArgProp(OfxTime time,
const OfxPointD &renderScale);
void setPenArgProps(const OfxPointD &penPos,
const OfxPointI &penPosViewport,
double pressure);
void setKeyArgProps(int key,
char* keyString);
public:
Instance(Descriptor &desc, void *effectInstance);
virtual ~Instance();
State getState() const {return _state;}
OfxPropertySetHandle getPropHandle() {return _properties.getHandle();}
const Property::Set &getProperties() const {return _properties;}
virtual OfxStatus callEntry(const char *action,
Property::Set *inArgs);
#ifdef kOfxInteractPropViewportSize
virtual void getViewportSize(double &width, double &height) const = 0;
#endif
virtual void getPixelScale(double& xScale, double& yScale) const = 0;
virtual void getBackgroundColour(double &r, double &g, double &b) const = 0;
virtual bool getSuggestedColour(double &r, double &g, double &b) const = 0;
virtual OfxStatus swapBuffers() = 0;
virtual OfxStatus redraw() = 0;
virtual void getSlaveToParam(std::vector<std::string>& params) const;
virtual int getDimension(const std::string &name) const OFX_EXCEPTION_SPEC;
virtual void reset(const std::string &name) OFX_EXCEPTION_SPEC;
virtual double getDoubleProperty(const std::string &name, int index) const OFX_EXCEPTION_SPEC;
virtual void getDoublePropertyN(const std::string &name, double *first, int n) const OFX_EXCEPTION_SPEC;
virtual OfxStatus createInstanceAction();
virtual OfxStatus drawAction(OfxTime time, const OfxPointD &renderScale);
virtual OfxStatus penMotionAction(OfxTime time,
const OfxPointD &renderScale,
const OfxPointD &penPos,
const OfxPointI &penPosViewport,
double pressure);
virtual OfxStatus penUpAction(OfxTime time,
const OfxPointD &renderScale,
const OfxPointD &penPos,
const OfxPointI &penPosViewport,
double pressure);
virtual OfxStatus penDownAction(OfxTime time,
const OfxPointD &renderScale,
const OfxPointD &penPos,
const OfxPointI &penPosViewport,
double pressure);
virtual OfxStatus keyDownAction(OfxTime time,
const OfxPointD &renderScale,
int key,
char* keyString);
virtual OfxStatus keyUpAction(OfxTime time,
const OfxPointD &renderScale,
int key,
char* keyString);
virtual OfxStatus keyRepeatAction(OfxTime time,
const OfxPointD &renderScale,
int key,
char* keyString);
virtual OfxStatus gainFocusAction(OfxTime time,
const OfxPointD &renderScale);
virtual OfxStatus loseFocusAction(OfxTime time,
const OfxPointD &renderScale);
};
}
}
}
#endif