1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 mozIDOMWindowProxy
;
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
19 [scriptable
, uuid(d2ce78d1
-40b5
-49d1
-b66d
-5801fcb9a385
)]
20 interface nsIColorPickerShownCallback
: nsISupports
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
28 * @param color The new selected color value following the format specifed on
31 void update
(in AString color
);
34 * Callback called when the color picker is dismissed.
35 * When this callback is used, the color might have changed or could stay the
37 * If the color has not changed, the color parameter will be the empty string.
39 * @param color The new selected color value following the format specifed on
40 * top of this file or the empty string.
42 void done
(in AString color
);
45 [scriptable
, uuid(de229d37
-a8a6
-46f1
-969a
-0c1de33d0ad7
)]
46 interface nsIColorPicker
: nsISupports
49 * Initialize the color picker widget. The color picker will not be shown until
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
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
65 void init
(in mozIDOMWindowProxy parent
, in AString title
, in AString initialColor
, in Array
<AString
> defaultColors
);
68 * Opens the color dialog asynchrounously.
69 * The results are provided via the callback object.
71 void open
(in nsIColorPickerShownCallback aColorPickerShownCallback
);