diff --git a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp index d69f8eebb2..8beecf53d5 100644 --- a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp @@ -27,7 +27,8 @@ ThreadWithProgressWindow::ThreadWithProgressWindow (const String& title, const bool hasProgressBar, const bool hasCancelButton, const int timeOutMsWhenCancelling_, - const String& cancelButtonText) + const String& cancelButtonText, + Component* componentToCentreAround) : Thread ("Juce Progress Window"), progress (0.0), timeOutMsWhenCancelling (timeOutMsWhenCancelling_) @@ -35,7 +36,8 @@ ThreadWithProgressWindow::ThreadWithProgressWindow (const String& title, alertWindow = LookAndFeel::getDefaultLookAndFeel() .createAlertWindow (title, String::empty, cancelButtonText, String::empty, String::empty, - AlertWindow::NoIcon, hasCancelButton ? 1 : 0, 0); + AlertWindow::NoIcon, hasCancelButton ? 1 : 0, + componentToCentreAround); // if there are no buttons, we won't allow the user to interrupt the thread. alertWindow->setEscapeKeyCancels (false); diff --git a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h index df5e260669..f70bad1054 100644 --- a/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h +++ b/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h @@ -100,12 +100,15 @@ public: Thread::stopThread() ) @param cancelButtonText the text that should be shown in the cancel button (if it has one) + @param componentToCentreAround if this is non-null, the window will be positioned + so that it's centred around this component. */ ThreadWithProgressWindow (const String& windowTitle, bool hasProgressBar, bool hasCancelButton, int timeOutMsWhenCancelling = 10000, - const String& cancelButtonText = "Cancel"); + const String& cancelButtonText = "Cancel", + Component* componentToCentreAround = nullptr); /** Destructor. */ ~ThreadWithProgressWindow();