Gin
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
LambdaValueTreeListener Class Reference

Listens to ValueTree changes using lambda functions instead of virtual methods. More...

#include <gin_valuetreeutilities.h>

Inherits juce::ValueTree::Listener.

Public Member Functions

 LambdaValueTreeListener (juce::ValueTree v_)
 Creates a listener for the specified ValueTree.
 

Public Attributes

std::function< void()> onChanged
 Called whenever any change occurs to the ValueTree.
 
std::function< void(juce::ValueTree &, const juce::Identifier &)> onValueTreePropertyChanged
 Called when a property value changes.
 
std::function< void(juce::ValueTree &, juce::ValueTree &)> onValueTreeChildAdded
 Called when a child is added.
 
std::function< void(juce::ValueTree &, juce::ValueTree &, int)> onValueTreeChildRemoved
 Called when a child is removed.
 
std::function< void(juce::ValueTree &, int, int)> onValueTreeChildOrderChanged
 Called when children are reordered.
 
std::function< void(juce::ValueTree &)> onValueTreeParentChanged
 Called when the parent changes.
 
std::function< void(juce::ValueTree &)> onValueTreeRedirected
 Called when the tree is redirected to a different shared state.
 

Detailed Description

Listens to ValueTree changes using lambda functions instead of virtual methods.

This class provides a more convenient way to listen to ValueTree changes by setting std::function callbacks rather than overriding virtual methods. You can set only the callbacks you're interested in.

Example usage:

listener.onChanged = [this] { updateUI(); };
listener.onValueTreePropertyChanged = [this] (juce::ValueTree& v, const juce::Identifier& prop) {
DBG ("Property changed: " + prop.toString());
};
Listens to ValueTree changes using lambda functions instead of virtual methods.
Definition gin_valuetreeutilities.h:54
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
See also
AsyncLambdaValueTreeListener

Constructor & Destructor Documentation

◆ LambdaValueTreeListener()

LambdaValueTreeListener::LambdaValueTreeListener ( juce::ValueTree  v_)

Creates a listener for the specified ValueTree.

Parameters
v_The ValueTree to listen to

Member Data Documentation

◆ onChanged

std::function<void ()> LambdaValueTreeListener::onChanged

Called whenever any change occurs to the ValueTree.

◆ onValueTreePropertyChanged

std::function<void (juce::ValueTree&, const juce::Identifier&)> LambdaValueTreeListener::onValueTreePropertyChanged

Called when a property value changes.

Parameters: (tree, property identifier)

◆ onValueTreeChildAdded

std::function<void (juce::ValueTree&, juce::ValueTree&)> LambdaValueTreeListener::onValueTreeChildAdded

Called when a child is added.

Parameters: (parent tree, child that was added)

◆ onValueTreeChildRemoved

std::function<void (juce::ValueTree&, juce::ValueTree&, int)> LambdaValueTreeListener::onValueTreeChildRemoved

Called when a child is removed.

Parameters: (parent tree, child that was removed, index)

◆ onValueTreeChildOrderChanged

std::function<void (juce::ValueTree&, int, int)> LambdaValueTreeListener::onValueTreeChildOrderChanged

Called when children are reordered.

Parameters: (tree, old index, new index)

◆ onValueTreeParentChanged

std::function<void (juce::ValueTree&)> LambdaValueTreeListener::onValueTreeParentChanged

Called when the parent changes.

Parameters: (tree whose parent changed)

◆ onValueTreeRedirected

std::function<void (juce::ValueTree&)> LambdaValueTreeListener::onValueTreeRedirected

Called when the tree is redirected to a different shared state.

Parameters: (tree)


The documentation for this class was generated from the following file: