1/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6#include "nsISupports.idl"
7
8/**
9 * An optional interface for embedding clients wishing to receive
10 * notifications for when a tooltip should be displayed or removed.
11 * The embedder implements this interface on the web browser chrome
12 * object associated with the window that notifications are required
13 * for.
14 *
15 * @see nsITooltipTextProvider
16 */
17[scriptable, uuid(44b78386-1dd2-11b2-9ad2-e4eee2ca1916)]
18interface nsITooltipListener : nsISupports
19{
20    /**
21     * Called when a tooltip should be displayed.
22     *
23     * @param aXCoords The tooltip left edge X coordinate.
24     * @param aYCoords The tooltip top edge Y coordinate.
25     * @param aTipText The text to display in the tooltip, typically obtained
26     *        from the TITLE attribute of the node (or containing parent)
27     *        over which the pointer has been positioned.
28     * @param aTipDir  The direction (ltr or rtl) in which to display the text
29     *
30     * @note
31     * Coordinates are specified in pixels, relative to the top-left
32     * corner of the browser area.
33     *
34     * @return <code>NS_OK</code> if the tooltip was displayed.
35     */
36    void onShowTooltip(in long aXCoords, in long aYCoords, in wstring aTipText,
37                       in wstring aTipDir);
38
39    /**
40     * Called when the tooltip should be hidden, either because the pointer
41     * has moved or the tooltip has timed out.
42     */
43    void onHideTooltip();
44};
45