PropertyPanel Section Open/Closed notification

Hey Jules et al, I have a number of stacked PropertyPanels and would like to be informed when a section has been opened or closed so I can reset the stack of panels nicely.  getTotalContentHeight gives me the right height but I don't seem to have a means to detect when it actually changes.  I could sledgehammer it with a timer but that would obviously be less than ideal.

Perhaps I'm missing something but if not would it make sense to add an appropriate listener callback for this?

Can't you just watch for changes in their size?

Sorry I should have mentioned that I tried a component listener on the panel.  I can double check it later tonight but the code for SectionComponent::setOpen calls resized on the property panel which appears to just modify the content size, not the panel itself.

 

SectionComponent::setOpen


 void setOpen (const bool open)
    {
        if (sectionIsOpen != open)
        {
            sectionIsOpen = open;
            for (int i = propertyComps.size(); --i >= 0;)
                propertyComps.getUnchecked(i)->setVisible (open);
            if (PropertyPanel* const pp = findParentComponentOfClass<PropertyPanel>())
                pp->resized();
        }
    }

PropertyPanel::resized


void PropertyPanel::resized()
{
    viewport.setBounds (getLocalBounds());
    updatePropHolderLayout();
}

PropertyPanel::updatePropHolderLayout


void PropertyPanel::updatePropHolderLayout() const
{
    const int maxWidth = viewport.getMaximumVisibleWidth();
    propertyHolderComponent->updateLayout (maxWidth);
    const int newMaxWidth = viewport.getMaximumVisibleWidth();
    if (maxWidth != newMaxWidth)
    {
        // need to do this twice because of scrollbars changing the size, etc.
        propertyHolderComponent->updateLayout (newMaxWidth);
    }
}

I double checked the component listener and there's nothing happening there.  I don't mind just rolling my own implementation though so no problem if you'd prefer to leave it as is.

SectionComponent::setOpen calls resized on the property panel which appears to just modify the content size, not the panel itself.

Well yes - I actually meant that you should monitor the content for changes in size, not the panel, which obviously won't change..

Hmm..  Perhaps I'm being dense here but how would I monitor the size changes of the content?  The inner viewport which holds all the content is private. (?)  It also seems to remain the same size as the panel, so only the viewport's viewed component actually changes.  Without resorting to adding a component listener with a couple getChildComponent calls I can't see how it's doable.