Browse Source

Added an option for centring a ThreadWithProgressWindow around a component.

tags/2021-05-28
jules 13 years ago
parent
commit
26d27f5f6e
2 changed files with 8 additions and 3 deletions
  1. +4
    -2
      modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp
  2. +4
    -1
      modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h

+ 4
- 2
modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp View File

@@ -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);


+ 4
- 1
modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.h View File

@@ -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();


Loading…
Cancel
Save