migrating to the latest JUCE version

This commit is contained in:
2022-11-04 23:11:33 +01:00
committed by Nikolai Rodionov
parent 4257a0f8ba
commit faf8f18333
2796 changed files with 888518 additions and 784244 deletions

View File

@ -1,61 +1,52 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - 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 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-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
{
/** An abstract interface which represents a UI element that supports a cell interface.
This typically represents a single cell inside of a UI element which implements an
AccessibilityTableInterface.
@tags{Accessibility}
*/
class JUCE_API AccessibilityCellInterface
{
public:
/** Destructor. */
virtual ~AccessibilityCellInterface() = default;
/** Returns the column index of the cell in the table. */
virtual int getColumnIndex() const = 0;
/** Returns the number of columns occupied by the cell in the table. */
virtual int getColumnSpan() const = 0;
/** Returns the row index of the cell in the table. */
virtual int getRowIndex() const = 0;
/** Returns the number of rows occupied by the cell in the table. */
virtual int getRowSpan() const = 0;
/** Returns the indentation level for the cell. */
virtual int getDisclosureLevel() const = 0;
/** Returns the AccessibilityHandler of the table which contains the cell. */
virtual const AccessibilityHandler* getTableHandler() const = 0;
};
} // namespace juce
/*
==============================================================================
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
{
/** An abstract interface which represents a UI element that supports a cell interface.
This typically represents a single cell inside of a UI element which implements an
AccessibilityTableInterface.
@tags{Accessibility}
*/
class JUCE_API AccessibilityCellInterface
{
public:
/** Destructor. */
virtual ~AccessibilityCellInterface() = default;
/** Returns the indentation level for the cell. */
virtual int getDisclosureLevel() const = 0;
/** Returns the AccessibilityHandler of the table which contains the cell. */
virtual const AccessibilityHandler* getTableHandler() const = 0;
/** Returns a list of the accessibility elements that are disclosed by this element, if any. */
virtual std::vector<const AccessibilityHandler*> getDisclosedRows() const { return {}; }
};
} // namespace juce

View File

@ -1,54 +1,96 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - 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 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-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
{
/** An abstract interface which represents a UI element that supports a table interface.
Examples of UI elements which typically support a table interface are lists, tables,
and trees.
@tags{Accessibility}
*/
class JUCE_API AccessibilityTableInterface
{
public:
/** Destructor. */
virtual ~AccessibilityTableInterface() = default;
/** Returns the total number of rows in the table. */
virtual int getNumRows() const = 0;
/** Returns the total number of columns in the table. */
virtual int getNumColumns() const = 0;
/** Returns the AccessibilityHandler for one of the cells in the table, or
nullptr if there is no cell at the specified position.
*/
virtual const AccessibilityHandler* getCellHandler (int row, int column) const = 0;
};
} // namespace juce
/*
==============================================================================
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
{
/** An abstract interface which represents a UI element that supports a table interface.
Examples of UI elements which typically support a table interface are lists, tables,
and trees.
@tags{Accessibility}
*/
class JUCE_API AccessibilityTableInterface
{
public:
/** Destructor. */
virtual ~AccessibilityTableInterface() = default;
/** Returns the total number of rows in the table. */
virtual int getNumRows() const = 0;
/** Returns the total number of columns in the table. */
virtual int getNumColumns() const = 0;
/** Returns the AccessibilityHandler for one of the cells in the table, or
nullptr if there is no cell at the specified position.
*/
virtual const AccessibilityHandler* getCellHandler (int row, int column) const = 0;
/** Returns the AccessibilityHandler for a row in the table, or nullptr if there is
no row at this index.
The row component should have a child component for each column in the table.
*/
virtual const AccessibilityHandler* getRowHandler (int row) const = 0;
/** Returns the AccessibilityHandler for the header, or nullptr if there is
no header.
If you supply a header, it must have exactly the same number of children
as there are columns in the table.
*/
virtual const AccessibilityHandler* getHeaderHandler() const = 0;
struct Span { int begin, num; };
/** Given the handler of one of the cells in the table, returns the rows covered
by that cell, or null if the cell does not exist in the table.
This function replaces the getRowIndex and getRowSpan
functions from AccessibilityCellInterface. Most of the time, it's easier for the
table itself to keep track of cell locations, than to delegate to the individual
cells.
*/
virtual Optional<Span> getRowSpan (const AccessibilityHandler&) const = 0;
/** Given the handler of one of the cells in the table, returns the columns covered
by that cell, or null if the cell does not exist in the table.
This function replaces the getColumnIndex and getColumnSpan
functions from AccessibilityCellInterface. Most of the time, it's easier for the
table itself to keep track of cell locations, than to delegate to the individual
cells.
*/
virtual Optional<Span> getColumnSpan (const AccessibilityHandler&) const = 0;
/** Attempts to scroll the table (if necessary) so that the cell with the given handler
is visible.
*/
virtual void showCell (const AccessibilityHandler&) const = 0;
};
} // namespace juce

