1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

ResizableWindow: Add const to virtual members

This commit is contained in:
reuk 2024-05-23 15:54:55 +01:00
parent e12a1a75ac
commit 4201b76d15
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
6 changed files with 28 additions and 14 deletions

View file

@ -2,6 +2,27 @@
# Version 8.0.0
## Change
The virtual functions ResizableWindow::getBorderThickness() and
ResizableWindow::getContentComponentBorder() are now const.
**Possible Issues**
Classes overriding these functions will fail to compile.
**Workaround**
Add 'const' to overriding functions.
**Rationale**
Omitting 'const' from these functions implies that they may change the state of
the ResizableWindow, which would be unexpected behaviour for getter functions.
It also means that the functions cannot be called from const member functions,
which limits their usefulness.
## Change
As part of the Unicode upgrades TextLayout codepaths have been unified across

View file

@ -233,7 +233,7 @@ public:
const AudioProcessorGraph::Node::Ptr node;
const Type type;
BorderSize<int> getBorderThickness() override
BorderSize<int> getBorderThickness() const override
{
#if JUCE_IOS || JUCE_ANDROID
const int border = 10;

View file

@ -247,12 +247,7 @@ void DocumentWindow::resized()
titleBarArea.getWidth(), menuBarHeight);
}
BorderSize<int> DocumentWindow::getBorderThickness()
{
return ResizableWindow::getBorderThickness();
}
BorderSize<int> DocumentWindow::getContentComponentBorder()
BorderSize<int> DocumentWindow::getContentComponentBorder() const
{
auto border = getBorderThickness();

View file

@ -279,9 +279,7 @@ public:
/** @internal */
void lookAndFeelChanged() override;
/** @internal */
BorderSize<int> getBorderThickness() override;
/** @internal */
BorderSize<int> getContentComponentBorder() override;
BorderSize<int> getContentComponentBorder() const override;
/** @internal */
void mouseDoubleClick (const MouseEvent&) override;
/** @internal */

View file

@ -160,7 +160,7 @@ void ResizableWindow::setContentComponentSize (int width, int height)
height + border.getTopAndBottom());
}
BorderSize<int> ResizableWindow::getBorderThickness()
BorderSize<int> ResizableWindow::getBorderThickness() const
{
if (isUsingNativeTitleBar() || isKioskMode())
return {};
@ -168,7 +168,7 @@ BorderSize<int> ResizableWindow::getBorderThickness()
return BorderSize<int> ((resizableBorder != nullptr && ! isFullScreen()) ? 4 : 1);
}
BorderSize<int> ResizableWindow::getContentComponentBorder()
BorderSize<int> ResizableWindow::getContentComponentBorder() const
{
return getBorderThickness();
}

View file

@ -301,12 +301,12 @@ public:
/** Returns the width of the frame to use around the window.
@see getContentComponentBorder
*/
virtual BorderSize<int> getBorderThickness();
virtual BorderSize<int> getBorderThickness() const;
/** Returns the insets to use when positioning the content component.
@see getBorderThickness
*/
virtual BorderSize<int> getContentComponentBorder();
virtual BorderSize<int> getContentComponentBorder() const;
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the window.