21 #include <pluginterfaces/vst/vsttypes.h> 22 #include <pluginterfaces/base/ftypes.h> 29 using namespace Steinberg;
30 using namespace Steinberg::Vst;
52 class IGUIParameter :
public std::enable_shared_from_this<IGUIParameter>
65 virtual tresult commit() = 0;
71 virtual tresult rollback() = 0;
77 virtual ~
Editor() =
default;
86 virtual ParamID getParamID()
const = 0;
97 virtual int32 getStepCount()
const = 0;
105 virtual std::string
toUTF8String(int32 iPrecision)
const = 0;
139 std::shared_ptr<ITGUIParameter<T>> cast();
151 virtual std::shared_ptr<GUIDiscreteParameter> asDiscreteParameter(int32 iStepCount) = 0;
240 virtual tresult setValue(
ParamType const &iValue) = 0;
251 virtual bool updateValue(
ParamType const &iValue) = 0;
261 auto res = setValue(iValue);
281 virtual tresult accessValue(ValueAccessor
const &iGetter)
const = 0;
292 virtual bool update(ParamType
const &iValue) = 0;
299 virtual tresult setValue(ParamType
const &iValue) = 0;
306 virtual std::unique_ptr<ITEditor> edit() = 0;
313 auto editor = edit();
314 editor->setValue(iValue);
334 fGUIParameter{iGUIParameter},
335 fInitialValue{iDefaultValue}
347 return fGUIParameter->update(iValue);
355 fGUIParameter->update(iValue);
375 auto res = setValue(fInitialValue);
383 bool fDoneEditing{
false};
401 IGUIParam(std::shared_ptr<IGUIParameter> iPtr =
nullptr) :
402 fPtr{std::move(iPtr)}
407 inline bool exists()
const {
return (
bool) fPtr; }
411 inline ParamID
getParamID()
const { DCHECK_F(exists());
return fPtr->getParamID(); }
415 inline int32
getStepCount()
const { DCHECK_F(exists());
return fPtr->getStepCount(); }
419 inline std::string
toUTF8String(int32 iPrecision)
const { DCHECK_F(exists());
return fPtr->toUTF8String(iPrecision); }
430 std::shared_ptr<IGUIParameter>
fPtr;
ITGUIParameter< T > * fGUIParameter
Definition: IGUIParameter.h:381
tresult commit() override
Commits all the changes applied to the parameter.
Definition: IGUIParameter.h:364
DefaultEditorImpl(ITGUIParameter< T > *iGUIParameter, T const &iDefaultValue)
Definition: IGUIParameter.h:333
IGUIParam(std::shared_ptr< IGUIParameter > iPtr=nullptr)
Constructor.
Definition: IGUIParameter.h:401
This is the base class of all GUI parameters.
Definition: IGUIParameter.h:52
tresult setValue(T const &iValue) override
Unconditionaly sets the value of the parameter to the value provided.
Definition: IGUIParameter.h:351
std::function< void()> ChangeCallback
A callback that will be invoked for changes.
Definition: Parameters.h:55
Represents a gui parameter with its underlying backing type T (aka ParamType).
Definition: IGUIParameter.h:33
std::shared_ptr< IGUIParameter > fPtr
Definition: IGUIParameter.h:430
virtual tresult commit()=0
Commits all the changes applied to the parameter.
virtual std::unique_ptr< ITEditor > edit(ParamType const &iValue)
Shortcut api which creates an editor followed by ITEditor::setValue(ParamType const &) to set the par...
Definition: IGUIParameter.h:311
std::string toUTF8String(T const &iValue, Steinberg::int32 iPrecision)
This generic function will determine (at compilation time) whether T can be written to an ostream and...
Definition: Utils.h:49
std::function< void(ParamValue const &)> ValueAccessor
API to access the value of the param.
Definition: IGUIParameter.h:178
std::unique_ptr< FObjectCx > connect(Parameters::IChangeListener *iChangeListener) const
Creates a connection between this parameter and the change listener: whenever the parameter changes,...
Definition: IGUIParameter.h:423
~DefaultEditorImpl() override
Definition: IGUIParameter.h:340
Definition: GUIState.h:36
bool updateValue(T const &iValue) override
First check if the value provided (iValue) is different from the current value and if that is the cas...
Definition: IGUIParameter.h:343
std::unique_ptr< FObjectCx > connect(Parameters::ChangeCallback iChangeCallback) const
Creates a connection between this parameter and the callback: whenever the parameter changes,...
Definition: IGUIParameter.h:427
ParamValue ParamType
The type of the param (alias)
Definition: IGUIParameter.h:171
tresult rollback() override
Rollback all the changes that were made to this parameter (since this editor was created).
Definition: IGUIParameter.h:373
std::string toUTF8String(int32 iPrecision) const
Returns the current value of the parameter as a string (which is properly UTF-8 encoded).
Definition: IGUIParameter.h:419
Defines the basic and common API of all parameter editors (allow to commit/rollback)
Definition: IGUIParameter.h:58
virtual tresult commit(ParamType const &iValue)
Shortcut method which calls setValue(ParamType const &) followed by commit().
Definition: IGUIParameter.h:259
Default implementation of the editor interface.
Definition: IGUIParameter.h:329
bool exists() const
Returns true if this wrapper actually refers to an actual parameter.
Definition: IGUIParameter.h:407
Defines the API for the editor which can be obtained by calling ITGUIParameter::edit().
Definition: IGUIParameter.h:232
int32 getStepCount() const
When a parameter is a discrete parameter (which means its underlying backing type is an int32 with va...
Definition: IGUIParameter.h:415
ParamID getParamID() const
Each parameter has a unique ID returned by this method.
Definition: IGUIParameter.h:411
Wrapper instance returned by ParamAware::registerBaseParam() methods.
Definition: IGUIParameter.h:397
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
T fInitialValue
Definition: IGUIParameter.h:382