1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/nsIColorPicker.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +interface nsIDOMWindow; 1.13 + 1.14 +/** 1.15 + * nsIColorPicker is representing colors as strings because the internal 1.16 + * representation will depend on the underlying backend. 1.17 + * The format of the colors taken in input and returned will always follow the 1.18 + * format of the <input type='color'> value as described in the HTML 1.19 + * specifications. 1.20 + */ 1.21 + 1.22 +[scriptable, uuid(d2ce78d1-40b5-49d1-b66d-5801fcb9a385)] 1.23 +interface nsIColorPickerShownCallback : nsISupports 1.24 +{ 1.25 + /** 1.26 + * Callback called when the color picker requests a color update. 1.27 + * This callback can not be called after done() was called. 1.28 + * When this callback is used, the consumer can assume that the color value has 1.29 + * changed. 1.30 + * 1.31 + * @param color The new selected color value following the format specifed on 1.32 + * top of this file. 1.33 + */ 1.34 + void update(in AString color); 1.35 + 1.36 + /** 1.37 + * Callback called when the color picker is dismissed. 1.38 + * When this callback is used, the color might have changed or could stay the 1.39 + * same. 1.40 + * If the color has not changed, the color parameter will be the empty string. 1.41 + * 1.42 + * @param color The new selected color value following the format specifed on 1.43 + * top of this file or the empty string. 1.44 + */ 1.45 + void done(in AString color); 1.46 +}; 1.47 + 1.48 +[scriptable, uuid(3c3bdcce-54b1-4ae2-8647-1a8d4712ef2e)] 1.49 +interface nsIColorPicker : nsISupports 1.50 +{ 1.51 + /** 1.52 + * Initialize the color picker widget. The color picker will not be shown until 1.53 + * open() is called. 1.54 + * If the backend doesn't support setting a title to the native color picker 1.55 + * widget, the title parameter might be ignored. 1.56 + * If the initialColor parameter does not follow the format specified on top of 1.57 + * this file, the behavior will be unspecified. The initialColor could be the 1.58 + * one used by the underlying backend or an arbitrary one. The backend could 1.59 + * also assert. 1.60 + * 1.61 + * @param parent nsIDOMWindow parent. This dialog will be dependent 1.62 + * on this parent. parent must be non-null. 1.63 + * @param title The title for the color picker widget. 1.64 + * @param initialColor The color to show when the widget is opened. The 1.65 + * parameter has to follow the format specified on top 1.66 + * of this file. 1.67 + */ 1.68 + void init(in nsIDOMWindow parent, in AString title, in AString initialColor); 1.69 + 1.70 + /** 1.71 + * Opens the color dialog asynchrounously. 1.72 + * The results are provided via the callback object. 1.73 + */ 1.74 + void open(in nsIColorPickerShownCallback aColorPickerShownCallback); 1.75 +};