mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added method ValueTree::getRoot()
This commit is contained in:
parent
a15d79d4fe
commit
7eb534ae88
2 changed files with 22 additions and 7 deletions
|
|
@ -57,6 +57,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
SharedObject* getRoot() noexcept
|
||||
{
|
||||
return parent == nullptr ? this : parent->getRoot();
|
||||
}
|
||||
|
||||
template <typename Method>
|
||||
void callListeners (Method method, ValueTree& tree) const
|
||||
{
|
||||
|
|
@ -483,9 +488,8 @@ public:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
class SetPropertyAction : public UndoableAction
|
||||
struct SetPropertyAction : public UndoableAction
|
||||
{
|
||||
public:
|
||||
SetPropertyAction (SharedObject* const so, const Identifier& propertyName,
|
||||
const var& newVal, const var& oldVal, bool isAdding, bool isDeleting,
|
||||
ValueTree::Listener* listenerToExclude = nullptr)
|
||||
|
|
@ -547,9 +551,8 @@ public:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
class AddOrRemoveChildAction : public UndoableAction
|
||||
struct AddOrRemoveChildAction : public UndoableAction
|
||||
{
|
||||
public:
|
||||
AddOrRemoveChildAction (SharedObject* parentObject, int index, SharedObject* newChild)
|
||||
: target (parentObject),
|
||||
child (newChild != nullptr ? newChild : parentObject->children.getObjectPointer (index)),
|
||||
|
|
@ -600,9 +603,8 @@ public:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
class MoveChildAction : public UndoableAction
|
||||
struct MoveChildAction : public UndoableAction
|
||||
{
|
||||
public:
|
||||
MoveChildAction (SharedObject* parentObject, int fromIndex, int toIndex) noexcept
|
||||
: parent (parentObject), startIndex (fromIndex), endIndex (toIndex)
|
||||
{
|
||||
|
|
@ -751,6 +753,12 @@ ValueTree ValueTree::getParent() const noexcept
|
|||
: static_cast<SharedObject*> (nullptr));
|
||||
}
|
||||
|
||||
ValueTree ValueTree::getRoot() const noexcept
|
||||
{
|
||||
return ValueTree (object != nullptr ? object->getRoot()
|
||||
: static_cast<SharedObject*> (nullptr));
|
||||
}
|
||||
|
||||
ValueTree ValueTree::getSibling (const int delta) const noexcept
|
||||
{
|
||||
if (object == nullptr || object->parent == nullptr)
|
||||
|
|
|
|||
|
|
@ -320,6 +320,11 @@ public:
|
|||
*/
|
||||
ValueTree getParent() const noexcept;
|
||||
|
||||
/** Recusrively finds the highest-level parent node that contains this one.
|
||||
If the node has no parent, this will return itself.
|
||||
*/
|
||||
ValueTree getRoot() const noexcept;
|
||||
|
||||
/** Returns one of this node's siblings in its parent's child list.
|
||||
|
||||
The delta specifies how far to move through the list, so a value of 1 would return the node
|
||||
|
|
@ -486,7 +491,9 @@ public:
|
|||
/** Changes a named property of the node, but will not notify a specified listener of the change.
|
||||
@see setProperty
|
||||
*/
|
||||
ValueTree& setPropertyExcludingListener (Listener* listenerToExclude, const Identifier& name, const var& newValue, UndoManager* undoManager);
|
||||
ValueTree& setPropertyExcludingListener (Listener* listenerToExclude,
|
||||
const Identifier& name, const var& newValue,
|
||||
UndoManager* undoManager);
|
||||
|
||||
/** Causes a property-change callback to be triggered for the specified property,
|
||||
calling any listeners that are registered.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue