tahoma2d/toonz/sources/include/tdoubleparamrelayproperty.h
Shinya Kitaoka d1f6c4e95b REFACTORING: Add final specifiers (#537)
* add final specifiers

* apply clang-format

* fix for macOS
2016-06-29 15:17:12 +09:00

64 lines
1.8 KiB
C++

#pragma once
#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.
class DVAPI TDoubleParamRelayProperty final : public TProperty,
public TParamObserver {
TDoubleParamP m_param; //!< The referenced param
double m_frame; //!< Frame at which m_param returns values
public:
class Visitor {
public:
virtual void visit(TDoubleParamRelayProperty *p) = 0;
};
public:
TDoubleParamRelayProperty(const std::string &name,
TDoubleParamP param = TDoubleParamP());
~TDoubleParamRelayProperty();
TDoubleParamRelayProperty(const TDoubleParamRelayProperty &other);
TDoubleParamRelayProperty &operator=(const TDoubleParamRelayProperty &other);
TProperty *clone() const override;
std::string getValueAsString() override;
void setParam(const TDoubleParamP &param);
const TDoubleParamP &getParam() const { return m_param; }
void setValue(double v);
double getValue() const;
double frame() const { return m_frame; }
double &frame() { return m_frame; }
void accept(TProperty::Visitor &v) override;
void onChange(const TParamChange &) override;
};
#endif // TDOUBLEPARAMRELAYPROPERTY_H