/* ============================================================================== This file is part of the JUCE framework. Copyright (c) Raw Material Software Limited JUCE is an open source framework subject to commercial or open source licensing. By downloading, installing, or using the JUCE framework, or combining the JUCE framework with any other source code, object code, content or any other copyrightable work, you agree to the terms of the JUCE End User Licence Agreement, and all incorporated terms including the JUCE Privacy Policy and the JUCE Website Terms of Service, as applicable, which will bind you. If you do not agree to the terms of these agreements, we will not license the JUCE framework to you, and you must discontinue the installation or download process and cease use of the JUCE framework. JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ JUCE Privacy Policy: https://juce.com/juce-privacy-policy JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ Or: You may also use this code under the terms of the AGPLv3: https://www.gnu.org/licenses/agpl-3.0.en.html THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. ============================================================================== */ namespace juce { //============================================================================== /** A progress bar component. To use this, just create one and make it visible. It'll run its own timer to keep an eye on a variable that you give it, and will automatically redraw itself when the variable changes. Two styles of progress bars are supported: circular, and linear bar. If a style isn't given the look-and-feel will determine the style based on getDefaultProgressBarStyle(). For an easy way of running a background task with a dialog box showing its progress, see the ThreadWithProgressWindow class. @see ThreadWithProgressWindow @tags{GUI} */ class JUCE_API ProgressBar : public Component, public SettableTooltipClient, private Timer { public: /** The types of ProgressBar styles available. @see setStyle, getStyle, getResolvedStyle */ enum class Style { linear, /**< A linear progress bar. */ circular, /**< A circular progress indicator. */ }; //============================================================================== /** Creates a ProgressBar. The ProgressBar's style will initially be determined by the look-and-feel. @param progress pass in a reference to a double that you're going to update with your task's progress. The ProgressBar will monitor the value of this variable and will redraw itself when the value changes. The range is from 0 to 1.0 and JUCE LookAndFeel classes will draw a spinning animation for values outside this range. Obviously you'd better be careful not to delete this variable while the ProgressBar still exists! */ explicit ProgressBar (double& progress); /** Creates a ProgressBar with a specific style. @param progress pass in a reference to a double that you're going to update with your task's progress. The ProgressBar will monitor the value of this variable and will redraw itself when the value changes. The range is from 0 to 1.0 and JUCE LookAndFeel classes will draw a spinning animation for values outside this range. Obviously you'd better be careful not to delete this variable while the ProgressBar still exists! @param style the style of the progress bar. */ ProgressBar (double& progress, std::optional