|
Krotos Modules 3
|
#include <CustomParameterTree.h>
Public Member Functions | |
| CustomParameterTree (const Identifier &type, UndoManager *undoManager=nullptr) | |
| CustomParameterTree (ValueTree customTree, UndoManager *undoManager=nullptr) | |
| CustomParameterTree (const CustomParameterTree &other) | |
| ~CustomParameterTree () override | |
| CustomParameterTree & | operator= (const CustomParameterTree &other) |
| bool | operator== (const CustomParameterTree &other) const |
| bool | isValid () const |
| void | setUndoManager (UndoManager *um) |
| UndoManager * | getUndoManager () const |
| const ValueTree & | getParameterTree () const |
| const Identifier | getType () const |
| void | addChild (const ValueTree &child, int index=-1) |
| ValueTree | getChild (int index) const |
| ValueTree | getChildWithName (const Identifier &type) const |
| void | removeChild (const ValueTree &child) |
| void | removeAllChildren () |
| Removes all children from the tree. | |
| virtual void | valueTreePropertyChanged (ValueTree &treeWhosePropertyHasChanged, const Identifier &property) override |
| virtual void | valueTreeChildAdded (ValueTree &parentTree, ValueTree &childWhichHasBeenAdded) override |
| virtual void | valueTreeChildRemoved (ValueTree &parentTree, ValueTree &childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved) override |
Public Attributes | |
| std::function< void(ValueTree &treeWhosePropertyHasChanged, const Identifier &property)> | propertyChanged |
| std::function< void(ValueTree &parentTree, ValueTree &childWhichHasBeenAdded)> | childAdded |
| std::function< void(ValueTree &parentTree, ValueTree &childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved)> | childRemoved |
Protected Attributes | |
| ValueTree | m_parameterTree |
Private Attributes | |
| UndoManager * | m_undoManager {nullptr} |
Similar to a CustomParameter, this is a wrapper class around juce::ValueTree designed to store custom plugin state in a tree format. You can create a subclass to extend the ValueTree as far and wide as you wish and override the Listeners, or you can just pass a ValueTree in, use the wrapper methods and set up Listeners underlying tree using getParameterTree.
| krotos::CustomParameterTree::CustomParameterTree | ( | const Identifier & | type, |
| UndoManager * | undoManager = nullptr ) |
Creates an empty CustomParameterTree with a specified type.
| krotos::CustomParameterTree::CustomParameterTree | ( | ValueTree | customTree, |
| UndoManager * | undoManager = nullptr ) |
Creates a CustomParameterTree from an existing ValueTree. This will assign the underlying ValueTree reference to the given input tree, therefore retaining any existing listeners.
| krotos::CustomParameterTree::CustomParameterTree | ( | const CustomParameterTree & | other | ) |
Copy constructor.
|
override |
Destructor.
| void krotos::CustomParameterTree::addChild | ( | const ValueTree & | child, |
| int | index = -1 ) |
Adds a child to this tree. Make sure that the child being added has first been removed from any former parent before calling this, or else you'll hit an assertion. If the index is < 0 or greater than the current number of sub - trees, the new one will be added at the end of the list.
| ValueTree krotos::CustomParameterTree::getChild | ( | int | index | ) | const |
Returns one of this tree's sub-trees. If the index is out of range, it'll return an invalid tree. (You can use isValid() to check whether a tree is valid)
| ValueTree krotos::CustomParameterTree::getChildWithName | ( | const Identifier & | type | ) | const |
Returns the first sub-tree with the specified type name. If no such child tree exists, it'll return an invalid tree. (You can use isValid() to check whether a tree is valid)
|
inline |
Get a reference to the ValueTree that holds this object's state.
|
inline |
Returns the CustomParameterTree type.
|
inline |
Get a pointer to the UndoManager used by this object.
| bool krotos::CustomParameterTree::isValid | ( | ) | const |
Returns true if this CustomParameter's ValueTree is valid.
| CustomParameterTree & krotos::CustomParameterTree::operator= | ( | const CustomParameterTree & | other | ) |
Copy assignment operator.
| bool krotos::CustomParameterTree::operator== | ( | const CustomParameterTree & | other | ) | const |
Comparison operator.
|
inline |
Removes all children from the tree.
| void krotos::CustomParameterTree::removeChild | ( | const ValueTree & | child | ) |
Removes the specified child from this tree's child-list.
|
inline |
Set the UndoManager that this object will use for all of its ValueTree interactions.
|
overridevirtual |
Reimplemented in krotos::SamplesTree.
|
overridevirtual |
Reimplemented in krotos::SamplesTree.
|
overridevirtual |
Reimplemented in krotos::SamplesTree.
| std::function<void(ValueTree& parentTree, ValueTree& childWhichHasBeenAdded)> krotos::CustomParameterTree::childAdded |
Assign a lambda to this object to be called when a child sub-tree has been added
| std::function<void(ValueTree& parentTree, ValueTree& childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved)> krotos::CustomParameterTree::childRemoved |
Assign a lambda to this object to be called when a child sub-tree has been removed
|
protected |
|
private |
| std::function<void(ValueTree& treeWhosePropertyHasChanged, const Identifier& property)> krotos::CustomParameterTree::propertyChanged |
Assign a lambda to this object to be called when a property of this tree (or of one of its sub-trees) has been changed.