upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -55,9 +55,8 @@ class AnimatedPosition : private Timer
|
||||
{
|
||||
public:
|
||||
AnimatedPosition()
|
||||
: position(), grabbedPos(), releaseVelocity(),
|
||||
range (-std::numeric_limits<double>::max(),
|
||||
std::numeric_limits<double>::max())
|
||||
: range (-std::numeric_limits<double>::max(),
|
||||
std::numeric_limits<double>::max())
|
||||
{
|
||||
}
|
||||
|
||||
@ -134,7 +133,7 @@ public:
|
||||
class Listener
|
||||
{
|
||||
public:
|
||||
virtual ~Listener() {}
|
||||
virtual ~Listener() = default;
|
||||
|
||||
/** Called synchronously when an AnimatedPosition changes. */
|
||||
virtual void positionChanged (AnimatedPosition&, double newPosition) = 0;
|
||||
@ -154,7 +153,7 @@ public:
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
double position, grabbedPos, releaseVelocity;
|
||||
double position = 0.0, grabbedPos = 0.0, releaseVelocity = 0.0;
|
||||
Range<double> range;
|
||||
Time lastUpdate, lastDrag;
|
||||
ListenerList<Listener> listeners;
|
||||
|
@ -46,9 +46,7 @@ namespace AnimatedPositionBehaviours
|
||||
*/
|
||||
struct ContinuousWithMomentum
|
||||
{
|
||||
ContinuousWithMomentum() noexcept
|
||||
{
|
||||
}
|
||||
ContinuousWithMomentum() = default;
|
||||
|
||||
/** Sets the friction that damps the movement of the value.
|
||||
A typical value is 0.08; higher values indicate more friction.
|
||||
@ -114,9 +112,7 @@ namespace AnimatedPositionBehaviours
|
||||
*/
|
||||
struct SnapToPageBoundaries
|
||||
{
|
||||
SnapToPageBoundaries() noexcept : targetSnapPosition()
|
||||
{
|
||||
}
|
||||
SnapToPageBoundaries() = default;
|
||||
|
||||
/** Called by the AnimatedPosition class. This tells us the position and
|
||||
velocity at which the user is about to release the object.
|
||||
@ -154,7 +150,7 @@ namespace AnimatedPositionBehaviours
|
||||
}
|
||||
|
||||
private:
|
||||
double targetSnapPosition;
|
||||
double targetSnapPosition = 0.0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -159,8 +159,7 @@ public:
|
||||
else
|
||||
jassertfalse; // seem to be trying to animate a component that's not visible..
|
||||
|
||||
auto scale = (float) Desktop::getInstance().getDisplays()
|
||||
.getDisplayContaining (getScreenBounds().getCentre()).scale;
|
||||
auto scale = (float) Desktop::getInstance().getDisplays().findDisplayForRect (getScreenBounds()).scale;
|
||||
|
||||
image = c.createComponentSnapshot (c.getLocalBounds(), false, scale);
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
ComponentAnimator();
|
||||
|
||||
/** Destructor. */
|
||||
~ComponentAnimator();
|
||||
~ComponentAnimator() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Starts a component moving from its current position to a specified position.
|
||||
@ -87,7 +87,7 @@ public:
|
||||
component, or if there's a chance the parent might decide to delete its children.
|
||||
@param startSpeed a value to indicate the relative start speed of the animation. If this is 0,
|
||||
the component will start by accelerating from rest; higher values mean that it
|
||||
will have an initial speed greater than zero. If the value if greater than 1, it
|
||||
will have an initial speed greater than zero. If the value is greater than 1, it
|
||||
will decelerate towards the middle of its journey. To move the component at a
|
||||
constant rate for its entire animation, set both the start and end speeds to 1.0
|
||||
@param endSpeed a relative speed at which the component should be moving when the animation finishes.
|
||||
|
@ -117,7 +117,7 @@ void ComponentBoundsConstrainer::setBoundsForComponent (Component* component,
|
||||
if (auto* peer = component->getPeer())
|
||||
border = peer->getFrameSize();
|
||||
|
||||
auto screenBounds = Desktop::getInstance().getDisplays().getDisplayContaining (targetBounds.getCentre()).userArea;
|
||||
auto screenBounds = Desktop::getInstance().getDisplays().findDisplayForPoint (targetBounds.getCentre()).userArea;
|
||||
|
||||
limits = component->getLocalArea (nullptr, screenBounds) + component->getPosition();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
ComponentBuilder();
|
||||
|
||||
/** Destructor. */
|
||||
~ComponentBuilder();
|
||||
~ComponentBuilder() override;
|
||||
|
||||
/** This is the ValueTree data object that the builder is working with. */
|
||||
ValueTree state;
|
||||
@ -186,8 +186,8 @@ public:
|
||||
class JUCE_API ImageProvider
|
||||
{
|
||||
public:
|
||||
ImageProvider() {}
|
||||
virtual ~ImageProvider() {}
|
||||
ImageProvider() = default;
|
||||
virtual ~ImageProvider() = default;
|
||||
|
||||
/** Retrieves the image associated with this identifier, which could be any
|
||||
kind of string, number, filename, etc.
|
||||
|
@ -49,10 +49,10 @@ class JUCE_API ComponentMovementWatcher : public ComponentListener
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates a ComponentMovementWatcher to watch a given target component. */
|
||||
ComponentMovementWatcher (Component* component);
|
||||
ComponentMovementWatcher (Component* componentToWatch);
|
||||
|
||||
/** Destructor. */
|
||||
~ComponentMovementWatcher();
|
||||
~ComponentMovementWatcher() override;
|
||||
|
||||
//==============================================================================
|
||||
/** This callback happens when the component that is being watched is moved
|
||||
@ -68,7 +68,7 @@ public:
|
||||
virtual void componentVisibilityChanged() = 0;
|
||||
|
||||
/** Returns the component that's being watched. */
|
||||
Component* getComponent() const noexcept { return component; }
|
||||
Component* getComponent() const noexcept { return component.get(); }
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
ConcertinaPanel();
|
||||
|
||||
/** Destructor. */
|
||||
~ConcertinaPanel();
|
||||
~ConcertinaPanel() override;
|
||||
|
||||
/** Adds a component to the panel.
|
||||
@param insertIndex the index at which this component will be inserted, or
|
||||
@ -113,7 +113,7 @@ public:
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void drawConcertinaPanelHeader (Graphics&, const Rectangle<int>& area,
|
||||
bool isMouseOver, bool isMouseDown,
|
||||
@ -125,11 +125,6 @@ private:
|
||||
|
||||
class PanelHolder;
|
||||
struct PanelSizes;
|
||||
friend class PanelHolder;
|
||||
friend struct PanelSizes;
|
||||
friend struct ContainerDeletePolicy<PanelSizes>;
|
||||
friend struct ContainerDeletePolicy<PanelHolder>;
|
||||
|
||||
std::unique_ptr<PanelSizes> currentSizes;
|
||||
OwnedArray<PanelHolder> holders;
|
||||
ComponentAnimator animator;
|
||||
|
@ -298,7 +298,12 @@ struct Grid::PlacementHelpers
|
||||
const std::map<juce::String, LineArea>& namedAreas)
|
||||
{
|
||||
if (item.area.isNotEmpty() && ! grid.templateAreas.isEmpty())
|
||||
{
|
||||
// Must be a named area!
|
||||
jassert (namedAreas.count (item.area) != 0);
|
||||
|
||||
return namedAreas.at (item.area);
|
||||
}
|
||||
|
||||
return { deduceLineRange (item.column, grid.templateColumns),
|
||||
deduceLineRange (item.row, grid.templateRows) };
|
||||
@ -349,11 +354,7 @@ struct Grid::PlacementHelpers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string == emptyAreaCharacter)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (string == area.name)
|
||||
if (string == area.name)
|
||||
{
|
||||
area.lines.row.end = stringsArrays.indexOf (stringArray) + 2;
|
||||
area.lines.column.end = stringArray.indexOf (string) + 2;
|
||||
@ -532,9 +533,9 @@ struct Grid::AutoPlacement
|
||||
{
|
||||
struct Cell { int column, row; };
|
||||
|
||||
OccupancyPlane (int highestColumnToUse, int highestRowToUse, bool isColoumnFirst)
|
||||
: highestCrossDimension (isColoumnFirst ? highestRowToUse : highestColumnToUse),
|
||||
columnFirst (isColoumnFirst)
|
||||
OccupancyPlane (int highestColumnToUse, int highestRowToUse, bool isColumnFirst)
|
||||
: highestCrossDimension (isColumnFirst ? highestRowToUse : highestColumnToUse),
|
||||
columnFirst (isColumnFirst)
|
||||
{}
|
||||
|
||||
Grid::PlacementHelpers::LineArea setCell (Cell cell, int columnSpan, int rowSpan)
|
||||
|
@ -27,16 +27,15 @@
|
||||
namespace juce
|
||||
{
|
||||
|
||||
struct GridTests : public juce::UnitTest
|
||||
struct GridTests : public UnitTest
|
||||
{
|
||||
GridTests() : juce::UnitTest ("Grid class") {}
|
||||
GridTests() : UnitTest ("Grid class") {}
|
||||
|
||||
void runTest() override
|
||||
{
|
||||
using Fr = juce::Grid::Fr;
|
||||
using Tr = juce::Grid::TrackInfo;
|
||||
using Rect = juce::Rectangle<float>;
|
||||
using Grid = juce::Grid;
|
||||
using Fr = Grid::Fr;
|
||||
using Tr = Grid::TrackInfo;
|
||||
using Rect = Rectangle<float>;
|
||||
|
||||
{
|
||||
Grid grid;
|
||||
@ -47,7 +46,7 @@ struct GridTests : public juce::UnitTest
|
||||
grid.items.addArray ({ GridItem().withArea (1, 1),
|
||||
GridItem().withArea (2, 1) });
|
||||
|
||||
grid.performLayout (juce::Rectangle<int> (200, 400));
|
||||
grid.performLayout (Rectangle<int> (200, 400));
|
||||
|
||||
beginTest ("Layout calculation test: 1 column x 2 rows: no gap");
|
||||
expect (grid.items[0].currentBounds == Rect (0.0f, 0.0f, 200.f, 20.0f));
|
||||
@ -61,7 +60,7 @@ struct GridTests : public juce::UnitTest
|
||||
GridItem().withArea (3, 1),
|
||||
GridItem().withArea (3, 2) });
|
||||
|
||||
grid.performLayout (juce::Rectangle<int> (150, 170));
|
||||
grid.performLayout (Rectangle<int> (150, 170));
|
||||
|
||||
beginTest ("Layout calculation test: 2 columns x 3 rows: no gap");
|
||||
expect (grid.items[0].currentBounds == Rect (0.0f, 0.0f, 100.0f, 20.0f));
|
||||
@ -74,7 +73,7 @@ struct GridTests : public juce::UnitTest
|
||||
grid.columnGap = 20_px;
|
||||
grid.rowGap = 10_px;
|
||||
|
||||
grid.performLayout (juce::Rectangle<int> (200, 310));
|
||||
grid.performLayout (Rectangle<int> (200, 310));
|
||||
|
||||
beginTest ("Layout calculation test: 2 columns x 3 rows: rowGap of 10 and columnGap of 20");
|
||||
expect (grid.items[0].currentBounds == Rect (0.0f, 0.0f, 130.0f, 20.0f));
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
const String& labelText = String());
|
||||
|
||||
/** Destructor. */
|
||||
~GroupComponent();
|
||||
~GroupComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the text that's shown at the top of the component. */
|
||||
@ -89,7 +89,7 @@ public:
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void drawGroupComponentOutline (Graphics&, int w, int h, const String& text,
|
||||
const Justification&, GroupComponent&) = 0;
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
MultiDocumentPanelWindow (Colour backgroundColour);
|
||||
|
||||
/** Destructor. */
|
||||
~MultiDocumentPanelWindow();
|
||||
~MultiDocumentPanelWindow() override;
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
@ -106,7 +106,7 @@ public:
|
||||
before closing, then you should call closeAllDocuments (true) and check that
|
||||
it returns true before deleting the panel.
|
||||
*/
|
||||
~MultiDocumentPanel();
|
||||
~MultiDocumentPanel() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Tries to close all the documents.
|
||||
|
@ -27,10 +27,8 @@
|
||||
namespace juce
|
||||
{
|
||||
|
||||
ResizableBorderComponent::Zone::Zone() noexcept : zone (0) {}
|
||||
|
||||
ResizableBorderComponent::Zone::Zone (const int zoneFlags) noexcept : zone (zoneFlags) {}
|
||||
|
||||
ResizableBorderComponent::Zone::Zone() noexcept {}
|
||||
ResizableBorderComponent::Zone::Zone (int zoneFlags) noexcept : zone (zoneFlags) {}
|
||||
ResizableBorderComponent::Zone::Zone (const ResizableBorderComponent::Zone& other) noexcept : zone (other.zone) {}
|
||||
|
||||
ResizableBorderComponent::Zone& ResizableBorderComponent::Zone::operator= (const ResizableBorderComponent::Zone& other) noexcept
|
||||
@ -42,8 +40,8 @@ ResizableBorderComponent::Zone& ResizableBorderComponent::Zone::operator= (const
|
||||
bool ResizableBorderComponent::Zone::operator== (const ResizableBorderComponent::Zone& other) const noexcept { return zone == other.zone; }
|
||||
bool ResizableBorderComponent::Zone::operator!= (const ResizableBorderComponent::Zone& other) const noexcept { return zone != other.zone; }
|
||||
|
||||
ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize,
|
||||
const BorderSize<int>& border,
|
||||
ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (Rectangle<int> totalSize,
|
||||
BorderSize<int> border,
|
||||
Point<int> position)
|
||||
{
|
||||
int z = 0;
|
||||
@ -51,13 +49,15 @@ ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBor
|
||||
if (totalSize.contains (position)
|
||||
&& ! border.subtractedFrom (totalSize).contains (position))
|
||||
{
|
||||
const int minW = jmax (totalSize.getWidth() / 10, jmin (10, totalSize.getWidth() / 3));
|
||||
auto minW = jmax (totalSize.getWidth() / 10, jmin (10, totalSize.getWidth() / 3));
|
||||
|
||||
if (position.x < jmax (border.getLeft(), minW) && border.getLeft() > 0)
|
||||
z |= left;
|
||||
else if (position.x >= totalSize.getWidth() - jmax (border.getRight(), minW) && border.getRight() > 0)
|
||||
z |= right;
|
||||
|
||||
const int minH = jmax (totalSize.getHeight() / 10, jmin (10, totalSize.getHeight() / 3));
|
||||
auto minH = jmax (totalSize.getHeight() / 10, jmin (10, totalSize.getHeight() / 3));
|
||||
|
||||
if (position.y < jmax (border.getTop(), minH) && border.getTop() > 0)
|
||||
z |= top;
|
||||
else if (position.y >= totalSize.getHeight() - jmax (border.getBottom(), minH) && border.getBottom() > 0)
|
||||
@ -69,7 +69,7 @@ ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBor
|
||||
|
||||
MouseCursor ResizableBorderComponent::Zone::getMouseCursor() const noexcept
|
||||
{
|
||||
MouseCursor::StandardCursorType mc = MouseCursor::NormalCursor;
|
||||
auto mc = MouseCursor::NormalCursor;
|
||||
|
||||
switch (zone)
|
||||
{
|
||||
@ -141,7 +141,7 @@ void ResizableBorderComponent::mouseDrag (const MouseEvent& e)
|
||||
return;
|
||||
}
|
||||
|
||||
const Rectangle<int> newBounds (mouseZone.resizeRectangleBy (originalBounds, e.getOffsetFromDragStart()));
|
||||
auto newBounds = mouseZone.resizeRectangleBy (originalBounds, e.getOffsetFromDragStart());
|
||||
|
||||
if (constrainer != nullptr)
|
||||
{
|
||||
@ -153,8 +153,8 @@ void ResizableBorderComponent::mouseDrag (const MouseEvent& e)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Component::Positioner* const pos = component->getPositioner())
|
||||
pos->applyNewBounds (newBounds);
|
||||
if (auto* p = component->getPositioner())
|
||||
p->applyNewBounds (newBounds);
|
||||
else
|
||||
component->setBounds (newBounds);
|
||||
}
|
||||
@ -190,7 +190,7 @@ BorderSize<int> ResizableBorderComponent::getBorderThickness() const
|
||||
|
||||
void ResizableBorderComponent::updateMouseZone (const MouseEvent& e)
|
||||
{
|
||||
Zone newZone (Zone::fromPositionOnBorder (getLocalBounds(), borderSize, e.getPosition()));
|
||||
auto newZone = Zone::fromPositionOnBorder (getLocalBounds(), borderSize, e.getPosition());
|
||||
|
||||
if (mouseZone != newZone)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
ComponentBoundsConstrainer* constrainer);
|
||||
|
||||
/** Destructor. */
|
||||
~ResizableBorderComponent();
|
||||
~ResizableBorderComponent() override;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
@ -119,8 +119,8 @@ public:
|
||||
/** Given a point within a rectangle with a resizable border, this returns the
|
||||
zone that the point lies within.
|
||||
*/
|
||||
static Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
|
||||
const BorderSize<int>& border,
|
||||
static Zone fromPositionOnBorder (Rectangle<int> totalSize,
|
||||
BorderSize<int> border,
|
||||
Point<int> position);
|
||||
|
||||
/** Returns an appropriate mouse-cursor for this resize zone. */
|
||||
@ -160,7 +160,7 @@ public:
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
int zone;
|
||||
int zone = centre;
|
||||
};
|
||||
|
||||
/** Returns the zone in which the mouse was last seen. */
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
ComponentBoundsConstrainer* constrainer);
|
||||
|
||||
/** Destructor. */
|
||||
~ResizableCornerComponent();
|
||||
~ResizableCornerComponent() override;
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -77,7 +77,7 @@ void ResizableEdgeComponent::mouseDrag (const MouseEvent& e)
|
||||
return;
|
||||
}
|
||||
|
||||
Rectangle<int> newBounds (originalBounds);
|
||||
auto newBounds = originalBounds;
|
||||
|
||||
switch (edge)
|
||||
{
|
||||
@ -98,8 +98,8 @@ void ResizableEdgeComponent::mouseDrag (const MouseEvent& e)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Component::Positioner* const pos = component->getPositioner())
|
||||
pos->applyNewBounds (newBounds);
|
||||
if (auto* p = component->getPositioner())
|
||||
p->applyNewBounds (newBounds);
|
||||
else
|
||||
component->setBounds (newBounds);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
Edge edgeToResize);
|
||||
|
||||
/** Destructor. */
|
||||
~ResizableEdgeComponent();
|
||||
~ResizableEdgeComponent() override;
|
||||
|
||||
bool isVertical() const noexcept;
|
||||
|
||||
|
@ -308,7 +308,7 @@ void ScrollBar::resized()
|
||||
|
||||
if (upButton != nullptr)
|
||||
{
|
||||
Rectangle<int> r (getLocalBounds());
|
||||
auto r = getLocalBounds();
|
||||
|
||||
if (vertical)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
ScrollBar (bool isVertical);
|
||||
|
||||
/** Destructor. */
|
||||
~ScrollBar();
|
||||
~ScrollBar() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns true if the scrollbar is vertical, false if it's horizontal. */
|
||||
@ -305,7 +305,7 @@ public:
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~Listener() {}
|
||||
virtual ~Listener() = default;
|
||||
|
||||
/** Called when a ScrollBar is moved.
|
||||
|
||||
@ -328,7 +328,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual bool areScrollbarButtonsVisible() = 0;
|
||||
|
||||
@ -420,7 +420,6 @@ private:
|
||||
int initialDelayInMillisecs = 100, repeatDelayInMillisecs = 50, minimumDelayInMillisecs = 10;
|
||||
bool vertical, isDraggingThumb = false, autohides = true, userVisibilityFlag = false;
|
||||
class ScrollbarButton;
|
||||
friend struct ContainerDeletePolicy<ScrollbarButton>;
|
||||
std::unique_ptr<ScrollbarButton> upButton, downButton;
|
||||
ListenerList<Listener> listeners;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
bool deleteComponentWhenNoLongerNeeded = true);
|
||||
|
||||
/** Destructor */
|
||||
~SidePanel();
|
||||
~SidePanel() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Sets the component that this SidePanel will contain.
|
||||
@ -161,7 +161,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual Font getSidePanelTitleFont (SidePanel&) = 0;
|
||||
virtual Justification getSidePanelTitleJustification (SidePanel&) = 0;
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
bool isBarVertical);
|
||||
|
||||
/** Destructor. */
|
||||
~StretchableLayoutResizerBar();
|
||||
~StretchableLayoutResizerBar() override;
|
||||
|
||||
//==============================================================================
|
||||
/** This is called when the bar is dragged.
|
||||
@ -79,7 +79,7 @@ public:
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void drawStretchableLayoutResizerBar (Graphics&, int w, int h,
|
||||
bool isVerticalBar, bool isMouseOver, bool isMouseDragging) = 0;
|
||||
|
@ -39,9 +39,9 @@ int TabBarButton::getIndex() const { return owner.indexOfTa
|
||||
Colour TabBarButton::getTabBackgroundColour() const { return owner.getTabBackgroundColour (getIndex()); }
|
||||
bool TabBarButton::isFrontTab() const { return getToggleState(); }
|
||||
|
||||
void TabBarButton::paintButton (Graphics& g, const bool isMouseOverButton, const bool isButtonDown)
|
||||
void TabBarButton::paintButton (Graphics& g, const bool shouldDrawButtonAsHighlighted, const bool shouldDrawButtonAsDown)
|
||||
{
|
||||
getLookAndFeel().drawTabButton (*this, g, isMouseOverButton, isButtonDown);
|
||||
getLookAndFeel().drawTabButton (*this, g, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown);
|
||||
}
|
||||
|
||||
void TabBarButton::clicked (const ModifierKeys& mods)
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
TabBarButton (const String& name, TabbedButtonBar& ownerBar);
|
||||
|
||||
/** Destructor. */
|
||||
~TabBarButton();
|
||||
~TabBarButton() override;
|
||||
|
||||
/** Returns the bar that contains this button. */
|
||||
TabbedButtonBar& getTabbedButtonBar() const { return owner; }
|
||||
@ -109,7 +109,7 @@ public:
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paintButton (Graphics&, bool isMouseOverButton, bool isButtonDown) override;
|
||||
void paintButton (Graphics&, bool, bool) override;
|
||||
/** @internal */
|
||||
void clicked (const ModifierKeys&) override;
|
||||
/** @internal */
|
||||
@ -173,7 +173,7 @@ public:
|
||||
TabbedButtonBar (Orientation orientation);
|
||||
|
||||
/** Destructor. */
|
||||
~TabbedButtonBar();
|
||||
~TabbedButtonBar() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the bar's orientation.
|
||||
@ -308,7 +308,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual int getTabButtonSpaceAroundImage() = 0;
|
||||
virtual int getTabButtonOverlap (int tabDepth) = 0;
|
||||
@ -359,8 +359,6 @@ private:
|
||||
int currentTabIndex = -1;
|
||||
|
||||
class BehindFrontTabComp;
|
||||
friend class BehindFrontTabComp;
|
||||
friend struct ContainerDeletePolicy<BehindFrontTabComp>;
|
||||
std::unique_ptr<BehindFrontTabComp> behindFrontTab;
|
||||
std::unique_ptr<Button> extraTabsButton;
|
||||
|
||||
|
@ -31,14 +31,14 @@ namespace TabbedComponentHelpers
|
||||
{
|
||||
const Identifier deleteComponentId ("deleteByTabComp_");
|
||||
|
||||
static void deleteIfNecessary (Component* const comp)
|
||||
static void deleteIfNecessary (Component* comp)
|
||||
{
|
||||
if (comp != nullptr && (bool) comp->getProperties() [deleteComponentId])
|
||||
delete comp;
|
||||
}
|
||||
|
||||
static Rectangle<int> getTabArea (Rectangle<int>& content, BorderSize<int>& outline,
|
||||
const TabbedButtonBar::Orientation orientation, const int tabDepth)
|
||||
TabbedButtonBar::Orientation orientation, int tabDepth)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
@ -71,7 +71,7 @@ struct TabbedComponent::ButtonBar : public TabbedButtonBar
|
||||
owner.popupMenuClickOnTab (tabIndex, tabName);
|
||||
}
|
||||
|
||||
Colour getTabBackgroundColour (const int tabIndex)
|
||||
Colour getTabBackgroundColour (int tabIndex)
|
||||
{
|
||||
return owner.tabs->getTabBackgroundColour (tabIndex);
|
||||
}
|
||||
@ -88,7 +88,7 @@ struct TabbedComponent::ButtonBar : public TabbedButtonBar
|
||||
|
||||
|
||||
//==============================================================================
|
||||
TabbedComponent::TabbedComponent (const TabbedButtonBar::Orientation orientation)
|
||||
TabbedComponent::TabbedComponent (TabbedButtonBar::Orientation orientation)
|
||||
{
|
||||
tabs.reset (new ButtonBar (*this, orientation));
|
||||
addAndMakeVisible (tabs.get());
|
||||
@ -101,7 +101,7 @@ TabbedComponent::~TabbedComponent()
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void TabbedComponent::setOrientation (const TabbedButtonBar::Orientation orientation)
|
||||
void TabbedComponent::setOrientation (TabbedButtonBar::Orientation orientation)
|
||||
{
|
||||
tabs->setOrientation (orientation);
|
||||
resized();
|
||||
@ -112,7 +112,7 @@ TabbedButtonBar::Orientation TabbedComponent::getOrientation() const noexcept
|
||||
return tabs->getOrientation();
|
||||
}
|
||||
|
||||
void TabbedComponent::setTabBarDepth (const int newDepth)
|
||||
void TabbedComponent::setTabBarDepth (int newDepth)
|
||||
{
|
||||
if (tabDepth != newDepth)
|
||||
{
|
||||
@ -121,7 +121,7 @@ void TabbedComponent::setTabBarDepth (const int newDepth)
|
||||
}
|
||||
}
|
||||
|
||||
TabBarButton* TabbedComponent::createTabButton (const String& tabName, const int /*tabIndex*/)
|
||||
TabBarButton* TabbedComponent::createTabButton (const String& tabName, int /*tabIndex*/)
|
||||
{
|
||||
return new TabBarButton (tabName, *tabs);
|
||||
}
|
||||
@ -132,7 +132,7 @@ void TabbedComponent::clearTabs()
|
||||
if (panelComponent != nullptr)
|
||||
{
|
||||
panelComponent->setVisible (false);
|
||||
removeChildComponent (panelComponent);
|
||||
removeChildComponent (panelComponent.get());
|
||||
panelComponent = nullptr;
|
||||
}
|
||||
|
||||
@ -146,9 +146,9 @@ void TabbedComponent::clearTabs()
|
||||
|
||||
void TabbedComponent::addTab (const String& tabName,
|
||||
Colour tabBackgroundColour,
|
||||
Component* const contentComponent,
|
||||
const bool deleteComponentWhenNotNeeded,
|
||||
const int insertIndex)
|
||||
Component* contentComponent,
|
||||
bool deleteComponentWhenNotNeeded,
|
||||
int insertIndex)
|
||||
{
|
||||
contentComponents.insert (insertIndex, WeakReference<Component> (contentComponent));
|
||||
|
||||
@ -159,22 +159,22 @@ void TabbedComponent::addTab (const String& tabName,
|
||||
resized();
|
||||
}
|
||||
|
||||
void TabbedComponent::setTabName (const int tabIndex, const String& newName)
|
||||
void TabbedComponent::setTabName (int tabIndex, const String& newName)
|
||||
{
|
||||
tabs->setTabName (tabIndex, newName);
|
||||
}
|
||||
|
||||
void TabbedComponent::removeTab (const int tabIndex)
|
||||
void TabbedComponent::removeTab (int tabIndex)
|
||||
{
|
||||
if (isPositiveAndBelow (tabIndex, contentComponents.size()))
|
||||
{
|
||||
TabbedComponentHelpers::deleteIfNecessary (contentComponents.getReference (tabIndex));
|
||||
TabbedComponentHelpers::deleteIfNecessary (contentComponents.getReference (tabIndex).get());
|
||||
contentComponents.remove (tabIndex);
|
||||
tabs->removeTab (tabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void TabbedComponent::moveTab (const int currentIndex, const int newIndex, const bool animate)
|
||||
void TabbedComponent::moveTab (int currentIndex, int newIndex, bool animate)
|
||||
{
|
||||
contentComponents.move (currentIndex, newIndex);
|
||||
tabs->moveTab (currentIndex, newIndex, animate);
|
||||
@ -190,17 +190,17 @@ StringArray TabbedComponent::getTabNames() const
|
||||
return tabs->getTabNames();
|
||||
}
|
||||
|
||||
Component* TabbedComponent::getTabContentComponent (const int tabIndex) const noexcept
|
||||
Component* TabbedComponent::getTabContentComponent (int tabIndex) const noexcept
|
||||
{
|
||||
return contentComponents [tabIndex];
|
||||
return contentComponents[tabIndex].get();
|
||||
}
|
||||
|
||||
Colour TabbedComponent::getTabBackgroundColour (const int tabIndex) const noexcept
|
||||
Colour TabbedComponent::getTabBackgroundColour (int tabIndex) const noexcept
|
||||
{
|
||||
return tabs->getTabBackgroundColour (tabIndex);
|
||||
}
|
||||
|
||||
void TabbedComponent::setTabBackgroundColour (const int tabIndex, Colour newColour)
|
||||
void TabbedComponent::setTabBackgroundColour (int tabIndex, Colour newColour)
|
||||
{
|
||||
tabs->setTabBackgroundColour (tabIndex, newColour);
|
||||
|
||||
@ -208,7 +208,7 @@ void TabbedComponent::setTabBackgroundColour (const int tabIndex, Colour newColo
|
||||
repaint();
|
||||
}
|
||||
|
||||
void TabbedComponent::setCurrentTabIndex (const int newTabIndex, const bool sendChangeMessage)
|
||||
void TabbedComponent::setCurrentTabIndex (int newTabIndex, bool sendChangeMessage)
|
||||
{
|
||||
tabs->setCurrentTabIndex (newTabIndex, sendChangeMessage);
|
||||
}
|
||||
@ -223,14 +223,14 @@ String TabbedComponent::getCurrentTabName() const
|
||||
return tabs->getCurrentTabName();
|
||||
}
|
||||
|
||||
void TabbedComponent::setOutline (const int thickness)
|
||||
void TabbedComponent::setOutline (int thickness)
|
||||
{
|
||||
outlineThickness = thickness;
|
||||
resized();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void TabbedComponent::setIndent (const int indentThickness)
|
||||
void TabbedComponent::setIndent (int indentThickness)
|
||||
{
|
||||
edgeIndent = indentThickness;
|
||||
resized();
|
||||
@ -266,19 +266,19 @@ void TabbedComponent::resized()
|
||||
tabs->setBounds (TabbedComponentHelpers::getTabArea (content, outline, getOrientation(), tabDepth));
|
||||
content = BorderSize<int> (edgeIndent).subtractedFrom (outline.subtractedFrom (content));
|
||||
|
||||
for (int i = contentComponents.size(); --i >= 0;)
|
||||
if (Component* c = contentComponents.getReference(i))
|
||||
c->setBounds (content);
|
||||
for (auto& c : contentComponents)
|
||||
if (auto comp = c.get())
|
||||
comp->setBounds (content);
|
||||
}
|
||||
|
||||
void TabbedComponent::lookAndFeelChanged()
|
||||
{
|
||||
for (int i = contentComponents.size(); --i >= 0;)
|
||||
if (Component* c = contentComponents.getReference(i))
|
||||
c->lookAndFeelChanged();
|
||||
for (auto& c : contentComponents)
|
||||
if (auto comp = c.get())
|
||||
comp->lookAndFeelChanged();
|
||||
}
|
||||
|
||||
void TabbedComponent::changeCallback (const int newCurrentTabIndex, const String& newTabName)
|
||||
void TabbedComponent::changeCallback (int newCurrentTabIndex, const String& newTabName)
|
||||
{
|
||||
auto* newPanelComp = getTabContentComponent (getCurrentTabIndex());
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
explicit TabbedComponent (TabbedButtonBar::Orientation orientation);
|
||||
|
||||
/** Destructor. */
|
||||
~TabbedComponent();
|
||||
~TabbedComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the placement of the tabs.
|
||||
@ -162,7 +162,7 @@ public:
|
||||
/** Returns the current component that's filling the panel.
|
||||
This will return nullptr if there isn't one.
|
||||
*/
|
||||
Component* getCurrentContentComponent() const noexcept { return panelComponent; }
|
||||
Component* getCurrentContentComponent() const noexcept { return panelComponent.get(); }
|
||||
|
||||
//==============================================================================
|
||||
/** Callback method to indicate the selected tab has been changed.
|
||||
|
@ -37,10 +37,7 @@ Viewport::Viewport (const String& name) : Component (name)
|
||||
|
||||
setInterceptsMouseClicks (false, true);
|
||||
setWantsKeyboardFocus (true);
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
setScrollOnDragEnabled (true);
|
||||
#endif
|
||||
setScrollOnDragEnabled (Desktop::getInstance().getMainMouseSource().isTouch());
|
||||
|
||||
recreateScrollbars();
|
||||
}
|
||||
@ -66,7 +63,7 @@ void Viewport::deleteOrRemoveContentComp()
|
||||
{
|
||||
// This sets the content comp to a null pointer before deleting the old one, in case
|
||||
// anything tries to use the old one while it's in mid-deletion..
|
||||
std::unique_ptr<Component> oldCompDeleter (contentComp);
|
||||
std::unique_ptr<Component> oldCompDeleter (contentComp.get());
|
||||
contentComp = nullptr;
|
||||
}
|
||||
else
|
||||
@ -124,7 +121,7 @@ Point<int> Viewport::viewportPosToCompPos (Point<int> pos) const
|
||||
{
|
||||
jassert (contentComp != nullptr);
|
||||
|
||||
auto contentBounds = contentHolder.getLocalArea (contentComp, contentComp->getLocalBounds());
|
||||
auto contentBounds = contentHolder.getLocalArea (contentComp.get(), contentComp->getLocalBounds());
|
||||
|
||||
Point<int> p (jmax (jmin (0, contentHolder.getWidth() - contentBounds.getWidth()), jmin (0, -(pos.x))),
|
||||
jmax (jmin (0, contentHolder.getHeight() - contentBounds.getHeight()), jmin (0, -(pos.y))));
|
||||
@ -214,7 +211,7 @@ struct Viewport::DragToScrollListener : private MouseListener,
|
||||
offsetY.behaviour.setMinimumVelocity (60);
|
||||
}
|
||||
|
||||
~DragToScrollListener()
|
||||
~DragToScrollListener() override
|
||||
{
|
||||
viewport.contentHolder.removeMouseListener (this);
|
||||
Desktop::getInstance().removeGlobalMouseListener (this);
|
||||
@ -398,8 +395,9 @@ void Viewport::updateVisibleArea()
|
||||
}
|
||||
|
||||
Rectangle<int> contentBounds;
|
||||
if (contentComp != nullptr)
|
||||
contentBounds = contentHolder.getLocalArea (contentComp, contentComp->getLocalBounds());
|
||||
|
||||
if (auto cc = contentComp.get())
|
||||
contentBounds = contentHolder.getLocalArea (cc, cc->getLocalBounds());
|
||||
|
||||
auto visibleOrigin = -contentBounds.getPosition();
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
explicit Viewport (const String& componentName = String());
|
||||
|
||||
/** Destructor. */
|
||||
~Viewport();
|
||||
~Viewport() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Sets the component that this viewport will contain and scroll around.
|
||||
@ -81,7 +81,7 @@ public:
|
||||
|
||||
@see setViewedComponent
|
||||
*/
|
||||
Component* getViewedComponent() const noexcept { return contentComp; }
|
||||
Component* getViewedComponent() const noexcept { return contentComp.get(); }
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the position of the viewed component.
|
||||
@ -272,7 +272,12 @@ public:
|
||||
*/
|
||||
bool canScrollHorizontally() const noexcept;
|
||||
|
||||
/** Enables or disables drag-to-scroll functionality in the viewport. */
|
||||
/** Enables or disables drag-to-scroll functionality in the viewport.
|
||||
|
||||
If your viewport contains a Component that you don't want to receive mouse events when the
|
||||
user is drag-scrolling, you can disable this with the Component::setViewportIgnoreDragFlag()
|
||||
method.
|
||||
*/
|
||||
void setScrollOnDragEnabled (bool shouldScrollOnDrag);
|
||||
|
||||
/** Returns true if drag-to-scroll functionality is enabled. */
|
||||
@ -322,8 +327,6 @@ private:
|
||||
bool vScrollbarRight = true, hScrollbarBottom = true;
|
||||
|
||||
struct DragToScrollListener;
|
||||
friend struct DragToScrollListener;
|
||||
friend struct ContainerDeletePolicy<DragToScrollListener>;
|
||||
std::unique_ptr<DragToScrollListener> dragToScrollListener;
|
||||
|
||||
Point<int> viewportPosToCompPos (Point<int>) const;
|
||||
|
Reference in New Issue
Block a user