mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-22 01:34:21 +00:00
Added a lambda callback to ValueWithDefault that will be called when the default value is changed
This commit is contained in:
parent
8eacf2cd96
commit
a9283f48fa
1 changed files with 8 additions and 0 deletions
|
|
@ -94,7 +94,12 @@ public:
|
|||
void setDefault (const var& newDefault)
|
||||
{
|
||||
if (defaultValue != newDefault)
|
||||
{
|
||||
defaultValue = newDefault;
|
||||
|
||||
if (onDefaultChange != nullptr)
|
||||
onDefaultChange();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns true if the property does not exist or is empty. */
|
||||
|
|
@ -109,6 +114,9 @@ public:
|
|||
targetTree.removeProperty (targetProperty, nullptr);
|
||||
}
|
||||
|
||||
/** You can assign a lambda to this callback object to have it called when the default value is changed. */
|
||||
std::function<void()> onDefaultChange;
|
||||
|
||||
//==============================================================================
|
||||
/** Sets the property and returns the new ValueWithDefault. This will modify the property in the referenced ValueTree. */
|
||||
ValueWithDefault& operator= (const var& newValue)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue