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

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

mercurial