View File

@ -1,81 +1,84 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - 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 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-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
{
/** An abstract interface which represents a UI element that supports a text interface.
A UI element can use this interface to provide extended textual information which
cannot be conveyed using just the title, description, and help text properties of
AccessibilityHandler. This is typically for text that an accessibility client might
want to read line-by-line, or provide text selection and input for.
@tags{Accessibility}
*/
class JUCE_API AccessibilityTextInterface
{
public:
/** Destructor. */
virtual ~AccessibilityTextInterface() = default;
/** Returns true if the text being displayed is protected and should not be
exposed to the user, for example a password entry field.
*/
virtual bool isDisplayingProtectedText() const = 0;
/** Returns true if the text being displayed is read-only or false if editable. */
virtual bool isReadOnly() const = 0;
/** Returns the total number of characters in the text element. */
virtual int getTotalNumCharacters() const = 0;
/** Returns the range of characters that are currently selected, or an empty
range if nothing is selected.
*/
virtual Range<int> getSelection() const = 0;
/** Selects a section of the text. */
virtual void setSelection (Range<int> newRange) = 0;
/** Gets the current text insertion position, if supported. */
virtual int getTextInsertionOffset() const = 0;
/** Returns a section of text. */
virtual String getText (Range<int> range) const = 0;
/** Replaces the text with a new string. */
virtual void setText (const String& newText) = 0;
/** Returns the bounding box in screen coordinates for a range of text.
As the range may span multiple lines, this method returns a RectangleList.
*/
virtual RectangleList<int> getTextBounds (Range<int> textRange) const = 0;
/** Returns the index of the character at a given position in screen coordinates. */
virtual int getOffsetAtPoint (Point<int> point) const = 0;
};
} // namespace juce
/*
==============================================================================
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
{
/** An abstract interface which represents a UI element that supports a text interface.
A UI element can use this interface to provide extended textual information which
cannot be conveyed using just the title, description, and help text properties of
AccessibilityHandler. This is typically for text that an accessibility client might
want to read line-by-line, or provide text selection and input for.
@tags{Accessibility}
*/
class JUCE_API AccessibilityTextInterface
{
public:
/** Destructor. */
virtual ~AccessibilityTextInterface() = default;
/** Returns true if the text being displayed is protected and should not be
exposed to the user, for example a password entry field.
*/
virtual bool isDisplayingProtectedText() const = 0;
/** Returns true if the text being displayed is read-only or false if editable. */
virtual bool isReadOnly() const = 0;
/** Returns the total number of characters in the text element. */
virtual int getTotalNumCharacters() const = 0;
/** Returns the range of characters that are currently selected, or an empty
range if nothing is selected.
*/
virtual Range<int> getSelection() const = 0;
/** Selects a section of the text. */
virtual void setSelection (Range<int> newRange) = 0;
/** Gets the current text insertion position, if supported. */
virtual int getTextInsertionOffset() const = 0;
/** Returns a section of text. */
virtual String getText (Range<int> range) const = 0;
/** Returns the full text. */
String getAllText() const { return getText ({ 0, getTotalNumCharacters() }); }
/** Replaces the text with a new string. */
virtual void setText (const String& newText) = 0;
/** Returns the bounding box in screen coordinates for a range of text.
As the range may span multiple lines, this method returns a RectangleList.
*/
virtual RectangleList<int> getTextBounds (Range<int> textRange) const = 0;
/** Returns the index of the character at a given position in screen coordinates. */
virtual int getOffsetAtPoint (Point<int> point) const = 0;
};
} // namespace juce

View File

