2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TDOUBLEPARAMRELAYPROPERTY_H
|
|
|
|
#define TDOUBLEPARAMRELAYPROPERTY_H
|
|
|
|
|
|
|
|
// TnzCore includes
|
|
|
|
#include "tproperty.h"
|
|
|
|
|
|
|
|
// TnzBase includes
|
|
|
|
#include "tdoubleparam.h"
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TPARAM_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// TDoubleParamRelayProperty declaration
|
|
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
//! The TDoubleParamRelayProperty is a TProperty heir which can be used as
|
|
|
|
//! intermediary between a TDoubleParam instance and its GUI viewers.
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI TDoubleParamRelayProperty final : public TProperty,
|
|
|
|
public TParamObserver {
|
2016-06-15 18:43:10 +12:00
|
|
|
TDoubleParamP m_param; //!< The referenced param
|
|
|
|
double m_frame; //!< Frame at which m_param returns values
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
class Visitor {
|
|
|
|
public:
|
|
|
|
virtual void visit(TDoubleParamRelayProperty *p) = 0;
|
|
|
|
};
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TDoubleParamRelayProperty(const std::string &name,
|
|
|
|
TDoubleParamP param = TDoubleParamP());
|
|
|
|
~TDoubleParamRelayProperty();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TDoubleParamRelayProperty(const TDoubleParamRelayProperty &other);
|
|
|
|
TDoubleParamRelayProperty &operator=(const TDoubleParamRelayProperty &other);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TProperty *clone() const override;
|
|
|
|
std::string getValueAsString() override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setParam(const TDoubleParamP ¶m);
|
|
|
|
const TDoubleParamP &getParam() const { return m_param; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void setValue(double v);
|
|
|
|
double getValue() const;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
double frame() const { return m_frame; }
|
|
|
|
double &frame() { return m_frame; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void accept(TProperty::Visitor &v) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void onChange(const TParamChange &) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // TDOUBLEPARAMRELAYPROPERTY_H
|