35 :
Thread (
"ThreadWithProgressWindow"),
38 wasCancelledByUser (
false)
41 .createAlertWindow (title, {},
45 componentToCentreAround));
48 alertWindow->setEscapeKeyCancels (
false);
51 alertWindow->addProgressBarComponent (progress);
68 alertWindow->setMessage (message);
71 alertWindow->enterModalState();
85void ThreadWithProgressWindow::timerCallback()
93 alertWindow->exitModalState (1);
94 alertWindow->setVisible (
false);
102 alertWindow->setMessage (message);
107#if JUCE_MODAL_LOOPS_PERMITTED
115 return ! wasCancelledByUser;
The base class for all JUCE user-interface objects.
Automatically locks and unlocks a mutex object.
static LookAndFeel & getDefaultLookAndFeel() noexcept
Returns the current default look-and-feel for a component to use when it hasn't got one explicitly se...
static MessageManager * getInstance()
Returns the global instance of the MessageManager.
bool isEmpty() const noexcept
Returns true if the string contains no characters.
~ThreadWithProgressWindow() override
Destructor.
void setStatusMessage(const String &newStatusMessage)
The thread can call this to change the message that's displayed in the dialog box.
void launchThread(Priority priority=Priority::normal)
Starts the thread and returns.
ThreadWithProgressWindow(const String &windowTitle, bool hasProgressBar, bool hasCancelButton, int timeOutMsWhenCancelling=10000, const String &cancelButtonText=String(), Component *componentToCentreAround=nullptr)
Creates the thread.
void setProgress(double newProgress)
The thread should call this periodically to update the position of the progress bar.
virtual void threadComplete(bool userPressedCancel)
This method is called (on the message thread) when the operation has finished.
bool startThread()
Attempts to start a new thread with default ('Priority::normal') priority.
bool stopThread(int timeOutMilliseconds)
Attempts to stop the thread running.
Priority
The different runtime priorities of non-realtime threads.
bool isThreadRunning() const
Returns true if the thread is currently active.
void stopTimer() noexcept
Stops the timer.
bool isTimerRunning() const noexcept
Returns true if the timer is currently running.
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
#define TRANS(stringLiteral)
Uses the LocalisedStrings class to translate the given string literal.
#define JUCE_ASSERT_MESSAGE_THREAD
This macro is used to catch unsafe use of functions which expect to only be called on the message thr...
CriticalSection::ScopedLockType ScopedLock
Automatically locks and unlocks a CriticalSection object.
@ NoIcon
No icon will be shown on the dialog box.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...