CustomBoundsConstrainer Aspect + Footer


#1

I am trying to set up a CustomBoundsConstrainer with an aspect ratio to display a movie inside a window that needs to leave space at the bottom for a "footer" containing player controls.  

It would seem as simple as this:

class CustomBoundsConstrainer : public ComponentBoundsConstrainer
{
    ~CustomBoundsConstrainer() {}
public:
    //==============================================================================
    void checkBounds(juce::Rectangle<int>& bounds,
        const juce::Rectangle<int>& old,
        const juce::Rectangle<int>& limits,
        const bool isStretchingTop,
        const bool isStretchingLeft,
        const bool isStretchingBottom,
        const bool isStretchingRight)
    {
        ComponentBoundsConstrainer::checkBounds(bounds, old, limits, isStretchingTop, isStretchingLeft, isStretchingBottom, isStretchingRight);
        // this makes it flip out!
        // we add height for a footer, that is all
        int newHeight = bounds.getHeight() + 72;
        bounds.setHeight(newHeight);
    }
};

I am getting very erratic results when I resize the window with this constrainer active. Any ideas what might be going on?

I am using the latest JUCE tip and VS 2013.

Thanks-

Steve


#2

Well yes - obviously if you repeatedly add 72 to the height, then it'll keep getting bigger!