Krotos Modules 3
Loading...
Searching...
No Matches
ValueTreeAttachment.h
Go to the documentation of this file.
1namespace krotos
2{
3 class ValueTreeAttachment : public ValueTree::Listener
4 {
5 public:
6 ValueTreeAttachment(const ValueTree& tree) : m_tree(tree) { m_tree.addListener(this); }
7
8 ~ValueTreeAttachment() override { m_tree.removeListener(this); }
9
10 std::function<void(ValueTree&, const Identifier&)> onPropertyChanged{nullptr};
11 std::function<void(ValueTree&, ValueTree&)> onChildAdded{nullptr};
12 std::function<void(ValueTree&, ValueTree&)> onChildRemoved{nullptr};
13
14 private:
15 void valueTreePropertyChanged(ValueTree& tree, const Identifier& property) override
16 {
18 onPropertyChanged(tree, property);
19 }
20
21 void valueTreeChildAdded(ValueTree& parent, ValueTree& child) override
22 {
23 if (onChildAdded)
24 onChildAdded(parent, child);
25 }
26
27 void valueTreeChildRemoved(ValueTree& parent, ValueTree& child, int) override
28 {
30 onChildRemoved(parent, child);
31 }
32
33 ValueTree m_tree;
34
35 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ValueTreeAttachment)
36 };
37} // namespace krotos
Definition ValueTreeAttachment.h:4
ValueTree m_tree
Definition ValueTreeAttachment.h:33
std::function< void(ValueTree &, ValueTree &)> onChildAdded
Definition ValueTreeAttachment.h:11
std::function< void(ValueTree &, const Identifier &)> onPropertyChanged
Definition ValueTreeAttachment.h:10
void valueTreeChildAdded(ValueTree &parent, ValueTree &child) override
Definition ValueTreeAttachment.h:21
std::function< void(ValueTree &, ValueTree &)> onChildRemoved
Definition ValueTreeAttachment.h:12
~ValueTreeAttachment() override
Definition ValueTreeAttachment.h:8
ValueTreeAttachment(const ValueTree &tree)
Definition ValueTreeAttachment.h:6
void valueTreeChildRemoved(ValueTree &parent, ValueTree &child, int) override
Definition ValueTreeAttachment.h:27
void valueTreePropertyChanged(ValueTree &tree, const Identifier &property) override
Definition ValueTreeAttachment.h:15
Definition AirAbsorptionFilter.cpp:2