openshot-audio  0.1.7
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) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_TOOLTIPWINDOW_H_INCLUDED
26 #define JUCE_TOOLTIPWINDOW_H_INCLUDED
27 
28 
29 //==============================================================================
48  private Timer
49 {
50 public:
51  //==============================================================================
69  explicit TooltipWindow (Component* parentComponent = nullptr,
70  int millisecondsBeforeTipAppears = 700);
71 
73  ~TooltipWindow();
74 
75  //==============================================================================
79  void setMillisecondsBeforeTipAppears (int newTimeMs = 700) noexcept;
80 
82  void displayTip (Point<int> screenPosition, const String& text);
83 
85  void hideTip();
86 
87  //==============================================================================
95  enum ColourIds
96  {
97  backgroundColourId = 0x1001b00,
98  textColourId = 0x1001c00,
99  outlineColourId = 0x1001c10
100  };
101 
102  //==============================================================================
107  {
108  virtual ~LookAndFeelMethods() {}
109 
111  virtual Rectangle<int> getTooltipBounds (const String& tipText, Point<int> screenPos, Rectangle<int> parentArea) = 0;
112  virtual void drawTooltip (Graphics&, const String& text, int width, int height) = 0;
113 
114  #if JUCE_CATCH_DEPRECATED_CODE_MISUSE
115  // This method has been replaced by getTooltipBounds()
116  virtual int getTooltipSize (const String&, int&, int&) { return 0; }
117  #endif
118  };
119 
120 private:
121  //==============================================================================
122  Point<float> lastMousePos;
123  Component* lastComponentUnderMouse;
124  String tipShowing, lastTipUnderMouse;
125  int millisecondsBeforeTipAppears;
126  int mouseClicks, mouseWheelMoves;
127  unsigned int lastCompChangeTime, lastHideTime;
128  bool reentrant;
129 
130  void paint (Graphics&) override;
131  void mouseEnter (const MouseEvent&) override;
132  void timerCallback() override;
133  void updatePosition (const String&, Point<int>, Rectangle<int>);
134 
135  static String getTipFor (Component*);
136 
138 };
139 
140 
141 #endif // JUCE_TOOLTIPWINDOW_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_TooltipWindow.h:106
virtual ~LookAndFeelMethods()
Definition: juce_TooltipWindow.h:108
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_TooltipWindow.h:47
Definition: juce_Rectangle.h:36
Definition: juce_Component.h:33
ColourIds
Definition: juce_TooltipWindow.h:95
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_GraphicsContext.h:42
Definition: juce_Timer.h:52
Definition: juce_MouseEvent.h:36