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;
109 virtual tresult resetToDefault() = 0;
143 std::shared_ptr<ITGUIParameter<T>> cast();
155 virtual std::shared_ptr<GUIDiscreteParameter> asDiscreteParameter(int32 iStepCount) = 0;
244 virtual tresult setValue(
ParamType const &iValue) = 0;
255 virtual bool updateValue(
ParamType const &iValue) = 0;
265 auto res = setValue(iValue);
285 virtual tresult accessValue(ValueAccessor
const &iGetter)
const = 0;
296 virtual bool update(ParamType
const &iValue) = 0;
303 virtual tresult setValue(ParamType
const &iValue) = 0;
310 virtual std::unique_ptr<ITEditor> edit() = 0;
317 auto editor = edit();
318 editor->setValue(iValue);
338 fGUIParameter{iGUIParameter},
339 fInitialValue{iDefaultValue}
351 return fGUIParameter->update(iValue);
359 fGUIParameter->update(iValue);
379 auto res = setValue(fInitialValue);
387 bool fDoneEditing{
false};
405 IGUIParam(std::shared_ptr<IGUIParameter> iPtr =
nullptr) :
406 fPtr{std::move(iPtr)}
411 inline bool exists()
const {
return (
bool) fPtr; }
415 inline ParamID
getParamID()
const { DCHECK_F(exists());
return fPtr->getParamID(); }
419 inline int32
getStepCount()
const { DCHECK_F(exists());
return fPtr->getStepCount(); }
423 inline std::string
toUTF8String(int32 iPrecision)
const { DCHECK_F(exists());
return fPtr->toUTF8String(iPrecision); }
438 std::shared_ptr<IGUIParameter>
fPtr;
ITGUIParameter< T > * fGUIParameter
Definition: IGUIParameter.h:385
tresult commit() override
Commits all the changes applied to the parameter.
Definition: IGUIParameter.h:368
DefaultEditorImpl(ITGUIParameter< T > *iGUIParameter, T const &iDefaultValue)
Definition: IGUIParameter.h:337
IGUIParam(std::shared_ptr< IGUIParameter > iPtr=nullptr)
Constructor.
Definition: IGUIParameter.h:405
This is the base class of all GUI parameters.
Definition: IGUIParameter.h:52
tresult setValue(T const &iValue) override
Unconditionally sets the value of the parameter to the value provided.
Definition: IGUIParameter.h:355
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:438
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:315
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:182
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:431
~DefaultEditorImpl() override
Definition: IGUIParameter.h:344
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:347
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:435
ParamValue ParamType
The type of the param (alias)
Definition: IGUIParameter.h:175
tresult rollback() override
Rollback all the changes that were made to this parameter (since this editor was created).
Definition: IGUIParameter.h:377
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:423
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:263
Default implementation of the editor interface.
Definition: IGUIParameter.h:333
bool exists() const
Returns true if this wrapper actually refers to an actual parameter.
Definition: IGUIParameter.h:411
Defines the API for the editor which can be obtained by calling ITGUIParameter::edit().
Definition: IGUIParameter.h:236
int32 getStepCount() const
When a parameter is a discrete parameter (which means its underlying backing type is an int32 with va...
Definition: IGUIParameter.h:419
ParamID getParamID() const
Each parameter has a unique ID returned by this method.
Definition: IGUIParameter.h:415
Wrapper instance returned by ParamAware::registerBaseParam() methods.
Definition: IGUIParameter.h:401
void resetToDefault()
Resets the parameter to its default value.
Definition: IGUIParameter.h:427
Interface to implement to receive parameter changes.
Definition: Parameters.h:43
T fInitialValue
Definition: IGUIParameter.h:386