34 if (parent !=
nullptr)
58 : content (std::move (c)),
59 callout (*content, area, parent)
70 if (! detail::WindowingHelpers::isForegroundOrEmbeddedProcess (&callout))
94int CallOutBox::getBorderSize()
const noexcept
106 getLookAndFeel().drawCallOutBoxBackground (*
this, g, outline, background);
128 return outline.
contains ((
float) x, (
float) y);
133 if (dismissalMouseClicksAreAlwaysConsumed
146 if (
elapsed.inMilliseconds() > 200)
158 dismissalMouseClicksAreAlwaysConsumed = b;
161static constexpr int callOutBoxDismissCommandId = 0x4f83a04b;
167 if (
commandId == callOutBoxDismissCommandId)
220 for (
int i = 0; i < 4; ++i)
234 targetPoint = targets[i];
236 newBounds.setPosition ((
int) (centre.x - (
float)
hw),
237 (
int) (centre.y - (
float)
hh));
244void CallOutBox::refreshPath()
250 const float gap = 4.5f;
255 getLookAndFeel().getCallOutBoxCornerSize (*
this), arrowSize * 0.7f);
258void CallOutBox::timerCallback()
267 return std::make_unique<AccessibilityHandler> (*
this, AccessibilityRole::dialogWindow);
void timerCallback() override
The user-defined callback routine that actually gets called periodically.
void modalStateFinished(int) override
Called to indicate that a modal component has been dismissed.
A box with a small arrow that can be used as a temporary pop-up window to show extra controls when a ...
void inputAttemptWhenModal() override
Called when the user tries to click on a component that is blocked by another modal component.
bool keyPressed(const KeyPress &) override
Called when a key is pressed.
void handleCommandMessage(int) override
Called to handle a command that was sent by postCommandMessage().
void dismiss()
Posts a message which will dismiss the callout box asynchronously.
void updatePosition(const Rectangle< int > &newAreaToPointTo, const Rectangle< int > &newAreaToFitIn)
Updates the position and size of the box.
void childBoundsChanged(Component *) override
Called when one of this component's children is moved or resized.
void setDismissalMouseClicksAreAlwaysConsumed(bool shouldAlwaysBeConsumed) noexcept
Determines whether the mouse events for clicks outside the calloutbox are consumed,...
void setArrowSize(float newSize)
Changes the base width of the arrow.
static CallOutBox & launchAsynchronously(std::unique_ptr< Component > contentComponent, Rectangle< int > areaToPointTo, Component *parentComponent)
This will launch a callout box containing the given content, pointing to the specified target compone...
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Override this method to return a custom AccessibilityHandler for this component.
CallOutBox(Component &contentComponent, Rectangle< int > areaToPointTo, Component *parentComponent)
Creates a CallOutBox.
bool hitTest(int x, int y) override
Tests whether a given point is inside the component.
void paint(Graphics &) override
Components can override this method to draw their content.
void lookAndFeelChanged() override
Called to let the component react to a change in the look-and-feel setting.
void resized() override
Called when this component's size has been changed.
void moved() override
Called when this component's position has been changed.
@ windowIsTemporary
Indicates that the window is a temporary popup, like a menu, tooltip, etc.
The base class for all JUCE user-interface objects.
void exitModalState(int returnValue=0)
Ends a component's modal state.
Point< int > getPosition() const noexcept
Returns the component's top-left position as a Point.
int getHeight() const noexcept
Returns the component's height in pixels.
Rectangle< int > getLocalArea(const Component *sourceComponent, Rectangle< int > areaRelativeToSourceComponent) const
Converts a rectangle to be relative to this component's coordinate space.
void toFront(bool shouldAlsoGainKeyboardFocus)
Brings the component to the front of its siblings.
void addAndMakeVisible(Component *child, int zOrder=-1)
Adds a child component to this one, and also makes the child visible if it isn't already.
void setAlwaysOnTop(bool shouldStayOnTop)
Sets whether the component should always be kept at the front of its siblings.
void postCommandMessage(int commandId)
Dispatches a numbered message to this component.
Rectangle< int > getBounds() const noexcept
Returns this component's bounding box.
void repaint()
Marks the whole component as needing to be redrawn.
Point< int > getMouseXYRelative() const
Returns the mouse's current position, relative to this component.
virtual void addToDesktop(int windowStyleFlags, void *nativeWindowToAttachTo=nullptr)
Makes this component appear as a window on the desktop.
void setBounds(int x, int y, int width, int height)
Changes the component's position and size.
void enterModalState(bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false)
Puts the component into a modal state.
int getWidth() const noexcept
Returns the component's width in pixels.
LookAndFeel & getLookAndFeel() const noexcept
Finds the appropriate look-and-feel to use for this component.
Rectangle< int > getLocalBounds() const noexcept
Returns the component's bounds, relative to its own origin.
void setTopLeftPosition(int x, int y)
Moves the component to a new position.
void addChildComponent(Component *child, int zOrder=-1)
Adds a child component to this one.
virtual void setVisible(bool shouldBeVisible)
Makes the component visible or invisible.
virtual void handleCommandMessage(int commandId)
Called to handle a command that was sent by postCommandMessage().
static Desktop &JUCE_CALLTYPE getInstance()
There's only one desktop object, and this method will return it.
A graphics context, used for drawing a component or image.
Represents a key press, including any modifier keys that are needed.
bool isKeyCode(int keyCodeToCompare) const noexcept
Checks whether the KeyPress's key is the same as the one provided, without checking the modifiers.
static const int escapeKey
key-code for the escape key
Point< ValueType > getEnd() const noexcept
Returns the line's end point.
Point< ValueType > getStart() const noexcept
Returns the line's start point.
Receives callbacks when a modal component is dismissed.
bool contains(float x, float y, float tolerance=defaultToleranceForTesting) const
Checks whether a point lies within the path.
void addBubble(Rectangle< float > bodyArea, Rectangle< float > maximumArea, Point< float > arrowTipPosition, float cornerSize, float arrowBaseWidth)
Adds a speech-bubble shape to the path.
void clear() noexcept
Removes all lines and curves, resetting the path completely.
A pair of (x, y) coordinates.
constexpr Point translated(ValueType deltaX, ValueType deltaY) const noexcept
Returns a point with a given offset from this one.
constexpr Point< float > toFloat() const noexcept
Casts this point to a Point<float> object.
Manages a rectangle and allows geometric operations to be performed on it.
ValueType getRight() const noexcept
Returns the x coordinate of the rectangle's right-hand-side.
Point< ValueType > getCentre() const noexcept
Returns the centre point of the rectangle.
Rectangle< float > toFloat() const noexcept
Casts this rectangle to a Rectangle<float>.
bool contains(ValueType xCoord, ValueType yCoord) const noexcept
Returns true if this coordinate is inside the rectangle.
ValueType getX() const noexcept
Returns the x coordinate of the rectangle's left-hand-side.
ValueType getCentreX() const noexcept
Returns the x coordinate of the rectangle's centre.
ValueType getCentreY() const noexcept
Returns the y coordinate of the rectangle's centre.
ValueType getBottom() const noexcept
Returns the y coordinate of the rectangle's bottom edge.
ValueType getY() const noexcept
Returns the y coordinate of the rectangle's top edge.
Rectangle expanded(ValueType deltaX, ValueType deltaY) const noexcept
Returns a rectangle that is larger than this one by a given amount.
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Returns a Time object that is set to the current system time.
Makes repeated callbacks to a virtual method at a specified time interval.
void stopTimer() noexcept
Stops the timer.
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
static bool areThereAnyAlwaysOnTopWindows()
Returns true if any windows have a z order that is higher than normal.