31 millisecondsBeforeTipAppears (delayMs)
42 if (
desktop.getMainMouseSource().canHover())
44 desktop.addGlobalMouseListener (
this);
60void TooltipWindow::paint (
Graphics& g)
65void TooltipWindow::mouseEnter (
const MouseEvent& e)
67 if (e.eventComponent ==
this)
71void TooltipWindow::mouseDown (
const MouseEvent&)
74 dismissalMouseEventOccurred =
true;
77void TooltipWindow::mouseWheelMove (
const MouseEvent&,
const MouseWheelDetails&)
80 dismissalMouseEventOccurred =
true;
83void TooltipWindow::updatePosition (
const String&
tip, Point<int> pos, Rectangle<int>
parentArea)
106 if (tipShowing !=
tip)
114 updatePosition (
tip, parent->getLocalPoint (
nullptr,
screenPos),
115 parent->getLocalBounds());
136 if (w !=
nullptr && w !=
this && w->tipShowing == tipShowing && w->getParentComponent() == parent)
148 dismissalMouseEventOccurred =
false;
154 if (detail::WindowingHelpers::isForegroundOrEmbeddedProcess (&c)
159 return ttc->getTooltip();
170 manuallyShownTip = {};
171 dismissalMouseEventOccurred =
false;
186 if (lastComponentUnderMouse !=
nullptr)
197void TooltipWindow::timerCallback()
204 if (dismissalMouseEventOccurred ||
newComp ==
nullptr)
221 lastComponentUnderMouse =
newComp;
222 lastTipUnderMouse =
newTip;
225 lastCompChangeTime = now;
229 if (
mouseSource.getLastMouseDownPosition() != lastMousePos)
230 displayTipInternal (
mousePos.roundToInt(),
newTip, ShownManually::no);
233 if (
isVisible() || now < lastHideTime + 500)
237 if (
newComp ==
nullptr || dismissalMouseEventOccurred ||
newTip.isEmpty())
247 && now > lastCompChangeTime + (
uint32) millisecondsBeforeTipAppears)
@ windowIsTemporary
Indicates that the window is a temporary popup, like a menu, tooltip, etc.
@ windowIgnoresKeyPresses
Tells the window not to catch any keypresses.
@ windowIgnoresMouseClicks
Indicates that the window should let mouse clicks pass through it (may not be possible on some platfo...
@ windowHasDropShadow
Indicates that the window should have a drop-shadow (this may not be possible on all platforms).
The base class for all JUCE user-interface objects.
void setAccessible(bool shouldBeAccessible)
Sets whether this component and its children are visible to accessibility clients.
bool isVisible() const noexcept
Tests whether the component is visible or not.
void removeFromDesktop()
If the component is currently showing on the desktop, this will hide it.
Component * getParentComponent() const noexcept
Returns the component which this component is inside.
int getHeight() const noexcept
Returns the component's height in pixels.
void toFront(bool shouldAlsoGainKeyboardFocus)
Brings the component to the front of its siblings.
static float JUCE_CALLTYPE getApproximateScaleFactorForComponent(const Component *targetComponent)
Returns the approximate scale factor for a given component by traversing its parent hierarchy and app...
void setAlwaysOnTop(bool shouldStayOnTop)
Sets whether the component should always be kept at the front of its siblings.
bool isCurrentlyBlockedByAnotherModalComponent() const
Checks whether there's a modal component somewhere that's stopping this one from receiving messages.
void setOpaque(bool shouldBeOpaque)
Indicates whether any parts of the component might be transparent.
void repaint()
Marks the whole component as needing to be redrawn.
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.
int getWidth() const noexcept
Returns the component's width in pixels.
ComponentPeer * getPeer() const
Returns the heavyweight window that contains this component.
LookAndFeel & getLookAndFeel() const noexcept
Finds the appropriate look-and-feel to use for this component.
virtual void setVisible(bool shouldBeVisible)
Makes the component visible or invisible.
virtual float getDesktopScaleFactor() const
Returns the default scale factor to use for this component when it is placed on the desktop.
MouseInputSource getMainMouseSource() const noexcept
Returns the main mouse input device that the system is using.
static Desktop &JUCE_CALLTYPE getInstance()
There's only one desktop object, and this method will return it.
void removeGlobalMouseListener(MouseListener *listener)
Unregisters a MouseListener that was added with addGlobalMouseListener().
A graphics context, used for drawing a component or image.
static ModifierKeys currentModifiers
This object represents the last-known state of the keyboard and mouse buttons.
A pair of (x, y) coordinates.
Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
static uint32 getApproximateMillisecondCounter() noexcept
Less-accurate but faster version of getMillisecondCounter().
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
unsigned int uint32
A platform-independent 32-bit unsigned integer type.