Tooltips.TooltipBase: Cinnamon Javascript Reference Manual

## Tooltips.TooltipBase Tooltips.TooltipBase |

## Functions

| destroy ()

## Properties

Clutter.Actor | item |
boolean | visible |
boolean | preventShow |
array | mousePosition |

## Object Hierarchy

        Object
        ╰── Tooltips.TooltipBase

## Description

This is a base class for other tooltip items to inherit. This cannot be instantiated.

All other tooltip items inherit this object. This base class is responsible for listening to mouse events and determining when to show the tooltip. When it thinks a tooltip should be shown, it calls `this.show()`. When it thinks it should be hidden, it calls `this.hide()`. When the `item` is destroyed, it will call `this._destroy()`;

Any object wishing to implement a tooltip should inherit this class, and then implement the three functions above. It should be noted that the sole responsibility of this class is to call the three functions above. It is thus the user's job to create the tooltip actor and position it correctly in the `show` function. Example implementations for reference include the `Tooltips.Tooltip` object as well as the `WindowPreview` object in the window list applet.

When calling the `show` function, `TooltipBase` will set the `this.mousePosition` to the mouse coordinates at which the event is triggered.

When implementing the `show` and `hide` functions, the user should set the `this.visible` variable to the visibility state of the tooltip. This is since calling the `show` function does not necessarily actually show the tooltip, eg. when the tooltip text is empty and the tooltip refuses to show. The `this.visible` variable should be set properly to reflect the actual status of the tooltip.

Finally, if the user wishes to inhibit the display of a tooltip, eg. when the owner is being dragged, they can set the `this.preventShow` variable to `true`.

## Functions

### destroy ()

    destroy ();

Destroys the tooltip.

## Property Details

### The `“item”` property

      “item”                 Clutter.Actor

The object owning the tooltip.

### The `“visible”` property

      “visible”              boolean

Whether the tooltip is currently visible

### The `“preventShow”` property

      “preventShow”          boolean

Whether to inhibit the display of the tooltip

### The `“mousePosition”` property

      “mousePosition”        array

The coordinates of the event that triggered the show.