1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added a method CallOutBox::getBorderSize

This commit is contained in:
jules 2014-03-15 12:30:32 +00:00
parent 42482fc5db
commit fbaa559a19
2 changed files with 11 additions and 3 deletions

View file

@ -23,7 +23,7 @@
*/
CallOutBox::CallOutBox (Component& c, const Rectangle<int>& area, Component* const parent)
: borderSpace (20), arrowSize (16.0f), content (c)
: arrowSize (16.0f), content (c)
{
addAndMakeVisible (content);
@ -86,10 +86,14 @@ CallOutBox& CallOutBox::launchAsynchronously (Component* content, const Rectangl
void CallOutBox::setArrowSize (const float newSize)
{
arrowSize = newSize;
borderSpace = jmax (20, (int) arrowSize);
refreshPath();
}
int CallOutBox::getBorderSize() const noexcept
{
return jmax (20, (int) arrowSize);
}
void CallOutBox::paint (Graphics& g)
{
getLookAndFeel().drawCallOutBoxBackground (*this, g, outline, background);
@ -97,6 +101,7 @@ void CallOutBox::paint (Graphics& g)
void CallOutBox::resized()
{
const int borderSpace = getBorderSize();
content.setTopLeftPosition (borderSpace, borderSpace);
refreshPath();
}
@ -168,6 +173,8 @@ void CallOutBox::updatePosition (const Rectangle<int>& newAreaToPointTo, const R
targetArea = newAreaToPointTo;
availableArea = newAreaToFitIn;
const int borderSpace = getBorderSize();
Rectangle<int> newBounds (content.getWidth() + borderSpace * 2,
content.getHeight() + borderSpace * 2);