mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-19 01:04:20 +00:00
Tweaked the format of a ComponentBoundsConstrainer method
This commit is contained in:
parent
29a357fa6f
commit
ad5d7a4254
6 changed files with 22 additions and 24 deletions
|
|
@ -399,7 +399,7 @@ void PaintElement::checkBounds (Rectangle<int>& b,
|
|||
}
|
||||
}
|
||||
|
||||
void PaintElement::applyBoundsToComponent (Component*, const Rectangle<int>& newBounds)
|
||||
void PaintElement::applyBoundsToComponent (Component&, Rectangle<int> newBounds)
|
||||
{
|
||||
if (getBounds() != newBounds)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,13 +86,13 @@ public:
|
|||
bool perform (UndoableAction* action, const String& actionName);
|
||||
|
||||
//==============================================================================
|
||||
void paint (Graphics& g);
|
||||
void resized();
|
||||
void mouseDown (const MouseEvent& e);
|
||||
void mouseDrag (const MouseEvent& e);
|
||||
void mouseUp (const MouseEvent& e);
|
||||
void changeListenerCallback (ChangeBroadcaster*);
|
||||
void parentHierarchyChanged();
|
||||
void paint (Graphics&) override;
|
||||
void resized() override;
|
||||
void mouseDown (const MouseEvent&) override;
|
||||
void mouseDrag (const MouseEvent&) override;
|
||||
void mouseUp (const MouseEvent&) override;
|
||||
void changeListenerCallback (ChangeBroadcaster*) override;
|
||||
void parentHierarchyChanged() override;
|
||||
|
||||
virtual void applyCustomPaintSnippets (StringArray&) {}
|
||||
|
||||
|
|
@ -102,17 +102,17 @@ protected:
|
|||
PaintRoutine* const owner;
|
||||
RelativePositionedRectangle position;
|
||||
|
||||
void resizeStart();
|
||||
void resizeEnd();
|
||||
void resizeStart() override;
|
||||
void resizeEnd() override;
|
||||
void checkBounds (Rectangle<int>& bounds,
|
||||
const Rectangle<int>& previousBounds,
|
||||
const Rectangle<int>& limits,
|
||||
bool isStretchingTop,
|
||||
bool isStretchingLeft,
|
||||
bool isStretchingBottom,
|
||||
bool isStretchingRight);
|
||||
bool isStretchingRight) override;
|
||||
|
||||
void applyBoundsToComponent (Component* component, const Rectangle<int>& bounds);
|
||||
void applyBoundsToComponent (Component&, Rectangle<int>) override;
|
||||
|
||||
Rectangle<int> getCurrentAbsoluteBounds() const;
|
||||
void getCurrentAbsoluteBoundsDouble (double& x, double& y, double& w, double& h) const;
|
||||
|
|
|
|||
|
|
@ -234,15 +234,15 @@ void ComponentOverlayComponent::checkBounds (Rectangle<int>& b,
|
|||
}
|
||||
}
|
||||
|
||||
void ComponentOverlayComponent::applyBoundsToComponent (Component* component, const Rectangle<int>& b)
|
||||
void ComponentOverlayComponent::applyBoundsToComponent (Component& component, Rectangle<int> b)
|
||||
{
|
||||
if (component->getBounds() != b)
|
||||
if (component.getBounds() != b)
|
||||
{
|
||||
layout.getDocument()->getUndoManager().undoCurrentTransactionOnly();
|
||||
|
||||
component->setBounds (b);
|
||||
component.setBounds (b);
|
||||
|
||||
if (Component* const parent = target->getParentComponent())
|
||||
if (auto* parent = target->getParentComponent())
|
||||
target->setBounds (b.getX() + borderThickness - parent->getX(),
|
||||
b.getY() + borderThickness - parent->getY(),
|
||||
b.getWidth() - borderThickness * 2,
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
bool isStretchingBottom,
|
||||
bool isStretchingRight) override;
|
||||
|
||||
void applyBoundsToComponent (Component*, const Rectangle<int>&) override;
|
||||
void applyBoundsToComponent (Component&, Rectangle<int>) override;
|
||||
|
||||
//==============================================================================
|
||||
Component::SafePointer<Component> target;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void ComponentBoundsConstrainer::setBoundsForComponent (Component* component,
|
|||
|
||||
border.subtractFrom (bounds);
|
||||
|
||||
applyBoundsToComponent (component, bounds);
|
||||
applyBoundsToComponent (*component, bounds);
|
||||
}
|
||||
|
||||
void ComponentBoundsConstrainer::checkComponentBounds (Component* component)
|
||||
|
|
@ -138,14 +138,12 @@ void ComponentBoundsConstrainer::checkComponentBounds (Component* component)
|
|||
false, false, false, false);
|
||||
}
|
||||
|
||||
void ComponentBoundsConstrainer::applyBoundsToComponent (Component* component, Rectangle<int> bounds)
|
||||
void ComponentBoundsConstrainer::applyBoundsToComponent (Component& component, Rectangle<int> bounds)
|
||||
{
|
||||
jassert (component != nullptr);
|
||||
|
||||
if (auto* positioner = component->getPositioner())
|
||||
if (auto* positioner = component.getPositioner())
|
||||
positioner->applyNewBounds (bounds);
|
||||
else
|
||||
component->setBounds (bounds);
|
||||
component.setBounds (bounds);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public:
|
|||
By default this just calls setBounds(), but is virtual in case it's needed for
|
||||
extremely cunning purposes.
|
||||
*/
|
||||
virtual void applyBoundsToComponent (Component* component, Rectangle<int> bounds);
|
||||
virtual void applyBoundsToComponent (Component&, Rectangle<int> bounds);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue