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_AccessibilityValueInterface.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
46{
47public:
49 virtual ~AccessibilityValueInterface() = default;
50
56 virtual bool isReadOnly() const = 0;
57
59 virtual double getCurrentValue() const = 0;
60
62 virtual String getCurrentValueAsString() const = 0;
63
65 virtual void setValue (double newValue) = 0;
66
68 virtual void setValueAsString (const String& newValue) = 0;
69
83 class JUCE_API AccessibleValueRange
84 {
85 public:
93
95 struct JUCE_API MinAndMax { double min, max; };
96
102 AccessibleValueRange (MinAndMax valueRange, double interval)
103 : valid (true),
104 range (valueRange),
105 stepSize (interval)
106 {
107 jassert (range.min < range.max);
108 }
109
111 bool isValid() const noexcept { return valid; }
112
114 double getMinimumValue() const noexcept { return range.min; }
115
117 double getMaximumValue() const noexcept { return range.max; }
118
120 double getInterval() const noexcept { return stepSize; }
121
122 private:
123 bool valid = false;
124 MinAndMax range {};
125 double stepSize = 0.0;
126 };
127
131 virtual AccessibleValueRange getRange() const = 0;
132};
133
134//==============================================================================
140{
141public:
147 bool isReadOnly() const override = 0;
148
150 String getCurrentValueAsString() const override = 0;
151
153 void setValueAsString (const String& newValue) override = 0;
154
156 double getCurrentValue() const final { return getCurrentValueAsString().getDoubleValue(); }
158 void setValue (double newValue) final { setValueAsString (String (newValue)); }
160 AccessibleValueRange getRange() const final { return {}; }
161};
162
163//==============================================================================
169{
170public:
176 bool isReadOnly() const override = 0;
177
179 double getCurrentValue() const override = 0;
180
182 void setValue (double newValue) override = 0;
183
185 String getCurrentValueAsString() const final { return String (getCurrentValue()); }
187 void setValueAsString (const String& newValue) final { setValue (newValue.getDoubleValue()); }
189 AccessibleValueRange getRange() const final { return {}; }
190};
191
192//==============================================================================
198{
199public:
205 bool isReadOnly() const override = 0;
206
208 double getCurrentValue() const override = 0;
209
211 void setValue (double newValue) override = 0;
212
214 AccessibleValueRange getRange() const override = 0;
215
217 String getCurrentValueAsString() const final { return String (getCurrentValue()); }
219 void setValueAsString (const String& newValue) final { setValue (newValue.getDoubleValue()); }
220};
221
222} // namespace juce
A value interface that represents a non-ranged numeric value.
void setValue(double newValue) override=0
Sets the current value to a new value.
String getCurrentValueAsString() const final
Returns the current value as a String.
AccessibleValueRange getRange() const final
If this is a ranged value, this should return a valid AccessibleValueRange object representing the su...
bool isReadOnly() const override=0
Returns true if the value is read-only and cannot be modified by an accessibility client.
double getCurrentValue() const override=0
Returns the current value.
void setValueAsString(const String &newValue) final
Sets the current value to a new String value.
A value interface that represents a ranged numeric value.
void setValue(double newValue) override=0
Sets the current value to a new value.
void setValueAsString(const String &newValue) final
Sets the current value to a new String value.
double getCurrentValue() const override=0
Returns the current value.
bool isReadOnly() const override=0
Returns true if the value is read-only and cannot be modified by an accessibility client.
AccessibleValueRange getRange() const override=0
Returns the range.
String getCurrentValueAsString() const final
Returns the current value as a String.
A value interface that represents a text value.
void setValue(double newValue) final
Sets the current value to a new double value.
AccessibleValueRange getRange() const final
If this is a ranged value, this should return a valid AccessibleValueRange object representing the su...
String getCurrentValueAsString() const override=0
Returns the current value.
double getCurrentValue() const final
Returns the current value as a double.
bool isReadOnly() const override=0
Returns true if the value is read-only and cannot be modified by an accessibility client.
void setValueAsString(const String &newValue) override=0
Sets the current value to a new value.
double getMaximumValue() const noexcept
Returns the maximum value for this range.
double getInterval() const noexcept
Returns the interval for this range.
double getMinimumValue() const noexcept
Returns the minimum value for this range.
bool isValid() const noexcept
Returns true if this represents a valid range.
AccessibleValueRange(MinAndMax valueRange, double interval)
Constructor.
An abstract interface representing the value of an accessibility element.
virtual double getCurrentValue() const =0
Returns the current value as a double.
virtual void setValueAsString(const String &newValue)=0
Sets the current value to a new String value.
virtual bool isReadOnly() const =0
Returns true if the value is read-only and cannot be modified by an accessibility client.
virtual String getCurrentValueAsString() const =0
Returns the current value as a String.
virtual void setValue(double newValue)=0
Sets the current value to a new double value.
virtual ~AccessibilityValueInterface()=default
Destructor.
virtual AccessibleValueRange getRange() const =0
If this is a ranged value, this should return a valid AccessibleValueRange object representing the su...
The JUCE String class!
Definition juce_String.h:53
#define jassert(expression)
Platform-independent assertion macro.
JUCE Namespace.