ffGuiAttachments
Attaches JUCE Components to ValueTrees to synchronise
 All Classes Namespaces Files Functions Pages
Public Member Functions | List of all members
ValueTreeComboBoxAttachment Class Reference

This attachment connects a node in a ValueTree with a combobox. More...

+ Inheritance diagram for ValueTreeComboBoxAttachment:

Public Member Functions

 ValueTreeComboBoxAttachment (juce::ValueTree &attachToTree, juce::ComboBox *comboBoxToAttach, juce::Identifier indexProperty, bool shouldSelectSubNodes, juce::UndoManager *undoManagerToUse=nullptr)
 Create a ValueTreeComboBoxAttachment It handles updates from a ValueTree to a ComboBox and vice versa. More...
 
 ~ValueTreeComboBoxAttachment ()
 
void comboBoxChanged (juce::ComboBox *comboBoxThatHasChanged) override
 Updates the ValueTree's property if the ComboBox has changed. More...
 
void valueTreePropertyChanged (juce::ValueTree &treeWhosePropertyHasChanged, const juce::Identifier &changedProperty) override
 Updates the ComboBox property if the ValueTree has changed. More...
 
void valueTreeChildAdded (juce::ValueTree &parentTree, juce::ValueTree &childWhichHasBeenAdded) override
 If the ValueTree has new child nodes, they will be added as options in the ComboBox. More...
 
void valueTreeChildRemoved (juce::ValueTree &parentTree, juce::ValueTree &childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved) override
 If child nodes were removed from the ValueTree, the options of the ComboBox are updated. More...
 
void valueTreeChildOrderChanged (juce::ValueTree &parentTreeWhoseChildrenHaveMoved, int oldIndex, int newIndex) override
 
void valueTreeParentChanged (juce::ValueTree &treeWhoseParentHasChanged) override
 
void valueTreeRedirected (juce::ValueTree &treeWhichHasBeenChanged) override
 

Detailed Description

This attachment connects a node in a ValueTree with a combobox.

The ValueTreeComboBoxAttachment supports two modes: selectSubNodes == true: The Combobox is filled with the sub nodes. As combobox items the property is used.

selectSubNodes == false: The combobox has already it's items and the selected index is stored in the property.

Constructor & Destructor Documentation

ValueTreeComboBoxAttachment::ValueTreeComboBoxAttachment ( juce::ValueTree &  attachToTree,
juce::ComboBox *  comboBoxToAttach,
juce::Identifier  indexProperty,
bool  shouldSelectSubNodes,
juce::UndoManager *  undoManagerToUse = nullptr 
)

Create a ValueTreeComboBoxAttachment It handles updates from a ValueTree to a ComboBox and vice versa.

If you set

Parameters
selectSubNodes,theComboBox will get the child nodes as options. The selected child node will get the property "selected" == 1.
ValueTreeComboBoxAttachment::~ValueTreeComboBoxAttachment ( )

Member Function Documentation

void ValueTreeComboBoxAttachment::comboBoxChanged ( juce::ComboBox *  comboBoxThatHasChanged)
override

Updates the ValueTree's property if the ComboBox has changed.

void ValueTreeComboBoxAttachment::valueTreePropertyChanged ( juce::ValueTree &  treeWhosePropertyHasChanged,
const juce::Identifier &  changedProperty 
)
override

Updates the ComboBox property if the ValueTree has changed.

void ValueTreeComboBoxAttachment::valueTreeChildAdded ( juce::ValueTree &  parentTree,
juce::ValueTree &  childWhichHasBeenAdded 
)
override

If the ValueTree has new child nodes, they will be added as options in the ComboBox.

void ValueTreeComboBoxAttachment::valueTreeChildRemoved ( juce::ValueTree &  parentTree,
juce::ValueTree &  childWhichHasBeenRemoved,
int  indexFromWhichChildWasRemoved 
)
override

If child nodes were removed from the ValueTree, the options of the ComboBox are updated.

void ValueTreeComboBoxAttachment::valueTreeChildOrderChanged ( juce::ValueTree &  parentTreeWhoseChildrenHaveMoved,
int  oldIndex,
int  newIndex 
)
override
void ValueTreeComboBoxAttachment::valueTreeParentChanged ( juce::ValueTree &  treeWhoseParentHasChanged)
override
void ValueTreeComboBoxAttachment::valueTreeRedirected ( juce::ValueTree &  treeWhichHasBeenChanged)
override

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