JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_TooltipWindow.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
53class JUCE_API TooltipWindow : public Component,
54 private Timer
55{
56public:
57 //==============================================================================
75 explicit TooltipWindow (Component* parentComponent = nullptr,
76 int millisecondsBeforeTipAppears = 700);
77
79 ~TooltipWindow() override;
80
81 //==============================================================================
85 void setMillisecondsBeforeTipAppears (int newTimeMs = 700) noexcept;
86
94 void displayTip (Point<int> screenPosition, const String& text);
95
97 void hideTip();
98
102 virtual String getTipFor (Component&);
103
104 //==============================================================================
113 {
114 backgroundColourId = 0x1001b00,
115 textColourId = 0x1001c00,
116 outlineColourId = 0x1001c10
117 };
118
119 //==============================================================================
123 struct JUCE_API LookAndFeelMethods
124 {
125 virtual ~LookAndFeelMethods() = default;
126
128 virtual Rectangle<int> getTooltipBounds (const String& tipText, Point<int> screenPos, Rectangle<int> parentArea) = 0;
129 virtual void drawTooltip (Graphics&, const String& text, int width, int height) = 0;
130 };
131
132 //==============================================================================
134 float getDesktopScaleFactor() const override;
136 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
137
138private:
139 //==============================================================================
140 Point<float> lastMousePos;
141 SafePointer<Component> lastComponentUnderMouse;
142 String tipShowing, lastTipUnderMouse, manuallyShownTip;
143 int millisecondsBeforeTipAppears;
144 unsigned int lastCompChangeTime = 0, lastHideTime = 0;
145 bool reentrant = false, dismissalMouseEventOccurred = false;
146
147 enum ShownManually { yes, no };
148 void displayTipInternal (Point<int>, const String&, ShownManually);
149
150 void paint (Graphics&) override;
151 void mouseEnter (const MouseEvent&) override;
152 void mouseDown (const MouseEvent&) override;
153 void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&) override;
154 void timerCallback() override;
155 void updatePosition (const String&, Point<int>, Rectangle<int>);
156
158};
159
160} // namespace juce
Holds a pointer to some type of Component, which automatically becomes null if the component is delet...
The base class for all JUCE user-interface objects.
A graphics context, used for drawing a component or image.
Contains position and status information about a mouse event.
A pair of (x, y) coordinates.
Definition juce_Point.h:42
Manages a rectangle and allows geometric operations to be performed on it.
The JUCE String class!
Definition juce_String.h:53
Makes repeated callbacks to a virtual method at a specified time interval.
Definition juce_Timer.h:52
A window that displays a pop-up tooltip when the mouse hovers over another component.
ColourIds
A set of colour IDs to use to change the colour of various aspects of the tooltip.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
Contains status information about a mouse wheel event.
This abstract base class is implemented by LookAndFeel classes to provide window drawing functionalit...
virtual Rectangle< int > getTooltipBounds(const String &tipText, Point< int > screenPos, Rectangle< int > parentArea)=0
returns the bounds for a tooltip at the given screen coordinate, constrained within the given desktop...