JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Types | Public Member Functions
TooltipWindow Class Reference

A window that displays a pop-up tooltip when the mouse hovers over another component. More...

Inherits Component, and Timer.

List of all members.

Public Types

enum  ColourIds { backgroundColourId = 0x1001b00, textColourId = 0x1001c00, outlineColourId = 0x1001c10 }
 A set of colour IDs to use to change the colour of various aspects of the tooltip. More...

Public Member Functions

 TooltipWindow (Component *parentComponent=nullptr, int millisecondsBeforeTipAppears=700)
 Creates a tooltip window.
 ~TooltipWindow ()
 Destructor.
void setMillisecondsBeforeTipAppears (int newTimeMs=700) noexcept
 Changes the time before the tip appears.

Detailed Description

A window that displays a pop-up tooltip when the mouse hovers over another component.

To enable tooltips in your app, just create a single instance of a TooltipWindow object.

The TooltipWindow object will then stay invisible, waiting until the mouse hovers for the specified length of time - it will then see if it's currently over a component which implements the TooltipClient interface, and if so, it will make itself visible to show the tooltip in the appropriate place.

See also:
TooltipClient, SettableTooltipClient

Member Enumeration Documentation

A set of colour IDs to use to change the colour of various aspects of the tooltip.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.

See also:
Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
Enumerator:
backgroundColourId 

The colour to fill the background with.

textColourId 

The colour to use for the text.

outlineColourId 

The colour to use to draw an outline around the tooltip.


Constructor & Destructor Documentation

TooltipWindow::TooltipWindow ( Component parentComponent = nullptr,
int  millisecondsBeforeTipAppears = 700 
) [explicit]

Creates a tooltip window.

Make sure your app only creates one instance of this class, otherwise you'll get multiple overlaid tooltips appearing. The window will initially be invisible and will make itself visible when it needs to display a tip.

To change the style of tooltips, see the LookAndFeel class for its tooltip methods.

Parameters:
parentComponentif set to 0, the TooltipWindow will appear on the desktop, otherwise the tooltip will be added to the given parent component.
millisecondsBeforeTipAppearsthe time for which the mouse has to stay still before a tooltip will be shown
See also:
TooltipClient, LookAndFeel::drawTooltip, LookAndFeel::getTooltipSize

Destructor.


Member Function Documentation

void TooltipWindow::setMillisecondsBeforeTipAppears ( int  newTimeMs = 700)

Changes the time before the tip appears.

This lets you change the value that was set in the constructor.


The documentation for this class was generated from the following file: