Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TDOUBLEPARAMRELAYPROPERTY_H
Toshihiro Shimizu 890ddd
#define TDOUBLEPARAMRELAYPROPERTY_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tproperty.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzBase includes
Toshihiro Shimizu 890ddd
#include "tdoubleparam.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TPARAM_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//*****************************************************************************
Toshihiro Shimizu 890ddd
//    TDoubleParamRelayProperty  declaration
Toshihiro Shimizu 890ddd
//*****************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! The TDoubleParamRelayProperty is a TProperty heir which can be used as
Toshihiro Shimizu 890ddd
//! intermediary between a TDoubleParam instance and its GUI viewers.
Shinya Kitaoka d1f6c4
class DVAPI TDoubleParamRelayProperty final : public TProperty,
Shinya Kitaoka d1f6c4
                                              public TParamObserver {
Shinya Kitaoka 120a6e
  TDoubleParamP m_param;  //!< The referenced param
Shinya Kitaoka 120a6e
  double m_frame;         //!< Frame at which m_param returns values
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  class Visitor {
Shinya Kitaoka 120a6e
  public:
Shinya Kitaoka 120a6e
    virtual void visit(TDoubleParamRelayProperty *p) = 0;
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TDoubleParamRelayProperty(const std::string &name,
Shinya Kitaoka 120a6e
                            TDoubleParamP param = TDoubleParamP());
Shinya Kitaoka 120a6e
  ~TDoubleParamRelayProperty();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDoubleParamRelayProperty(const TDoubleParamRelayProperty &other);
Shinya Kitaoka 120a6e
  TDoubleParamRelayProperty &operator=(const TDoubleParamRelayProperty &other);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  TProperty *clone() const override;
Shinya Kitaoka 473e70
  std::string getValueAsString() override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setParam(const TDoubleParamP ¶m);
Shinya Kitaoka 120a6e
  const TDoubleParamP &getParam() const { return m_param; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setValue(double v);
Shinya Kitaoka 120a6e
  double getValue() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double frame() const { return m_frame; }
Shinya Kitaoka 120a6e
  double &frame() { return m_frame; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void accept(TProperty::Visitor &v) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void onChange(const TParamChange &) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // TDOUBLEPARAMRELAYPROPERTY_H