widget/nsIColorPicker.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #include "nsISupports.idl"
     9 interface nsIDOMWindow;
    11 /**
    12  * nsIColorPicker is representing colors as strings because the internal
    13  * representation will depend on the underlying backend.
    14  * The format of the colors taken in input and returned will always follow the
    15  * format of the <input type='color'> value as described in the HTML
    16  * specifications.
    17  */
    19 [scriptable, uuid(d2ce78d1-40b5-49d1-b66d-5801fcb9a385)]
    20 interface nsIColorPickerShownCallback : nsISupports
    21 {
    22  /**
    23   * Callback called when the color picker requests a color update.
    24   * This callback can not be called after done() was called.
    25   * When this callback is used, the consumer can assume that the color value has
    26   * changed.
    27   *
    28   * @param  color  The new selected color value following the format specifed on
    29   *                top of this file.
    30   */
    31  void update(in AString color);
    33  /**
    34   * Callback called when the color picker is dismissed.
    35   * When this callback is used, the color might have changed or could stay the
    36   * same.
    37   * If the color has not changed, the color parameter will be the empty string.
    38   *
    39   * @param  color  The new selected color value following the format specifed on
    40   *                top of this file or the empty string.
    41   */
    42   void done(in AString color);
    43 };
    45 [scriptable, uuid(3c3bdcce-54b1-4ae2-8647-1a8d4712ef2e)]
    46 interface nsIColorPicker : nsISupports
    47 {
    48  /**
    49   * Initialize the color picker widget. The color picker will not be shown until
    50   * open() is called.
    51   * If the backend doesn't support setting a title to the native color picker
    52   * widget, the title parameter might be ignored.
    53   * If the initialColor parameter does not follow the format specified on top of
    54   * this file, the behavior will be unspecified. The initialColor could be the
    55   * one used by the underlying backend or an arbitrary one. The backend could
    56   * also assert.
    57   *
    58   * @param      parent       nsIDOMWindow parent. This dialog will be dependent
    59   *                          on this parent. parent must be non-null.
    60   * @param      title        The title for the color picker widget.
    61   * @param      initialColor The color to show when the widget is opened. The
    62   *                          parameter has to follow the format specified on top
    63   *                          of this file.
    64   */
    65   void init(in nsIDOMWindow parent, in AString title, in AString initialColor);
    67  /**
    68   * Opens the color dialog asynchrounously.
    69   * The results are provided via the callback object.
    70   */
    71   void open(in nsIColorPickerShownCallback aColorPickerShownCallback);
    72 };

mercurial