JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_ProgressBar.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
46class JUCE_API ProgressBar : public Component,
48 private Timer
49{
50public:
55 enum class Style
56 {
57 linear,
58 circular,
59 };
60
61 //==============================================================================
74 explicit ProgressBar (double& progress);
75
87 ProgressBar (double& progress, std::optional<Style> style);
88
90 ~ProgressBar() override = default;
91
92 //==============================================================================
98 void setPercentageDisplay (bool shouldDisplayPercentage);
99
105 void setTextToDisplay (const String& text);
106
116 void setStyle (std::optional<Style> newStyle);
117
122 std::optional<Style> getStyle() const { return style; }
123
132 Style getResolvedStyle() const;
133
134 //==============================================================================
143 {
144 backgroundColourId = 0x1001900,
145 foregroundColourId = 0x1001a00,
147 };
148
149 //==============================================================================
151 struct JUCE_API LookAndFeelMethods
152 {
153 virtual ~LookAndFeelMethods() = default;
154
167 virtual void drawProgressBar (Graphics&, ProgressBar&, int width, int height,
168 double progress, const String& textToShow) = 0;
169
170 virtual bool isProgressBarOpaque (ProgressBar&) = 0;
171
177 };
178
180 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
181
182protected:
183 //==============================================================================
185 void paint (Graphics&) override;
187 void lookAndFeelChanged() override;
189 void visibilityChanged() override;
191 void colourChanged() override;
192
193private:
194 double& progress;
196 double currentValue { jlimit (0.0, 1.0, progress) };
197 bool displayPercentage { true };
198 String displayedMessage, currentMessage;
199 uint32 lastCallbackTime { 0 };
200
201 void timerCallback() override;
202
204};
205
206} // namespace juce
The base class for all JUCE user-interface objects.
A graphics context, used for drawing a component or image.
A progress bar component.
~ProgressBar() override=default
Destructor.
ColourIds
A set of colour IDs to use to change the colour of various aspects of the bar.
Style
The types of ProgressBar styles available.
std::optional< Style > getStyle() const
Returns the progress bar's current style, as set in the constructor or in setStyle().
An implementation of TooltipClient that stores the tooltip string and a method for changing it.
The JUCE String class!
Definition juce_String.h:53
Makes repeated callbacks to a virtual method at a specified time interval.
Definition juce_Timer.h:52
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
This abstract base class is implemented by LookAndFeel classes.
virtual void drawProgressBar(Graphics &, ProgressBar &, int width, int height, double progress, const String &textToShow)=0
Draws a progress bar.
virtual Style getDefaultProgressBarStyle(const ProgressBar &)=0
Returns the default style a progress bar should use if one hasn't been set.