mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-20 01:14:20 +00:00
Added an option for centring a ThreadWithProgressWindow around a component.
This commit is contained in:
parent
07a774adcc
commit
26d27f5f6e
2 changed files with 8 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue