/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2022 - Raw Material Software Limited JUCE is an open source library subject to commercial or open-source licensing. By using JUCE, you agree to the terms of both the JUCE 7 End-User License Agreement and JUCE Privacy Policy. End User License Agreement: www.juce.com/juce-7-licence Privacy Policy: www.juce.com/juce-privacy-policy Or: You may also use this code under the terms of the GPL v3 (see www.gnu.org/licenses). JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR 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