JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::TreeViewItem::OpennessRestorer Class Reference

This handy class takes a copy of a TreeViewItem's openness when you create it, and restores that openness state when its destructor is called. More...

#include <juce_TreeView.h>

Collaboration diagram for juce::TreeViewItem::OpennessRestorer:

Public Member Functions

 OpennessRestorer (TreeViewItem &)
 
 ~OpennessRestorer ()
 

Private Attributes

std::unique_ptr< XmlElementoldOpenness
 
TreeViewItemtreeViewItem
 

Detailed Description

This handy class takes a copy of a TreeViewItem's openness when you create it, and restores that openness state when its destructor is called.

This can very handy when you're refreshing sub-items - e.g.

void MyTreeViewItem::updateChildItems()
{
OpennessRestorer openness (*this); // saves the openness state here..
// add a bunch of sub-items here which may or may not be the same as the ones that
// were previously there
// ..and at this point, the old openness is restored, so any items that haven't
// changed will have their old openness retained.
}

Constructor & Destructor Documentation

◆ OpennessRestorer()

juce::TreeViewItem::OpennessRestorer::OpennessRestorer ( TreeViewItem )

◆ ~OpennessRestorer()

juce::TreeViewItem::OpennessRestorer::~OpennessRestorer ( )

Member Data Documentation

◆ oldOpenness

std::unique_ptr<XmlElement> juce::TreeViewItem::OpennessRestorer::oldOpenness
private

◆ treeViewItem

TreeViewItem& juce::TreeViewItem::OpennessRestorer::treeViewItem
private

The documentation for this class was generated from the following file:
juce::TreeViewItem::OpennessRestorer::OpennessRestorer
OpennessRestorer(TreeViewItem &)
juce::TreeViewItem::addSubItem
void addSubItem(TreeViewItem *newItem, int insertPosition=-1)
Adds a sub-item.
juce::TreeViewItem::clearSubItems
void clearSubItems()
Removes any sub-items.
juce::TreeViewItem::openness
Openness openness
Definition: juce_TreeView.h:636