Exemple #1
0
//==============================================================================
void ResizableWindow::paint (Graphics& g)
{
    getLookAndFeel().fillResizableWindowBackground (g, getWidth(), getHeight(),
                                                    getBorderThickness(), *this);

    if (! isFullScreen())
    {
        getLookAndFeel().drawResizableWindowBorder (g, getWidth(), getHeight(),
                                                    getBorderThickness(), *this);
    }

   #if JUCE_DEBUG
    /* If this fails, then you've probably written a subclass with a resized()
       callback but forgotten to make it call its parent class's resized() method.

       It's important when you override methods like resized(), moved(),
       etc., that you make sure the base class methods also get called.

       Of course you shouldn't really be overriding ResizableWindow::resized() anyway,
       because your content should all be inside the content component - and it's the
       content component's resized() method that you should be using to do your
       layout.
    */
    jassert (hasBeenResized || (getWidth() == 0 && getHeight() == 0));
   #endif
}
const BorderSize DocumentWindow::getContentComponentBorder()
{
    BorderSize border (getBorderThickness());

    border.setTop (border.getTop()
                        + (isUsingNativeTitleBar() ? 0 : titleBarHeight)
                        + (menuBar != 0 ? menuBarHeight : 0));

    return border;
}
Exemple #3
0
void ResizableWindow::resized()
{
    if (resizableBorder != nullptr)
    {
       #if JUCE_WINDOWS || JUCE_LINUX
        // hide the resizable border if the OS already provides one..
        resizableBorder->setVisible (! (isFullScreen() || isUsingNativeTitleBar()));
       #else
        resizableBorder->setVisible (! isFullScreen());
       #endif

        resizableBorder->setBorderThickness (getBorderThickness());
        resizableBorder->setSize (getWidth(), getHeight());
        resizableBorder->toBack();
    }

    if (resizableCorner != nullptr)
    {
       #if JUCE_MAC
        // hide the resizable border if the OS already provides one..
        resizableCorner->setVisible (! (isFullScreen() || isUsingNativeTitleBar()));
       #else
        resizableCorner->setVisible (! isFullScreen());
       #endif

        const int resizerSize = 18;
        resizableCorner->setBounds (getWidth() - resizerSize,
                                    getHeight() - resizerSize,
                                    resizerSize, resizerSize);
    }

    if (contentComponent != nullptr)
    {
        // The window expects to be able to be able to manage the size and position
        // of its content component, so you can't arbitrarily add a transform to it!
        jassert (! contentComponent->isTransformed());

        contentComponent->setBoundsInset (getContentComponentBorder());
    }

    updateLastPos();

   #if JUCE_DEBUG
    hasBeenResized = true;
   #endif
}
Exemple #4
0
void ResizableWindow::resized()
{
    const bool resizerHidden = isFullScreen() || isKioskMode() || isUsingNativeTitleBar();

    if (resizableBorder != nullptr)
    {
        resizableBorder->setVisible (! resizerHidden);
        resizableBorder->setBorderThickness (getBorderThickness());
        resizableBorder->setSize (getWidth(), getHeight());
        resizableBorder->toBack();
    }

    if (resizableCorner != nullptr)
    {
        resizableCorner->setVisible (! resizerHidden);

        const int resizerSize = 18;
        resizableCorner->setBounds (getWidth() - resizerSize,
                                    getHeight() - resizerSize,
                                    resizerSize, resizerSize);
    }

    if (contentComponent != nullptr)
    {
        // The window expects to be able to be able to manage the size and position
        // of its content component, so you can't arbitrarily add a transform to it!
        jassert (! contentComponent->isTransformed());

        contentComponent->setBoundsInset (getContentComponentBorder());
    }

    updateLastPosIfShowing();

   #if JUCE_DEBUG
    hasBeenResized = true;
   #endif
}
void VstPluginWindow::resizeContentComponent (const int width,
                                              const int height,
                                              const bool limitHeight)
{
    DBG ("VstPluginWindow::resizeContentComponent");

    int desiredWidth = width + 2
                       /* + getBorderThickness().getLeftAndRight ()*/;

    int desiredHeight = getTitleBarHeight()
                        + getMenuBarHeight()
                        + getBorderThickness().getTopAndBottom ()
                        + (content ? content->getTabbedPanelHeight () : 0)
                        + (content ? (content->hasMidiKeyboardOpen() ? content->getMidiKeyboardHeight() : 0) : 0);

    int maxHeight = height + desiredHeight;
    maxHeight = limitHeight ? jmin (700, maxHeight) : maxHeight;

    setSize (desiredWidth, maxHeight);

    if (limitHeight)
        setResizeLimits (desiredWidth, desiredHeight,
                         desiredWidth, maxHeight);
}
Exemple #6
0
BorderSize<int> ResizableWindow::getContentComponentBorder()
{
    return getBorderThickness();
}