1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

More ScopedPointer/unique_ptr compatibility work

This commit is contained in:
jules 2018-01-10 17:35:08 +00:00
parent 48a5fbd333
commit 1a60fa9765
80 changed files with 404 additions and 368 deletions

View file

@ -68,10 +68,10 @@ DocumentWindow::~DocumentWindow()
// Don't delete or remove the resizer components yourself! They're managed by the
// DocumentWindow, and you should leave them alone! You may have deleted them
// accidentally by careless use of deleteAllChildren()..?
jassert (menuBar == nullptr || getIndexOfChildComponent (menuBar) >= 0);
jassert (titleBarButtons[0] == nullptr || getIndexOfChildComponent (titleBarButtons[0]) >= 0);
jassert (titleBarButtons[1] == nullptr || getIndexOfChildComponent (titleBarButtons[1]) >= 0);
jassert (titleBarButtons[2] == nullptr || getIndexOfChildComponent (titleBarButtons[2]) >= 0);
jassert (menuBar == nullptr || getIndexOfChildComponent (menuBar.get()) >= 0);
jassert (titleBarButtons[0] == nullptr || getIndexOfChildComponent (titleBarButtons[0].get()) >= 0);
jassert (titleBarButtons[1] == nullptr || getIndexOfChildComponent (titleBarButtons[1].get()) >= 0);
jassert (titleBarButtons[2] == nullptr || getIndexOfChildComponent (titleBarButtons[2].get()) >= 0);
for (auto& b : titleBarButtons)
b.reset();
@ -140,7 +140,7 @@ void DocumentWindow::setMenuBar (MenuBarModel* newMenuBarModel, const int newMen
Component* DocumentWindow::getMenuBarComponent() const noexcept
{
return menuBar;
return menuBar.get();
}
void DocumentWindow::setMenuBarComponent (Component* newMenuBarComponent)
@ -229,9 +229,9 @@ void DocumentWindow::resized()
.positionDocumentWindowButtons (*this,
titleBarArea.getX(), titleBarArea.getY(),
titleBarArea.getWidth(), titleBarArea.getHeight(),
titleBarButtons[0],
titleBarButtons[1],
titleBarButtons[2],
titleBarButtons[0].get(),
titleBarButtons[1].get(),
titleBarButtons[2].get(),
positionTitleBarButtonsOnLeft);
if (menuBar != nullptr)
@ -270,9 +270,9 @@ Rectangle<int> DocumentWindow::getTitleBarArea()
return { border.getLeft(), border.getTop(), getWidth() - border.getLeftAndRight(), getTitleBarHeight() };
}
Button* DocumentWindow::getCloseButton() const noexcept { return titleBarButtons[2]; }
Button* DocumentWindow::getMinimiseButton() const noexcept { return titleBarButtons[0]; }
Button* DocumentWindow::getMaximiseButton() const noexcept { return titleBarButtons[1]; }
Button* DocumentWindow::getCloseButton() const noexcept { return titleBarButtons[2].get(); }
Button* DocumentWindow::getMinimiseButton() const noexcept { return titleBarButtons[0].get(); }
Button* DocumentWindow::getMaximiseButton() const noexcept { return titleBarButtons[1].get(); }
int DocumentWindow::getDesktopWindowStyleFlags() const
{
@ -305,11 +305,11 @@ void DocumentWindow::lookAndFeelChanged()
if (buttonListener == nullptr)
buttonListener.reset (new ButtonListenerProxy (*this));
b->addListener (buttonListener);
b->addListener (buttonListener.get());
b->setWantsKeyboardFocus (false);
// (call the Component method directly to avoid the assertion in ResizableWindow)
Component::addAndMakeVisible (b);
Component::addAndMakeVisible (b.get());
}
}