michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDOMWindow; michael@0: michael@0: /** michael@0: * nsIColorPicker is representing colors as strings because the internal michael@0: * representation will depend on the underlying backend. michael@0: * The format of the colors taken in input and returned will always follow the michael@0: * format of the value as described in the HTML michael@0: * specifications. michael@0: */ michael@0: michael@0: [scriptable, uuid(d2ce78d1-40b5-49d1-b66d-5801fcb9a385)] michael@0: interface nsIColorPickerShownCallback : nsISupports michael@0: { michael@0: /** michael@0: * Callback called when the color picker requests a color update. michael@0: * This callback can not be called after done() was called. michael@0: * When this callback is used, the consumer can assume that the color value has michael@0: * changed. michael@0: * michael@0: * @param color The new selected color value following the format specifed on michael@0: * top of this file. michael@0: */ michael@0: void update(in AString color); michael@0: michael@0: /** michael@0: * Callback called when the color picker is dismissed. michael@0: * When this callback is used, the color might have changed or could stay the michael@0: * same. michael@0: * If the color has not changed, the color parameter will be the empty string. michael@0: * michael@0: * @param color The new selected color value following the format specifed on michael@0: * top of this file or the empty string. michael@0: */ michael@0: void done(in AString color); michael@0: }; michael@0: michael@0: [scriptable, uuid(3c3bdcce-54b1-4ae2-8647-1a8d4712ef2e)] michael@0: interface nsIColorPicker : nsISupports michael@0: { michael@0: /** michael@0: * Initialize the color picker widget. The color picker will not be shown until michael@0: * open() is called. michael@0: * If the backend doesn't support setting a title to the native color picker michael@0: * widget, the title parameter might be ignored. michael@0: * If the initialColor parameter does not follow the format specified on top of michael@0: * this file, the behavior will be unspecified. The initialColor could be the michael@0: * one used by the underlying backend or an arbitrary one. The backend could michael@0: * also assert. michael@0: * michael@0: * @param parent nsIDOMWindow parent. This dialog will be dependent michael@0: * on this parent. parent must be non-null. michael@0: * @param title The title for the color picker widget. michael@0: * @param initialColor The color to show when the widget is opened. The michael@0: * parameter has to follow the format specified on top michael@0: * of this file. michael@0: */ michael@0: void init(in nsIDOMWindow parent, in AString title, in AString initialColor); michael@0: michael@0: /** michael@0: * Opens the color dialog asynchrounously. michael@0: * The results are provided via the callback object. michael@0: */ michael@0: void open(in nsIColorPickerShownCallback aColorPickerShownCallback); michael@0: };