@ -1,222 +1,222 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - 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 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-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
{
/** An abstract interface representing the value of an accessibility element.
Values should be used when information needs to be conveyed which cannot
be represented by the accessibility element's label alone. For example, a
gain slider with the label "Gain" needs to also provide a value for its
position whereas a "Save" button does not.
This class allows for full control over the value text/numeric conversion,
ranged, and read-only properties but in most cases you'll want to use one
of the derived classes below which handle some of this for you.
@see AccessibilityTextValueInterface, AccessibilityNumericValueInterface,
AccessibilityRangedNumericValueInterface
@tags{Accessibility}
*/
class JUCE_API AccessibilityValueInterface
{
public:
/** Destructor. */
virtual ~AccessibilityValueInterface() = default;
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValue, setValueAsString
*/
virtual bool isReadOnly() const = 0;
/** Returns the current value as a double. */
virtual double getCurrentValue() const = 0;
/** Returns the current value as a String. */
virtual String getCurrentValueAsString() const = 0;
/** Sets the current value to a new double value. */
virtual void setValue (double newValue) = 0;
/** Sets the current value to a new String value. */
virtual void setValueAsString (const String& newValue) = 0;
/** Represents the range of this value, if supported.
Return one of these from the `getRange()` method, providing a minimum,
maximum, and interval value for the range to indicate that this is a
ranged value.
The default state is an "invalid" range, indicating that the accessibility
element does not support ranged values.
@see AccessibilityRangedNumericValueInterface
@tags{Accessibility}
*/
class JUCE_API AccessibleValueRange
{
public:
/** Constructor.
Creates a default, "invalid" range that can be returned from
`AccessibilityValueInterface::getRange()` to indicate that the value
interface does not support ranged values.
*/
AccessibleValueRange() = default;
/** The minimum and maximum values for this range, inclusive. */
struct JUCE_API MinAndMax { double min, max; };
/** Constructor.
Creates a valid AccessibleValueRange with the provided minimum, maximum,
and interval values.
*/
AccessibleValueRange (MinAndMax valueRange, double interval)
: valid (true),
range (valueRange),
stepSize (interval)
{
jassert (range.min < range.max);
}
/** Returns true if this represents a valid range. */
bool isValid() const noexcept { return valid; }
/** Returns the minimum value for this range. */
double getMinimumValue() const noexcept { return range.min; }
/** Returns the maxiumum value for this range. */
double getMaximumValue() const noexcept { return range.max; }
/** Returns the interval for this range. */
double getInterval() const noexcept { return stepSize; }
private:
bool valid = false;
MinAndMax range {};
double stepSize = 0.0;
};
/** If this is a ranged value, this should return a valid AccessibleValueRange
object representing the supported numerical range.
*/
virtual AccessibleValueRange getRange() const = 0;
};
//==============================================================================
/** A value interface that represents a text value.
@tags{Accessibility}
*/
class JUCE_API AccessibilityTextValueInterface : public AccessibilityValueInterface
{
public:
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValueAsString
*/
bool isReadOnly() const override = 0;
/** Returns the current value. */
String getCurrentValueAsString() const override = 0;
/** Sets the current value to a new value. */
void setValueAsString (const String& newValue) override = 0;
/** @internal */
double getCurrentValue() const final { return getCurrentValueAsString().getDoubleValue(); }
/** @internal */
void setValue (double newValue) final { setValueAsString (String (newValue)); }
/** @internal */
AccessibleValueRange getRange() const final { return {}; }
};
//==============================================================================
/** A value interface that represents a non-ranged numeric value.
@tags{Accessibility}
*/
class JUCE_API AccessibilityNumericValueInterface : public AccessibilityValueInterface
{
public:
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValue
*/
bool isReadOnly() const override = 0;
/** Returns the current value. */
double getCurrentValue() const override = 0;
/** Sets the current value to a new value. */
void setValue (double newValue) override = 0;
/** @internal */
String getCurrentValueAsString() const final { return String (getCurrentValue()); }
/** @internal */
void setValueAsString (const String& newValue) final { setValue (newValue.getDoubleValue()); }
/** @internal */
AccessibleValueRange getRange() const final { return {}; }
};
//==============================================================================
/** A value interface that represents a ranged numeric value.
@tags{Accessibility}
*/
class JUCE_API AccessibilityRangedNumericValueInterface : public AccessibilityValueInterface
{
public:
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValueAsString
*/
bool isReadOnly() const override = 0;
/** Returns the current value. */
double getCurrentValue() const override = 0;
/** Sets the current value to a new value. */
void setValue (double newValue) override = 0;
/** Returns the range. */
AccessibleValueRange getRange() const override = 0;
/** @internal */
String getCurrentValueAsString() const final { return String (getCurrentValue()); }
/** @internal */
void setValueAsString (const String& newValue) final { setValue (newValue.getDoubleValue()); }
};
} // namespace juce
/*
==============================================================================
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
{
/** An abstract interface representing the value of an accessibility element.
Values should be used when information needs to be conveyed which cannot
be represented by the accessibility element's label alone. For example, a
gain slider with the label "Gain" needs to also provide a value for its
position whereas a "Save" button does not.
This class allows for full control over the value text/numeric conversion,
ranged, and read-only properties but in most cases you'll want to use one
of the derived classes below which handle some of this for you.
@see AccessibilityTextValueInterface, AccessibilityNumericValueInterface,
AccessibilityRangedNumericValueInterface
@tags{Accessibility}
*/
class JUCE_API AccessibilityValueInterface
{
public:
/** Destructor. */
virtual ~AccessibilityValueInterface() = default;
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValue, setValueAsString
*/
virtual bool isReadOnly() const = 0;
/** Returns the current value as a double. */
virtual double getCurrentValue() const = 0;
/** Returns the current value as a String. */
virtual String getCurrentValueAsString() const = 0;
/** Sets the current value to a new double value. */
virtual void setValue (double newValue) = 0;
/** Sets the current value to a new String value. */
virtual void setValueAsString (const String& newValue) = 0;
/** Represents the range of this value, if supported.
Return one of these from the `getRange()` method, providing a minimum,
maximum, and interval value for the range to indicate that this is a
ranged value.
The default state is an "invalid" range, indicating that the accessibility
element does not support ranged values.
@see AccessibilityRangedNumericValueInterface
@tags{Accessibility}
*/
class JUCE_API AccessibleValueRange
{
public:
/** Constructor.
Creates a default, "invalid" range that can be returned from
`AccessibilityValueInterface::getRange()` to indicate that the value
interface does not support ranged values.
*/
AccessibleValueRange() = default;
/** The minimum and maximum values for this range, inclusive. */
struct JUCE_API MinAndMax { double min, max; };
/** Constructor.
Creates a valid AccessibleValueRange with the provided minimum, maximum,
and interval values.
*/
AccessibleValueRange (MinAndMax valueRange, double interval)
: valid (true),
range (valueRange),
stepSize (interval)
{
jassert (range.min < range.max);
}
/** Returns true if this represents a valid range. */
bool isValid() const noexcept { return valid; }
/** Returns the minimum value for this range. */
double getMinimumValue() const noexcept { return range.min; }
/** Returns the maximum value for this range. */
double getMaximumValue() const noexcept { return range.max; }
/** Returns the interval for this range. */
double getInterval() const noexcept { return stepSize; }
private:
bool valid = false;
MinAndMax range {};
double stepSize = 0.0;
};
/** If this is a ranged value, this should return a valid AccessibleValueRange
object representing the supported numerical range.
*/
virtual AccessibleValueRange getRange() const = 0;
};
//==============================================================================
/** A value interface that represents a text value.
@tags{Accessibility}
*/
class JUCE_API AccessibilityTextValueInterface : public AccessibilityValueInterface
{
public:
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValueAsString
*/
bool isReadOnly() const override = 0;
/** Returns the current value. */
String getCurrentValueAsString() const override = 0;
/** Sets the current value to a new value. */
void setValueAsString (const String& newValue) override = 0;
/** @internal */
double getCurrentValue() const final { return getCurrentValueAsString().getDoubleValue(); }
/** @internal */
void setValue (double newValue) final { setValueAsString (String (newValue)); }
/** @internal */
AccessibleValueRange getRange() const final { return {}; }
};
//==============================================================================
/** A value interface that represents a non-ranged numeric value.
@tags{Accessibility}
*/
class JUCE_API AccessibilityNumericValueInterface : public AccessibilityValueInterface
{
public:
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValue
*/
bool isReadOnly() const override = 0;
/** Returns the current value. */
double getCurrentValue() const override = 0;
/** Sets the current value to a new value. */
void setValue (double newValue) override = 0;
/** @internal */
String getCurrentValueAsString() const final { return String (getCurrentValue()); }
/** @internal */
void setValueAsString (const String& newValue) final { setValue (newValue.getDoubleValue()); }
/** @internal */
AccessibleValueRange getRange() const final { return {}; }
};
//==============================================================================
/** A value interface that represents a ranged numeric value.
@tags{Accessibility}
*/
class JUCE_API AccessibilityRangedNumericValueInterface : public AccessibilityValueInterface
{
public:
/** Returns true if the value is read-only and cannot be modified by an
accessibility client.
@see setValueAsString
*/
bool isReadOnly() const override = 0;
/** Returns the current value. */
double getCurrentValue() const override = 0;
/** Sets the current value to a new value. */
void setValue (double newValue) override = 0;
/** Returns the range. */
AccessibleValueRange getRange() const override = 0;
/** @internal */
String getCurrentValueAsString() const final { return String (getCurrentValue()); }
/** @internal */
void setValueAsString (const String& newValue) final { setValue (newValue.getDoubleValue()); }
};
} // namespace juce