mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Nodiscard: Add to builder-pattern functions
This commit is contained in:
parent
c9c4d7a747
commit
b80927fc91
16 changed files with 146 additions and 140 deletions
|
|
@ -185,7 +185,7 @@ public:
|
|||
findPanel = (1 << 2)
|
||||
};
|
||||
|
||||
AdditionalComponents with (Type t)
|
||||
JUCE_NODISCARD AdditionalComponents with (Type t)
|
||||
{
|
||||
auto copy = *this;
|
||||
copy.componentTypes |= t;
|
||||
|
|
|
|||
|
|
@ -102,13 +102,13 @@ public:
|
|||
double getEffectiveRate() const { return pulldown ? (double) base / 1.001 : (double) base; }
|
||||
|
||||
/** Returns a copy of this object with the specified base rate. */
|
||||
FrameRate withBaseRate (int x) const { return with (&FrameRate::base, x); }
|
||||
JUCE_NODISCARD FrameRate withBaseRate (int x) const { return with (&FrameRate::base, x); }
|
||||
|
||||
/** Returns a copy of this object with drop frames enabled or disabled, as specified. */
|
||||
FrameRate withDrop (bool x = true) const { return with (&FrameRate::drop, x); }
|
||||
JUCE_NODISCARD FrameRate withDrop (bool x = true) const { return with (&FrameRate::drop, x); }
|
||||
|
||||
/** Returns a copy of this object with pulldown enabled or disabled, as specified. */
|
||||
FrameRate withPullDown (bool x = true) const { return with (&FrameRate::pulldown, x); }
|
||||
JUCE_NODISCARD FrameRate withPullDown (bool x = true) const { return with (&FrameRate::pulldown, x); }
|
||||
|
||||
/** Returns true if this instance is equal to other. */
|
||||
bool operator== (const FrameRate& other) const
|
||||
|
|
|
|||
|
|
@ -1340,8 +1340,8 @@ protected:
|
|||
|
||||
void addBus (bool isInput, const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true);
|
||||
|
||||
BusesProperties withInput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
BusesProperties withOutput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
JUCE_NODISCARD BusesProperties withInput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
JUCE_NODISCARD BusesProperties withOutput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
};
|
||||
|
||||
/** Callback to query if adding/removing buses currently possible.
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
@see latencyChanged
|
||||
*/
|
||||
ChangeDetails withLatencyChanged (bool b) const noexcept { return with (&ChangeDetails::latencyChanged, b); }
|
||||
JUCE_NODISCARD ChangeDetails withLatencyChanged (bool b) const noexcept { return with (&ChangeDetails::latencyChanged, b); }
|
||||
|
||||
/** Indicates that some attributes of the AudioProcessor's parameters have changed.
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
@see parameterInfoChanged
|
||||
*/
|
||||
ChangeDetails withParameterInfoChanged (bool b) const noexcept { return with (&ChangeDetails::parameterInfoChanged, b); }
|
||||
JUCE_NODISCARD ChangeDetails withParameterInfoChanged (bool b) const noexcept { return with (&ChangeDetails::parameterInfoChanged, b); }
|
||||
|
||||
/** Indicates that the loaded program has changed.
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
@see programChanged
|
||||
*/
|
||||
ChangeDetails withProgramChanged (bool b) const noexcept { return with (&ChangeDetails::programChanged, b); }
|
||||
JUCE_NODISCARD ChangeDetails withProgramChanged (bool b) const noexcept { return with (&ChangeDetails::programChanged, b); }
|
||||
|
||||
/** Indicates that the plugin state has changed (but not its parameters!).
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
@see nonParameterStateChanged
|
||||
*/
|
||||
ChangeDetails withNonParameterStateChanged (bool b) const noexcept { return with (&ChangeDetails::nonParameterStateChanged, b); }
|
||||
JUCE_NODISCARD ChangeDetails withNonParameterStateChanged (bool b) const noexcept { return with (&ChangeDetails::nonParameterStateChanged, b); }
|
||||
|
||||
/** Returns the default set of flags that will be used when
|
||||
AudioProcessor::updateHostDisplay() is called with no arguments.
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ public:
|
|||
}
|
||||
|
||||
/** Returns a range with a given start and length. */
|
||||
static Range withStartAndLength (const ValueType startValue, const ValueType length) noexcept
|
||||
static JUCE_NODISCARD Range withStartAndLength (const ValueType startValue, const ValueType length) noexcept
|
||||
{
|
||||
jassert (length >= ValueType());
|
||||
return Range (startValue, startValue + length);
|
||||
}
|
||||
|
||||
/** Returns a range with the specified start position and a length of zero. */
|
||||
constexpr static Range emptyRange (const ValueType start) noexcept
|
||||
constexpr static JUCE_NODISCARD Range emptyRange (const ValueType start) noexcept
|
||||
{
|
||||
return Range (start, start);
|
||||
}
|
||||
|
|
@ -104,13 +104,13 @@ public:
|
|||
If the new start position is higher than the current end of the range, the end point
|
||||
will be pushed along to equal it, returning an empty range at the new position.
|
||||
*/
|
||||
constexpr Range withStart (const ValueType newStart) const noexcept
|
||||
constexpr JUCE_NODISCARD Range withStart (const ValueType newStart) const noexcept
|
||||
{
|
||||
return Range (newStart, jmax (newStart, end));
|
||||
}
|
||||
|
||||
/** Returns a range with the same length as this one, but moved to have the given start position. */
|
||||
constexpr Range movedToStartAt (const ValueType newStart) const noexcept
|
||||
constexpr JUCE_NODISCARD Range movedToStartAt (const ValueType newStart) const noexcept
|
||||
{
|
||||
return Range (newStart, end + (newStart - start));
|
||||
}
|
||||
|
|
@ -130,13 +130,13 @@ public:
|
|||
If the new end position is below the current start of the range, the start point
|
||||
will be pushed back to equal the new end point.
|
||||
*/
|
||||
constexpr Range withEnd (const ValueType newEnd) const noexcept
|
||||
constexpr JUCE_NODISCARD Range withEnd (const ValueType newEnd) const noexcept
|
||||
{
|
||||
return Range (jmin (start, newEnd), newEnd);
|
||||
}
|
||||
|
||||
/** Returns a range with the same length as this one, but moved to have the given end position. */
|
||||
constexpr Range movedToEndAt (const ValueType newEnd) const noexcept
|
||||
constexpr JUCE_NODISCARD Range movedToEndAt (const ValueType newEnd) const noexcept
|
||||
{
|
||||
return Range (start + (newEnd - end), newEnd);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ public:
|
|||
/** Returns a range with the same start as this one, but a different length.
|
||||
Lengths less than zero are treated as zero.
|
||||
*/
|
||||
constexpr Range withLength (const ValueType newLength) const noexcept
|
||||
constexpr JUCE_NODISCARD Range withLength (const ValueType newLength) const noexcept
|
||||
{
|
||||
return Range (start, start + newLength);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ public:
|
|||
given amount.
|
||||
@returns The returned range will be (start - amount, end + amount)
|
||||
*/
|
||||
constexpr Range expanded (ValueType amount) const noexcept
|
||||
constexpr JUCE_NODISCARD Range expanded (ValueType amount) const noexcept
|
||||
{
|
||||
return Range (start - amount, end + amount);
|
||||
}
|
||||
|
|
@ -231,21 +231,21 @@ public:
|
|||
|
||||
/** Returns the range that is the intersection of the two ranges, or an empty range
|
||||
with an undefined start position if they don't overlap. */
|
||||
constexpr Range getIntersectionWith (Range other) const noexcept
|
||||
constexpr JUCE_NODISCARD Range getIntersectionWith (Range other) const noexcept
|
||||
{
|
||||
return Range (jmax (start, other.start),
|
||||
jmin (end, other.end));
|
||||
}
|
||||
|
||||
/** Returns the smallest range that contains both this one and the other one. */
|
||||
constexpr Range getUnionWith (Range other) const noexcept
|
||||
constexpr JUCE_NODISCARD Range getUnionWith (Range other) const noexcept
|
||||
{
|
||||
return Range (jmin (start, other.start),
|
||||
jmax (end, other.end));
|
||||
}
|
||||
|
||||
/** Returns the smallest range that contains both this one and the given value. */
|
||||
constexpr Range getUnionWith (const ValueType valueToInclude) const noexcept
|
||||
constexpr JUCE_NODISCARD Range getUnionWith (const ValueType valueToInclude) const noexcept
|
||||
{
|
||||
return Range (jmin (valueToInclude, start),
|
||||
jmax (valueToInclude, end));
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public:
|
|||
|
||||
@see withNewSubPath
|
||||
*/
|
||||
URL withNewDomainAndPath (const String& newFullPath) const;
|
||||
JUCE_NODISCARD URL withNewDomainAndPath (const String& newFullPath) const;
|
||||
|
||||
/** Returns a new version of this URL with a different sub-path.
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ public:
|
|||
|
||||
@see withNewDomainAndPath
|
||||
*/
|
||||
URL withNewSubPath (const String& newPath) const;
|
||||
JUCE_NODISCARD URL withNewSubPath (const String& newPath) const;
|
||||
|
||||
/** Attempts to return a URL which is the parent folder containing this URL.
|
||||
|
||||
|
|
@ -189,8 +189,8 @@ public:
|
|||
|
||||
@see getParameterNames, getParameterValues
|
||||
*/
|
||||
URL withParameter (const String& parameterName,
|
||||
const String& parameterValue) const;
|
||||
JUCE_NODISCARD URL withParameter (const String& parameterName,
|
||||
const String& parameterValue) const;
|
||||
|
||||
/** Returns a copy of this URL, with a set of GET or POST parameters added.
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ public:
|
|||
|
||||
@see withParameter
|
||||
*/
|
||||
URL withParameters (const StringPairArray& parametersToAdd) const;
|
||||
JUCE_NODISCARD URL withParameters (const StringPairArray& parametersToAdd) const;
|
||||
|
||||
/** Returns a copy of this URL, with a file-upload type parameter added to it.
|
||||
|
||||
|
|
@ -211,9 +211,9 @@ public:
|
|||
|
||||
@see withDataToUpload
|
||||
*/
|
||||
URL withFileToUpload (const String& parameterName,
|
||||
const File& fileToUpload,
|
||||
const String& mimeType) const;
|
||||
JUCE_NODISCARD URL withFileToUpload (const String& parameterName,
|
||||
const File& fileToUpload,
|
||||
const String& mimeType) const;
|
||||
|
||||
/** Returns a copy of this URL, with a file-upload type parameter added to it.
|
||||
|
||||
|
|
@ -225,10 +225,10 @@ public:
|
|||
|
||||
@see withFileToUpload
|
||||
*/
|
||||
URL withDataToUpload (const String& parameterName,
|
||||
const String& filename,
|
||||
const MemoryBlock& fileContentToUpload,
|
||||
const String& mimeType) const;
|
||||
JUCE_NODISCARD URL withDataToUpload (const String& parameterName,
|
||||
const String& filename,
|
||||
const MemoryBlock& fileContentToUpload,
|
||||
const String& mimeType) const;
|
||||
|
||||
/** Returns an array of the names of all the URL's parameters.
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ public:
|
|||
If no HTTP command is set when calling createInputStream() to read from
|
||||
this URL and some data has been set, it will do a POST request.
|
||||
*/
|
||||
URL withPOSTData (const String& postData) const;
|
||||
JUCE_NODISCARD URL withPOSTData (const String& postData) const;
|
||||
|
||||
/** Returns a copy of this URL, with a block of data to send as the POST data.
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ public:
|
|||
If no HTTP command is set when calling createInputStream() to read from
|
||||
this URL and some data has been set, it will do a POST request.
|
||||
*/
|
||||
URL withPOSTData (const MemoryBlock& postData) const;
|
||||
JUCE_NODISCARD URL withPOSTData (const MemoryBlock& postData) const;
|
||||
|
||||
/** Returns the data that was set using withPOSTData(). */
|
||||
String getPostData() const { return postData.toString(); }
|
||||
|
|
@ -337,36 +337,36 @@ public:
|
|||
|
||||
This can be useful for lengthy POST operations, so that you can provide user feedback.
|
||||
*/
|
||||
InputStreamOptions withProgressCallback (std::function<bool (int bytesSent, int totalBytes)> progressCallback) const;
|
||||
JUCE_NODISCARD InputStreamOptions withProgressCallback (std::function<bool (int bytesSent, int totalBytes)> progressCallback) const;
|
||||
|
||||
/** A string that will be appended onto the headers that are used for the request.
|
||||
|
||||
It must be a valid set of HTML header directives, separated by newlines.
|
||||
*/
|
||||
InputStreamOptions withExtraHeaders (const String& extraHeaders) const;
|
||||
JUCE_NODISCARD InputStreamOptions withExtraHeaders (const String& extraHeaders) const;
|
||||
|
||||
/** Specifies a timeout for the request in milliseconds.
|
||||
|
||||
If 0, this will use whatever default setting the OS chooses. If a negative
|
||||
number, it will be infinite.
|
||||
*/
|
||||
InputStreamOptions withConnectionTimeoutMs (int connectionTimeoutMs) const;
|
||||
JUCE_NODISCARD InputStreamOptions withConnectionTimeoutMs (int connectionTimeoutMs) const;
|
||||
|
||||
/** If this is non-null, all the (key, value) pairs received as headers
|
||||
in the response will be stored in this array.
|
||||
*/
|
||||
InputStreamOptions withResponseHeaders (StringPairArray* responseHeaders) const;
|
||||
JUCE_NODISCARD InputStreamOptions withResponseHeaders (StringPairArray* responseHeaders) const;
|
||||
|
||||
/** If this is non-null, it will get set to the http status code, if one
|
||||
is known, or 0 if a code isn't available.
|
||||
*/
|
||||
InputStreamOptions withStatusCode (int* statusCode) const;
|
||||
JUCE_NODISCARD InputStreamOptions withStatusCode (int* statusCode) const;
|
||||
|
||||
/** Specifies the number of redirects that will be followed before returning a response.
|
||||
|
||||
N.B. This will be ignored on Android which follows up to 5 redirects.
|
||||
*/
|
||||
InputStreamOptions withNumRedirectsToFollow (int numRedirectsToFollow) const;
|
||||
JUCE_NODISCARD InputStreamOptions withNumRedirectsToFollow (int numRedirectsToFollow) const;
|
||||
|
||||
/** Specifies which HTTP request command to use.
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ public:
|
|||
via withPOSTData(), withFileToUpload(), or withDataToUpload(). Otherwise it
|
||||
will be GET.
|
||||
*/
|
||||
InputStreamOptions withHttpRequestCmd (const String& httpRequestCmd) const;
|
||||
JUCE_NODISCARD InputStreamOptions withHttpRequestCmd (const String& httpRequestCmd) const;
|
||||
|
||||
//==============================================================================
|
||||
ParameterHandling getParameterHandling() const noexcept { return parameterHandling; }
|
||||
|
|
@ -459,7 +459,7 @@ public:
|
|||
bool usePost = false;
|
||||
|
||||
/** Specifies headers to add to the request. */
|
||||
auto withExtraHeaders (String value) const { return with (&DownloadTaskOptions::extraHeaders, std::move (value)); }
|
||||
JUCE_NODISCARD auto withExtraHeaders (String value) const { return with (&DownloadTaskOptions::extraHeaders, std::move (value)); }
|
||||
|
||||
/** On iOS, specifies the container where the downloaded file will be stored.
|
||||
|
||||
|
|
@ -468,17 +468,17 @@ public:
|
|||
|
||||
This is currently unused on other platforms.
|
||||
*/
|
||||
auto withSharedContainer (String value) const { return with (&DownloadTaskOptions::sharedContainer, std::move (value)); }
|
||||
JUCE_NODISCARD auto withSharedContainer (String value) const { return with (&DownloadTaskOptions::sharedContainer, std::move (value)); }
|
||||
|
||||
/** Specifies an observer for the download task. */
|
||||
auto withListener (DownloadTaskListener* value) const { return with (&DownloadTaskOptions::listener, std::move (value)); }
|
||||
JUCE_NODISCARD auto withListener (DownloadTaskListener* value) const { return with (&DownloadTaskOptions::listener, std::move (value)); }
|
||||
|
||||
/** Specifies whether a post command should be used. */
|
||||
auto withUsePost (bool value) const { return with (&DownloadTaskOptions::usePost, value); }
|
||||
JUCE_NODISCARD auto withUsePost (bool value) const { return with (&DownloadTaskOptions::usePost, value); }
|
||||
|
||||
private:
|
||||
template <typename Member, typename Value>
|
||||
DownloadTaskOptions with (Member&& member, Value&& value) const
|
||||
JUCE_NODISCARD DownloadTaskOptions with (Member&& member, Value&& value) const
|
||||
{
|
||||
auto copy = *this;
|
||||
copy.*member = std::forward<Value> (value);
|
||||
|
|
|
|||
|
|
@ -101,3 +101,9 @@
|
|||
#define JUCE_DELETED_FUNCTION = delete
|
||||
#define JUCE_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
#define JUCE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
#define JUCE_NODISCARD
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -144,8 +144,8 @@ public:
|
|||
int lineWrapLength = 60; /**< A maximum line length before wrapping is done. (If newLineChars is nullptr, this is ignored) */
|
||||
const char* newLineChars = "\r\n"; /**< Allows the newline characters to be set. If you set this to nullptr, then the whole XML document will be placed on a single line. */
|
||||
|
||||
TextFormat singleLine() const; /**< returns a copy of this format with newLineChars set to nullptr. */
|
||||
TextFormat withoutHeader() const; /**< returns a copy of this format with the addDefaultHeader flag set to false. */
|
||||
JUCE_NODISCARD TextFormat singleLine() const; /**< returns a copy of this format with newLineChars set to nullptr. */
|
||||
JUCE_NODISCARD TextFormat withoutHeader() const; /**< returns a copy of this format with the addDefaultHeader flag set to false. */
|
||||
};
|
||||
|
||||
/** Returns a text version of this XML element.
|
||||
|
|
|
|||
|
|
@ -299,35 +299,35 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns a copy of this colour with a different hue. */
|
||||
Colour withHue (float newHue) const noexcept;
|
||||
JUCE_NODISCARD Colour withHue (float newHue) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different saturation. */
|
||||
Colour withSaturation (float newSaturation) const noexcept;
|
||||
JUCE_NODISCARD Colour withSaturation (float newSaturation) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different saturation in the HSL colour space. */
|
||||
Colour withSaturationHSL (float newSaturation) const noexcept;
|
||||
JUCE_NODISCARD Colour withSaturationHSL (float newSaturation) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different brightness.
|
||||
@see brighter, darker, withMultipliedBrightness
|
||||
*/
|
||||
Colour withBrightness (float newBrightness) const noexcept;
|
||||
JUCE_NODISCARD Colour withBrightness (float newBrightness) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different lightness.
|
||||
@see lighter, darker, withMultipliedLightness
|
||||
*/
|
||||
Colour withLightness (float newLightness) const noexcept;
|
||||
JUCE_NODISCARD Colour withLightness (float newLightness) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its hue rotated.
|
||||
The new colour's hue is ((this->getHue() + amountToRotate) % 1.0)
|
||||
@see brighter, darker, withMultipliedBrightness
|
||||
*/
|
||||
Colour withRotatedHue (float amountToRotate) const noexcept;
|
||||
JUCE_NODISCARD Colour withRotatedHue (float amountToRotate) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its saturation multiplied by the given value.
|
||||
The new colour's saturation is (this->getSaturation() * multiplier)
|
||||
(the result is clipped to legal limits).
|
||||
*/
|
||||
Colour withMultipliedSaturation (float multiplier) const noexcept;
|
||||
JUCE_NODISCARD Colour withMultipliedSaturation (float multiplier) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its saturation multiplied by the given value.
|
||||
The new colour's saturation is (this->getSaturation() * multiplier)
|
||||
|
|
@ -335,19 +335,19 @@ public:
|
|||
|
||||
This will be in the HSL colour space.
|
||||
*/
|
||||
Colour withMultipliedSaturationHSL (float multiplier) const noexcept;
|
||||
JUCE_NODISCARD Colour withMultipliedSaturationHSL (float multiplier) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its brightness multiplied by the given value.
|
||||
The new colour's brightness is (this->getBrightness() * multiplier)
|
||||
(the result is clipped to legal limits).
|
||||
*/
|
||||
Colour withMultipliedBrightness (float amount) const noexcept;
|
||||
JUCE_NODISCARD Colour withMultipliedBrightness (float amount) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its lightness multiplied by the given value.
|
||||
The new colour's lightness is (this->lightness() * multiplier)
|
||||
(the result is clipped to legal limits).
|
||||
*/
|
||||
Colour withMultipliedLightness (float amount) const noexcept;
|
||||
JUCE_NODISCARD Colour withMultipliedLightness (float amount) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a brighter version of this colour.
|
||||
|
|
@ -355,14 +355,14 @@ public:
|
|||
where 0 is unchanged, and higher values make it brighter
|
||||
@see withMultipliedBrightness
|
||||
*/
|
||||
Colour brighter (float amountBrighter = 0.4f) const noexcept;
|
||||
JUCE_NODISCARD Colour brighter (float amountBrighter = 0.4f) const noexcept;
|
||||
|
||||
/** Returns a darker version of this colour.
|
||||
@param amountDarker how much darker to make it - a value greater than or equal to 0,
|
||||
where 0 is unchanged, and higher values make it darker
|
||||
@see withMultipliedBrightness
|
||||
*/
|
||||
Colour darker (float amountDarker = 0.4f) const noexcept;
|
||||
JUCE_NODISCARD Colour darker (float amountDarker = 0.4f) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a colour that will be clearly visible against this colour.
|
||||
|
|
@ -372,7 +372,7 @@ public:
|
|||
that's just a little bit lighter; Colours::black.contrasting (1.0f) will
|
||||
return white; Colours::white.contrasting (1.0f) will return black, etc.
|
||||
*/
|
||||
Colour contrasting (float amount = 1.0f) const noexcept;
|
||||
JUCE_NODISCARD Colour contrasting (float amount = 1.0f) const noexcept;
|
||||
|
||||
/** Returns a colour that is as close as possible to a target colour whilst
|
||||
still being in contrast to this one.
|
||||
|
|
@ -381,20 +381,20 @@ public:
|
|||
nudged up or down so that it differs from the luminosity of this colour
|
||||
by at least the amount specified by minLuminosityDiff.
|
||||
*/
|
||||
Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept;
|
||||
JUCE_NODISCARD Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept;
|
||||
|
||||
/** Returns a colour that contrasts against two colours.
|
||||
Looks for a colour that contrasts with both of the colours passed-in.
|
||||
Handy for things like choosing a highlight colour in text editors, etc.
|
||||
*/
|
||||
static Colour contrasting (Colour colour1,
|
||||
Colour colour2) noexcept;
|
||||
static JUCE_NODISCARD Colour contrasting (Colour colour1,
|
||||
Colour colour2) noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns an opaque shade of grey.
|
||||
@param brightness the level of grey to return - 0 is black, 1.0 is white
|
||||
*/
|
||||
static Colour greyLevel (float brightness) noexcept;
|
||||
static JUCE_NODISCARD Colour greyLevel (float brightness) noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a stringified version of this colour.
|
||||
|
|
@ -403,7 +403,7 @@ public:
|
|||
String toString() const;
|
||||
|
||||
/** Reads the colour from a string that was created with toString(). */
|
||||
static Colour fromString (StringRef encodedColourString);
|
||||
static JUCE_NODISCARD Colour fromString (StringRef encodedColourString);
|
||||
|
||||
/** Returns the colour as a hex string in the form RRGGBB or AARRGGBB. */
|
||||
String toDisplayString (bool includeAlphaValue) const;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ public:
|
|||
/** Returns a copy of this font with a new typeface style.
|
||||
@see getAvailableStyles()
|
||||
*/
|
||||
Font withTypefaceStyle (const String& newStyle) const;
|
||||
JUCE_NODISCARD Font withTypefaceStyle (const String& newStyle) const;
|
||||
|
||||
/** Returns a list of the styles that this font can use. */
|
||||
StringArray getAvailableStyles() const;
|
||||
|
|
@ -204,10 +204,10 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns a copy of this font with a new height. */
|
||||
Font withHeight (float height) const;
|
||||
JUCE_NODISCARD Font withHeight (float height) const;
|
||||
|
||||
/** Returns a copy of this font with a new height, specified in points. */
|
||||
Font withPointHeight (float heightInPoints) const;
|
||||
JUCE_NODISCARD Font withPointHeight (float heightInPoints) const;
|
||||
|
||||
/** Changes the font's height.
|
||||
@see getHeight, withHeight, setHeightWithoutChangingWidth
|
||||
|
|
@ -271,7 +271,7 @@ public:
|
|||
@param styleFlags a bitwise-or'ed combination of values from the FontStyleFlags enum.
|
||||
@see FontStyleFlags, getStyleFlags
|
||||
*/
|
||||
Font withStyle (int styleFlags) const;
|
||||
JUCE_NODISCARD Font withStyle (int styleFlags) const;
|
||||
|
||||
/** Changes the font's style.
|
||||
@param newFlags a bitwise-or'ed combination of values from the FontStyleFlags enum.
|
||||
|
|
@ -286,7 +286,7 @@ public:
|
|||
/** Returns a copy of this font with the bold attribute set.
|
||||
If the font does not have a bold version, this will return the default font.
|
||||
*/
|
||||
Font boldened() const;
|
||||
JUCE_NODISCARD Font boldened() const;
|
||||
|
||||
/** Returns true if the font is bold. */
|
||||
bool isBold() const noexcept;
|
||||
|
|
@ -294,7 +294,7 @@ public:
|
|||
/** Makes the font italic or non-italic. */
|
||||
void setItalic (bool shouldBeItalic);
|
||||
/** Returns a copy of this font with the italic attribute set. */
|
||||
Font italicised() const;
|
||||
JUCE_NODISCARD Font italicised() const;
|
||||
/** Returns true if the font is italic. */
|
||||
bool isItalic() const noexcept;
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ public:
|
|||
narrower, greater than 1.0 will be stretched out.
|
||||
@see getHorizontalScale
|
||||
*/
|
||||
Font withHorizontalScale (float scaleFactor) const;
|
||||
JUCE_NODISCARD Font withHorizontalScale (float scaleFactor) const;
|
||||
|
||||
/** Changes the font's horizontal scale factor.
|
||||
@param scaleFactor a value of 1.0 is the normal scale, less than this will be
|
||||
|
|
@ -353,7 +353,7 @@ public:
|
|||
normal spacing, positive values spread the letters out,
|
||||
negative values make them closer together.
|
||||
*/
|
||||
Font withExtraKerningFactor (float extraKerning) const;
|
||||
JUCE_NODISCARD Font withExtraKerningFactor (float extraKerning) const;
|
||||
|
||||
/** Changes the font's kerning.
|
||||
@param extraKerning a multiple of the font's height that will be added
|
||||
|
|
|
|||
|
|
@ -217,42 +217,42 @@ public:
|
|||
void setVerticalRange (Range<ValueType> range) noexcept { pos.y = range.getStart(); h = range.getLength(); }
|
||||
|
||||
/** Returns a rectangle which has the same size and y-position as this one, but with a different x-position. */
|
||||
Rectangle withX (ValueType newX) const noexcept { return { newX, pos.y, w, h }; }
|
||||
JUCE_NODISCARD Rectangle withX (ValueType newX) const noexcept { return { newX, pos.y, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same size and x-position as this one, but with a different y-position. */
|
||||
Rectangle withY (ValueType newY) const noexcept { return { pos.x, newY, w, h }; }
|
||||
JUCE_NODISCARD Rectangle withY (ValueType newY) const noexcept { return { pos.x, newY, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same size and y-position as this one, but whose right-hand edge has the given position. */
|
||||
Rectangle withRightX (ValueType newRightX) const noexcept { return { newRightX - w, pos.y, w, h }; }
|
||||
JUCE_NODISCARD Rectangle withRightX (ValueType newRightX) const noexcept { return { newRightX - w, pos.y, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same size and x-position as this one, but whose bottom edge has the given position. */
|
||||
Rectangle withBottomY (ValueType newBottomY) const noexcept { return { pos.x, newBottomY - h, w, h }; }
|
||||
JUCE_NODISCARD Rectangle withBottomY (ValueType newBottomY) const noexcept { return { pos.x, newBottomY - h, w, h }; }
|
||||
|
||||
/** Returns a rectangle with the same size as this one, but a new position. */
|
||||
Rectangle withPosition (ValueType newX, ValueType newY) const noexcept { return { newX, newY, w, h }; }
|
||||
JUCE_NODISCARD Rectangle withPosition (ValueType newX, ValueType newY) const noexcept { return { newX, newY, w, h }; }
|
||||
|
||||
/** Returns a rectangle with the same size as this one, but a new position. */
|
||||
Rectangle withPosition (Point<ValueType> newPos) const noexcept { return { newPos.x, newPos.y, w, h }; }
|
||||
JUCE_NODISCARD Rectangle withPosition (Point<ValueType> newPos) const noexcept { return { newPos.x, newPos.y, w, h }; }
|
||||
|
||||
/** Returns a rectangle whose size is the same as this one, but whose top-left position is (0, 0). */
|
||||
Rectangle withZeroOrigin() const noexcept { return { w, h }; }
|
||||
JUCE_NODISCARD Rectangle withZeroOrigin() const noexcept { return { w, h }; }
|
||||
|
||||
/** Returns a rectangle with the same size as this one, but a new centre position. */
|
||||
Rectangle withCentre (Point<ValueType> newCentre) const noexcept { return { newCentre.x - w / (ValueType) 2,
|
||||
JUCE_NODISCARD Rectangle withCentre (Point<ValueType> newCentre) const noexcept { return { newCentre.x - w / (ValueType) 2,
|
||||
newCentre.y - h / (ValueType) 2, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same position and height as this one, but with a different width. */
|
||||
Rectangle withWidth (ValueType newWidth) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), h }; }
|
||||
JUCE_NODISCARD Rectangle withWidth (ValueType newWidth) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), h }; }
|
||||
|
||||
/** Returns a rectangle which has the same position and width as this one, but with a different height. */
|
||||
Rectangle withHeight (ValueType newHeight) const noexcept { return { pos.x, pos.y, w, jmax (ValueType(), newHeight) }; }
|
||||
JUCE_NODISCARD Rectangle withHeight (ValueType newHeight) const noexcept { return { pos.x, pos.y, w, jmax (ValueType(), newHeight) }; }
|
||||
|
||||
/** Returns a rectangle with the same top-left position as this one, but a new size. */
|
||||
Rectangle withSize (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), jmax (ValueType(), newHeight) }; }
|
||||
JUCE_NODISCARD Rectangle withSize (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), jmax (ValueType(), newHeight) }; }
|
||||
|
||||
/** Returns a rectangle with the same centre position as this one, but a new size. */
|
||||
Rectangle withSizeKeepingCentre (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x + (w - newWidth) / (ValueType) 2,
|
||||
pos.y + (h - newHeight) / (ValueType) 2, newWidth, newHeight }; }
|
||||
JUCE_NODISCARD Rectangle withSizeKeepingCentre (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x + (w - newWidth) / (ValueType) 2,
|
||||
pos.y + (h - newHeight) / (ValueType) 2, newWidth, newHeight }; }
|
||||
|
||||
/** Moves the x position, adjusting the width so that the right-hand edge remains in the same place.
|
||||
If the x is moved to be on the right of the current right-hand edge, the width will be set to zero.
|
||||
|
|
@ -264,7 +264,7 @@ public:
|
|||
If the new x is beyond the right of the current right-hand edge, the width will be set to zero.
|
||||
@see setLeft
|
||||
*/
|
||||
Rectangle withLeft (ValueType newLeft) const noexcept { return { newLeft, pos.y, jmax (ValueType(), pos.x + w - newLeft), h }; }
|
||||
JUCE_NODISCARD Rectangle withLeft (ValueType newLeft) const noexcept { return { newLeft, pos.y, jmax (ValueType(), pos.x + w - newLeft), h }; }
|
||||
|
||||
/** Moves the y position, adjusting the height so that the bottom edge remains in the same place.
|
||||
If the y is moved to be below the current bottom edge, the height will be set to zero.
|
||||
|
|
@ -276,7 +276,7 @@ public:
|
|||
If the new y is beyond the bottom of the current rectangle, the height will be set to zero.
|
||||
@see setTop
|
||||
*/
|
||||
Rectangle withTop (ValueType newTop) const noexcept { return { pos.x, newTop, w, jmax (ValueType(), pos.y + h - newTop) }; }
|
||||
JUCE_NODISCARD Rectangle withTop (ValueType newTop) const noexcept { return { pos.x, newTop, w, jmax (ValueType(), pos.y + h - newTop) }; }
|
||||
|
||||
/** Adjusts the width so that the right-hand edge of the rectangle has this new value.
|
||||
If the new right is below the current X value, the X will be pushed down to match it.
|
||||
|
|
@ -288,7 +288,7 @@ public:
|
|||
If the new right edge is below the current left-hand edge, the width will be set to zero.
|
||||
@see setRight
|
||||
*/
|
||||
Rectangle withRight (ValueType newRight) const noexcept { return { jmin (pos.x, newRight), pos.y, jmax (ValueType(), newRight - pos.x), h }; }
|
||||
JUCE_NODISCARD Rectangle withRight (ValueType newRight) const noexcept { return { jmin (pos.x, newRight), pos.y, jmax (ValueType(), newRight - pos.x), h }; }
|
||||
|
||||
/** Adjusts the height so that the bottom edge of the rectangle has this new value.
|
||||
If the new bottom is lower than the current Y value, the Y will be pushed down to match it.
|
||||
|
|
@ -300,19 +300,19 @@ public:
|
|||
If the new y is beyond the bottom of the current rectangle, the height will be set to zero.
|
||||
@see setBottom
|
||||
*/
|
||||
Rectangle withBottom (ValueType newBottom) const noexcept { return { pos.x, jmin (pos.y, newBottom), w, jmax (ValueType(), newBottom - pos.y) }; }
|
||||
JUCE_NODISCARD Rectangle withBottom (ValueType newBottom) const noexcept { return { pos.x, jmin (pos.y, newBottom), w, jmax (ValueType(), newBottom - pos.y) }; }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its left-hand edge. */
|
||||
Rectangle withTrimmedLeft (ValueType amountToRemove) const noexcept { return withLeft (pos.x + amountToRemove); }
|
||||
JUCE_NODISCARD Rectangle withTrimmedLeft (ValueType amountToRemove) const noexcept { return withLeft (pos.x + amountToRemove); }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its right-hand edge. */
|
||||
Rectangle withTrimmedRight (ValueType amountToRemove) const noexcept { return withWidth (w - amountToRemove); }
|
||||
JUCE_NODISCARD Rectangle withTrimmedRight (ValueType amountToRemove) const noexcept { return withWidth (w - amountToRemove); }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its top edge. */
|
||||
Rectangle withTrimmedTop (ValueType amountToRemove) const noexcept { return withTop (pos.y + amountToRemove); }
|
||||
JUCE_NODISCARD Rectangle withTrimmedTop (ValueType amountToRemove) const noexcept { return withTop (pos.y + amountToRemove); }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its bottom edge. */
|
||||
Rectangle withTrimmedBottom (ValueType amountToRemove) const noexcept { return withHeight (h - amountToRemove); }
|
||||
JUCE_NODISCARD Rectangle withTrimmedBottom (ValueType amountToRemove) const noexcept { return withHeight (h - amountToRemove); }
|
||||
|
||||
//==============================================================================
|
||||
/** Moves the rectangle's position by adding amount to its x and y coordinates. */
|
||||
|
|
|
|||
|
|
@ -50,73 +50,73 @@ public:
|
|||
|
||||
@see isCheckable
|
||||
*/
|
||||
AccessibleState withCheckable() const noexcept { return withFlag (Flags::checkable); }
|
||||
JUCE_NODISCARD AccessibleState withCheckable() const noexcept { return withFlag (Flags::checkable); }
|
||||
|
||||
/** Sets the checked flag and returns the new state.
|
||||
|
||||
@see isChecked
|
||||
*/
|
||||
AccessibleState withChecked() const noexcept { return withFlag (Flags::checked); }
|
||||
JUCE_NODISCARD AccessibleState withChecked() const noexcept { return withFlag (Flags::checked); }
|
||||
|
||||
/** Sets the collapsed flag and returns the new state.
|
||||
|
||||
@see isCollapsed
|
||||
*/
|
||||
AccessibleState withCollapsed() const noexcept { return withFlag (Flags::collapsed); }
|
||||
JUCE_NODISCARD AccessibleState withCollapsed() const noexcept { return withFlag (Flags::collapsed); }
|
||||
|
||||
/** Sets the expandable flag and returns the new state.
|
||||
|
||||
@see isExpandable
|
||||
*/
|
||||
AccessibleState withExpandable() const noexcept { return withFlag (Flags::expandable); }
|
||||
JUCE_NODISCARD AccessibleState withExpandable() const noexcept { return withFlag (Flags::expandable); }
|
||||
|
||||
/** Sets the expanded flag and returns the new state.
|
||||
|
||||
@see isExpanded
|
||||
*/
|
||||
AccessibleState withExpanded() const noexcept { return withFlag (Flags::expanded); }
|
||||
JUCE_NODISCARD AccessibleState withExpanded() const noexcept { return withFlag (Flags::expanded); }
|
||||
|
||||
/** Sets the focusable flag and returns the new state.
|
||||
|
||||
@see isFocusable
|
||||
*/
|
||||
AccessibleState withFocusable() const noexcept { return withFlag (Flags::focusable); }
|
||||
JUCE_NODISCARD AccessibleState withFocusable() const noexcept { return withFlag (Flags::focusable); }
|
||||
|
||||
/** Sets the focused flag and returns the new state.
|
||||
|
||||
@see isFocused
|
||||
*/
|
||||
AccessibleState withFocused() const noexcept { return withFlag (Flags::focused); }
|
||||
JUCE_NODISCARD AccessibleState withFocused() const noexcept { return withFlag (Flags::focused); }
|
||||
|
||||
/** Sets the ignored flag and returns the new state.
|
||||
|
||||
@see isIgnored
|
||||
*/
|
||||
AccessibleState withIgnored() const noexcept { return withFlag (Flags::ignored); }
|
||||
JUCE_NODISCARD AccessibleState withIgnored() const noexcept { return withFlag (Flags::ignored); }
|
||||
|
||||
/** Sets the selectable flag and returns the new state.
|
||||
|
||||
@see isSelectable
|
||||
*/
|
||||
AccessibleState withSelectable() const noexcept { return withFlag (Flags::selectable); }
|
||||
JUCE_NODISCARD AccessibleState withSelectable() const noexcept { return withFlag (Flags::selectable); }
|
||||
|
||||
/** Sets the multiSelectable flag and returns the new state.
|
||||
|
||||
@see isMultiSelectable
|
||||
*/
|
||||
AccessibleState withMultiSelectable() const noexcept { return withFlag (Flags::multiSelectable); }
|
||||
JUCE_NODISCARD AccessibleState withMultiSelectable() const noexcept { return withFlag (Flags::multiSelectable); }
|
||||
|
||||
/** Sets the selected flag and returns the new state.
|
||||
|
||||
@see isSelected
|
||||
*/
|
||||
AccessibleState withSelected() const noexcept { return withFlag (Flags::selected); }
|
||||
JUCE_NODISCARD AccessibleState withSelected() const noexcept { return withFlag (Flags::selected); }
|
||||
|
||||
/** Sets the accessible offscreen flag and returns the new state.
|
||||
|
||||
@see isSelected
|
||||
*/
|
||||
AccessibleState withAccessibleOffscreen() const noexcept { return withFlag (Flags::accessibleOffscreen); }
|
||||
JUCE_NODISCARD AccessibleState withAccessibleOffscreen() const noexcept { return withFlag (Flags::accessibleOffscreen); }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns true if the UI element is checkable.
|
||||
|
|
@ -208,7 +208,7 @@ private:
|
|||
accessibleOffscreen = (1 << 11)
|
||||
};
|
||||
|
||||
AccessibleState withFlag (int flag) const noexcept
|
||||
JUCE_NODISCARD AccessibleState withFlag (int flag) const noexcept
|
||||
{
|
||||
auto copy = *this;
|
||||
copy.flags |= flag;
|
||||
|
|
|
|||
|
|
@ -163,23 +163,23 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns a copy of only the mouse-button flags */
|
||||
ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }
|
||||
JUCE_NODISCARD ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }
|
||||
|
||||
/** Returns a copy of only the non-mouse flags */
|
||||
ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }
|
||||
JUCE_NODISCARD ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }
|
||||
|
||||
bool operator== (const ModifierKeys other) const noexcept { return flags == other.flags; }
|
||||
bool operator!= (const ModifierKeys other) const noexcept { return flags != other.flags; }
|
||||
bool operator== (const ModifierKeys other) const noexcept { return flags == other.flags; }
|
||||
bool operator!= (const ModifierKeys other) const noexcept { return flags != other.flags; }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the raw flags for direct testing. */
|
||||
inline int getRawFlags() const noexcept { return flags; }
|
||||
inline int getRawFlags() const noexcept { return flags; }
|
||||
|
||||
ModifierKeys withoutFlags (int rawFlagsToClear) const noexcept { return ModifierKeys (flags & ~rawFlagsToClear); }
|
||||
ModifierKeys withFlags (int rawFlagsToSet) const noexcept { return ModifierKeys (flags | rawFlagsToSet); }
|
||||
JUCE_NODISCARD ModifierKeys withoutFlags (int rawFlagsToClear) const noexcept { return ModifierKeys (flags & ~rawFlagsToClear); }
|
||||
JUCE_NODISCARD ModifierKeys withFlags (int rawFlagsToSet) const noexcept { return ModifierKeys (flags | rawFlagsToSet); }
|
||||
|
||||
/** Tests a combination of flags and returns true if any of them are set. */
|
||||
bool testFlags (int flagsToTest) const noexcept { return (flags & flagsToTest) != 0; }
|
||||
bool testFlags (int flagsToTest) const noexcept { return (flags & flagsToTest) != 0; }
|
||||
|
||||
/** Returns the total number of mouse buttons that are down. */
|
||||
int getNumMouseButtonsDown() const noexcept;
|
||||
|
|
@ -194,7 +194,7 @@ public:
|
|||
This method is here for backwards compatibility and there's no need to call it anymore,
|
||||
you should use the public currentModifiers member directly.
|
||||
*/
|
||||
static ModifierKeys getCurrentModifiers() noexcept { return currentModifiers; }
|
||||
static ModifierKeys getCurrentModifiers() noexcept { return currentModifiers; }
|
||||
|
||||
/** Creates a ModifierKeys object to represent the current state of the
|
||||
keyboard and mouse buttons.
|
||||
|
|
|
|||
|
|
@ -483,8 +483,8 @@ public:
|
|||
|
||||
@see withTargetComponent, withTargetScreenArea
|
||||
*/
|
||||
Options withTargetComponent (Component* targetComponent) const;
|
||||
Options withTargetComponent (Component& targetComponent) const;
|
||||
JUCE_NODISCARD Options withTargetComponent (Component* targetComponent) const;
|
||||
JUCE_NODISCARD Options withTargetComponent (Component& targetComponent) const;
|
||||
|
||||
/** Sets the region of the screen next to which the menu should be displayed.
|
||||
|
||||
|
|
@ -500,7 +500,7 @@ public:
|
|||
|
||||
@see withMousePosition
|
||||
*/
|
||||
Options withTargetScreenArea (Rectangle<int> targetArea) const;
|
||||
JUCE_NODISCARD Options withTargetScreenArea (Rectangle<int> targetArea) const;
|
||||
|
||||
/** Sets the target screen area to match the current mouse position.
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ public:
|
|||
|
||||
@see withTargetScreenArea
|
||||
*/
|
||||
Options withMousePosition() const;
|
||||
JUCE_NODISCARD Options withMousePosition() const;
|
||||
|
||||
/** If the passed component has been deleted when the popup menu exits,
|
||||
the selected item's action will not be called.
|
||||
|
|
@ -517,26 +517,26 @@ public:
|
|||
callback, in the case that the callback needs to access a component that
|
||||
may be deleted.
|
||||
*/
|
||||
Options withDeletionCheck (Component& componentToWatchForDeletion) const;
|
||||
JUCE_NODISCARD Options withDeletionCheck (Component& componentToWatchForDeletion) const;
|
||||
|
||||
/** Sets the minimum width of the popup window. */
|
||||
Options withMinimumWidth (int minWidth) const;
|
||||
JUCE_NODISCARD Options withMinimumWidth (int minWidth) const;
|
||||
|
||||
/** Sets the minimum number of columns in the popup window. */
|
||||
Options withMinimumNumColumns (int minNumColumns) const;
|
||||
JUCE_NODISCARD Options withMinimumNumColumns (int minNumColumns) const;
|
||||
|
||||
/** Sets the maximum number of columns in the popup window. */
|
||||
Options withMaximumNumColumns (int maxNumColumns) const;
|
||||
JUCE_NODISCARD Options withMaximumNumColumns (int maxNumColumns) const;
|
||||
|
||||
/** Sets the default height of each item in the popup menu. */
|
||||
Options withStandardItemHeight (int standardHeight) const;
|
||||
JUCE_NODISCARD Options withStandardItemHeight (int standardHeight) const;
|
||||
|
||||
/** Sets an item which must be visible when the menu is initially drawn.
|
||||
|
||||
This is useful to ensure that a particular item is shown when the menu
|
||||
contains too many items to display on a single screen.
|
||||
*/
|
||||
Options withItemThatMustBeVisible (int idOfItemToBeVisible) const;
|
||||
JUCE_NODISCARD Options withItemThatMustBeVisible (int idOfItemToBeVisible) const;
|
||||
|
||||
/** Sets a component that the popup menu will be drawn into.
|
||||
|
||||
|
|
@ -547,10 +547,10 @@ public:
|
|||
avoid this unwanted behaviour, but with the downside that the menu size
|
||||
will be constrained by the size of the parent component.
|
||||
*/
|
||||
Options withParentComponent (Component* parentComponent) const;
|
||||
JUCE_NODISCARD Options withParentComponent (Component* parentComponent) const;
|
||||
|
||||
/** Sets the direction of the popup menu relative to the target screen area. */
|
||||
Options withPreferredPopupDirection (PopupDirection direction) const;
|
||||
JUCE_NODISCARD Options withPreferredPopupDirection (PopupDirection direction) const;
|
||||
|
||||
/** Sets an item to select in the menu.
|
||||
|
||||
|
|
@ -560,7 +560,7 @@ public:
|
|||
than needing to move the highlighted row down from the top of the menu each time
|
||||
it is opened.
|
||||
*/
|
||||
Options withInitiallySelectedItem (int idOfItemToBeSelected) const;
|
||||
JUCE_NODISCARD Options withInitiallySelectedItem (int idOfItemToBeSelected) const;
|
||||
|
||||
//==============================================================================
|
||||
/** Gets the parent component. This may be nullptr if the Component has been deleted.
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Sets the type of icon that should be used for the dialog box. */
|
||||
MessageBoxOptions withIconType (MessageBoxIconType type) const { return with (*this, &MessageBoxOptions::iconType, type); }
|
||||
JUCE_NODISCARD MessageBoxOptions withIconType (MessageBoxIconType type) const { return with (*this, &MessageBoxOptions::iconType, type); }
|
||||
|
||||
/** Sets the title of the dialog box. */
|
||||
MessageBoxOptions withTitle (const String& boxTitle) const { return with (*this, &MessageBoxOptions::title, boxTitle); }
|
||||
JUCE_NODISCARD MessageBoxOptions withTitle (const String& boxTitle) const { return with (*this, &MessageBoxOptions::title, boxTitle); }
|
||||
|
||||
/** Sets the message that should be displayed in the dialog box. */
|
||||
MessageBoxOptions withMessage (const String& boxMessage) const { return with (*this, &MessageBoxOptions::message, boxMessage); }
|
||||
JUCE_NODISCARD MessageBoxOptions withMessage (const String& boxMessage) const { return with (*this, &MessageBoxOptions::message, boxMessage); }
|
||||
|
||||
/** If the string passed in is not empty, this will add a button to the
|
||||
dialog box with the specified text.
|
||||
|
|
@ -82,10 +82,10 @@ public:
|
|||
Generally up to 3 buttons are supported for dialog boxes, so adding any more
|
||||
than this may have no effect.
|
||||
*/
|
||||
MessageBoxOptions withButton (const String& text) const { auto copy = *this; copy.buttons.add (text); return copy; }
|
||||
JUCE_NODISCARD MessageBoxOptions withButton (const String& text) const { auto copy = *this; copy.buttons.add (text); return copy; }
|
||||
|
||||
/** The component that the dialog box should be associated with. */
|
||||
MessageBoxOptions withAssociatedComponent (Component* component) const { return with (*this, &MessageBoxOptions::associatedComponent, component); }
|
||||
JUCE_NODISCARD MessageBoxOptions withAssociatedComponent (Component* component) const { return with (*this, &MessageBoxOptions::associatedComponent, component); }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the icon type of the dialog box.
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public:
|
|||
/** Sets a custom location for the WebView2Loader.dll that is not a part of the
|
||||
standard system DLL search paths.
|
||||
*/
|
||||
WebView2Preferences withDLLLocation (const File& location) const { return with (&WebView2Preferences::dllLocation, location); }
|
||||
JUCE_NODISCARD WebView2Preferences withDLLLocation (const File& location) const { return with (&WebView2Preferences::dllLocation, location); }
|
||||
|
||||
/** Sets a non-default location for storing user data for the browser instance. */
|
||||
WebView2Preferences withUserDataFolder (const File& folder) const { return with (&WebView2Preferences::userDataFolder, folder); }
|
||||
|
|
@ -190,19 +190,19 @@ public:
|
|||
/** If this is set, the status bar usually displayed in the lower-left of the webview
|
||||
will be disabled.
|
||||
*/
|
||||
WebView2Preferences withStatusBarDisabled() const { return with (&WebView2Preferences::disableStatusBar, true); }
|
||||
JUCE_NODISCARD WebView2Preferences withStatusBarDisabled() const { return with (&WebView2Preferences::disableStatusBar, true); }
|
||||
|
||||
/** If this is set, a blank page will be displayed on error instead of the default
|
||||
built-in error page.
|
||||
*/
|
||||
WebView2Preferences withBuiltInErrorPageDisabled() const { return with (&WebView2Preferences::disableBuiltInErrorPage, true); }
|
||||
JUCE_NODISCARD WebView2Preferences withBuiltInErrorPageDisabled() const { return with (&WebView2Preferences::disableBuiltInErrorPage, true); }
|
||||
|
||||
/** Sets the background colour that WebView2 renders underneath all web content.
|
||||
|
||||
This colour must either be fully opaque or transparent. On Windows 7 this
|
||||
colour must be opaque.
|
||||
*/
|
||||
WebView2Preferences withBackgroundColour (const Colour& colour) const
|
||||
JUCE_NODISCARD WebView2Preferences withBackgroundColour (const Colour& colour) const
|
||||
{
|
||||
// the background colour must be either fully opaque or transparent!
|
||||
jassert (colour.isOpaque() || colour.isTransparent());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue